搭建Openstack集群

安装Nova

Nova是Openstack项目中的计算节点,类似于宿主机节点。话说Nasa主导的项目果然有Nasa的味道。Nova是指超新星

还是Controller主机

#apt-get install nova-novncproxy novnc nova-api nova-ajax-console-proxy nova-cert nova-conductor nova-consoleauth nova-doc nova-scheduler python-novaclient

创建新的nova配置文件

#rm /etc/nova/nova.conf

vi /etc/nova/nova.conf

[DEFAULT]
 my_ip=192.168.10.3
 vncserver_listen=192.168.10.3
 vncserver_proxyclient_address=192.168.10.3[database]
 connection = mysql://nova:password@controller/nova
 auth_strategy=keystone
 api_paste_config=/etc/nova/api-paste.ini 
[keystone_authtoken]
 auth_host = controller
 auth_port = 35357
 auth_protocol = http
 admin_tenant_name = service
 admin_user = nova
 admin_password = password
 state_path=/var/lib/nova
 log_dir=/var/log/nova
 lock_path=/var/lock/nova
 glance_host= controller
 rpc_backend = nova.rpc.impl_kombu
 rabbit_host = controller
 rabbit_password = password

删除sqlite文件

#rm /var/lib/nova/nova.sqlite

你懂得,还是创建MySQL用户

CREATE DATABASE nova;
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY ‘password';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY ‘password';

创建表结构

#nova-manage db sync //注意!这个命令没有下划,是个空格:)

照旧创建用户。好吧,我不得不说Litrin做到这一步的时候完全已经机械化了,直接准备了脚本。

#keystone user-create --name=nova --pass=password --email=nova@example.com
#keystone user-role-add --user=nova --tenant=service --role=admin

修改/etc/nova/api-paste.ini

[filter:authtoken]
 paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
 auth_host = controller
 auth_port = 35357
 auth_protocol = http
 auth_uri = http://controller:5000/v2.0
 admin_tenant_name = service
 admin_user = nova
 admin_password = password

创建服务,照例得到service id,并注册endpoint

#keystone service-create --name=nova --type=compute --description="Nova Compute service"
#keystone endpoint-create --service-id=SERVER_ID --publicurl=http://controller:8774/v2/%\(tenant_id\)s --internalurl=http://controller:8774/v2/%\(tenant_id\)s --adminurl=http://controller:8774/v2/%\(tenant_id\)s

这里多嘴一句,当初我创建endpoint的时候输入了错误的url导致keystone都挂了。keystone一挂全部都要推倒重来。抱着试试看的心态直接DB update keystone.endpoint表竟然奇迹般修复了。推荐给不走运的人。

一堆的重起

 #service nova-api restart
 #service nova-cert restart
 #service nova-consoleauth restart
 #service nova-scheduler restart
 #service nova-conductor restart
 #service nova-novncproxy restart

冒烟

#nova image-list

切换主机到Compute

安装,并将当前内核设置为644可读(重要)

#apt-get install nova-compute-kvm python-guestfs
#dpkg-statoverride --update --add root root 0644 /boot/vmlinuz-$(uname -r)

确保更新内核后依然可读,需要建立一个文件/etc/kernel/postinst.d/statoverride

#!/bin/sh
 version="$1"
 # passing the kernel version is required
 [ -z "${version}" ] && exit 0
 dpkg-statoverride --update --add root root 0644 /boot/vmlinuz-${version}

设置为可执行

chmod +x /etc/kernel/postinst.d/statoverride

配置/etc/nova/nova.conf

[DEFAULT]
 auth_strategy=keystone
 rpc_backend = nova.rpc.impl_kombu
 rabbit_host = controller
 rabbit_password = password
 my_ip=192.168.0.11
 vnc_enabled=True
 vncserver_listen=0.0.0.0
 vncserver_proxyclient_address=192.168.0.11
 glance_host=controller
;CONTROLLER_FLOATING_IP指Controller主机E网的IP地址
 novncproxy_base_url=http://CONTROLLER_FLOATING_IP:6080/vnc_auto.html
[database]
 connection = mysql://nova:password@controller/nova
 state_path=/var/lib/nova
 log_dir=/var/log/nova
 lock_path=/var/lock/nova
 glance_host= controller

修改/etc/nova/api-paste.ini

[filter:authtoken]
 paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
 auth_host = controller
 auth_port = 35357
 auth_protocol = http
 admin_tenant_name = service
 admin_user = nova
 admin_password = password

重起节点,删除SQLite

#service nova-compute restart
#rm /var/lib/nova/nova.sqlite
推荐阅读:
Open media vault 开启Wi-Fi热点

之前家里弱电箱一直放着着一套W Read more

硬件中断问题和性能优化

自打从硬件方向研究性能优化起, Read more

Kubernetes的部署

之前我们通过几个概念简单的介绍 Read more

发表评论

电子邮件地址不会被公开。 必填项已用*标注

请补全下列算式: *

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据