实训涉及节点
controller compute
实训目标
[root@controller ~]# yum -y install openstack-nova-api openstack-nova-cert openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler python-novaclient
2、 创建Nova数据库并添加授权
[root@controller ~]# openstack-db --init --service nova --password 000000
[root@controller ~]# mysql -uroot -p000000
mysql>grant all privileges on nova.* to 'nova'@'localhost' identified by '000000';
mysql> grant all privileges on nova.* to 'nova'@'%' identified by '000000';
[root@controller ~]# openstack-config --set /etc/nova/nova.conf database connection mysql://nova:000000@controller/nova
[root@controller ~]# mysql -uroot -p000000 -e "use nova;show tables;"
3、注册Nova服务至Keystone服务器
注册两方面信息(用户信息,服务service和端点endpoint信息)
[root@controller ~]# keystone user-create --name=nova --pass=000000
[root@controller ~]# keystone user-role-add --user=nova --tenant=service --role=admin
[root@controller ~]# keystone service-create --name=nova --type=compute --description="Openstack Compute"
[root@controller ~]# keystone endpoint-create --service-id=$(keystone service-list | awk '/ compute / {print $2}') --publicurl=http://controller:8774/v2/%\(tenant_id\)s --internalurl=http://controller:8774/v2/%\(tenant_id\)s --adminurl=http://controller:8774/v2/%\(tenant_id\)s
配置Nova使用消息队列服务
[root@controller ~]# openstack-config --set /etc/nova/nova.conf DEFAULT rpc_backend qpid
[root@controller ~]# openstack-config --set /etc/nova/nova.conf DEFAULT qpid_hostname controller
3、 修改Nova的配置文件
[root@controller ~]# openstack-config --set /etc/nova/nova.conf DEFAULT auth_strategy keystone
[root@controller ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_uri http://controller:5000
[root@controller ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_host controller
[root@controller ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_protocol http
[root@controller ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_port 35357
[root@controller ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken admin_user nova
[root@controller ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken admin_tenant_name service
[root@controller ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken admin_password 000000
4、 修改配置文件,连接controller节点vnc服务
[root@controller ~]#openstack-config --set /etc/nova/nova.conf DEFAULT my_ip 192.168.100.10
[root@controller ~]#openstack-config --set /etc/nova/nova.conf DEFAULT vncserver_listen 192.168.100.10
[root@controller ~]#openstack-config --set /etc/nova/nova.conf DEFAULT vncserver_proxyclient_address 192.168.100.10
5、 启动服务并设置开机自启
[root@controller ~]#service openstack-nova-api restart
[root@controller ~]#service openstack-nova-cert restart
[root@controller ~]#service openstack-nova-consoleauth restart
[root@controller ~]#service openstack-nova-conductor restart
[root@controller ~]#service openstack-nova-scheduler restart
[root@controller ~]#service openstack-nova-novncproxy restart
[root@controller ~]#chkconfig openstack-nova-api on
[root@controller ~]#chkconfig openstack-nova-cert on
[root@controller ~]#chkconfig openstack-nova-consoleauth on
[root@controller ~]#chkconfig openstack-nova-conductor on
[root@controller ~]#chkconfig openstack-nova-scheduler on
[root@controller ~]#chkconfig openstack-nova-novncproxy on
6、 验证Nova
[root@controller ~]# nova image-list
(compute)
1、 安装Nova计算服务软件包
[root@compute ~]# yum -y install openstack-nova-compute
2、 配置Nova认证和数据库连接
[root@compute ~]# yum -y install openstack-utils
[root@compute ~]# openstack-config --set /etc/nova/nova.conf database connection mysql://nova:000000@controller/nova
[root@compute ~]# openstack-config --set /etc/nova/nova.conf database connection mysql://nova:000000@controller/nova
[root@compute ~]# openstack-config --set /etc/nova/nova.conf DEFAULT auth_strategy keystone
[root@compute ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_uri http://controller:5000
[root@compute ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_host controller
[root@compute ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_protocol http
[root@compute ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_port 35357
[root@compute ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken admin_user nova
[root@compute ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken admin_tenant_name service
[root@compute ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken admin_password 000000
3、 配置消息代理服务
[root@compute ~]#openstack-config --set /etc/nova/nova.conf DEFAULT rpc_backend qpid
[root@compute ~]#openstack-config --set /etc/nova/nova.conf DEFAULT qpid_hostname controller
4、 配置控制台对实例访问
[root@compute ~]#openstack-config --set /etc/nova/nova.conf DEFAULT my_ip 192.168.100.20
[root@compute ~]#openstack-config --set /etc/nova/nova.conf DEFAULT vnc_enabled True
[root@compute ~]#openstack-config --set /etc/nova/nova.conf DEFAULT vncserver_listen 0.0.0.0
[root@compute ~]#openstack-config --set /etc/nova/nova.conf DEFAULT vncserver_proxyclient_address 192.168.100.20
[root@compute ~]#openstack-config --set /etc/nova/nova.conf DEFAULT novncproxy_base_url http://192.168.100.10:6080/vnc_auto.html
5、 指定运行镜像服务的主机
[root@compute ~]# openstack-config --set /etc/nova/nova.conf DEFAULT glance_host controller
6、 检查系统处理器是否支持虚拟机的硬件加速
[root@compute ~]# egrep -c '(vmx|svm)' /proc/cpuinfo
如果该命令返回一个1或更大的值,说明系统支持,通常不需要额外的配置
如果为0,则不支持,而需要配置libvirt取代KVM来使用QEMU,命令如下:
[root@compute ~]# openstack-config --set /etc/nova/nova.conf libvirt virt_type qemu
7、 启动服务并设置开机自启
[root@compute ~]#service libvirtd restart
[root@compute ~]#service messagebus restart
[root@compute ~]#service openstack-nova-compute restart
[root@compute ~]#chkconfig libvirtd on
[root@compute ~]#chkconfig messagebus on
[root@compute ~]#chkconfig openstack-nova-compute on