openstack(Pike 版)集群部署(四)--- Nova 部署
一、介绍
参照官网部署:https://docs.openstack.org/nova/pike/install/
继续上一博客进行部署:http://www.cnblogs.com/weijie0717/p/8563294.html
二、部署 Nova-controller
1、配置数据库 (任意controller 节点操作)
# mysql -uroot -p
a、创建数据库
MariaDB [(none)]> CREATE DATABASE nova_api;
MariaDB [(none)]> CREATE DATABASE nova;
MariaDB [(none)]> CREATE DATABASE nova_cell0;
b、创建用户,分配权限
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_DBPASS'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_DBPASS'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_DBPASS'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_DBPASS'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_DBPASS'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_DBPASS';
2、配置 Nova用户 和API 信息(任意controller 节点操作)
a、获取管理员认证权限
# source admin-openrc
b、创建用户
# openstack user create --domain default --password-prompt nova
c、分配 Nova 到 指定project 和 role
# openstack role add --project service --user nova admin
d、创建 openstack Nova 服务
# openstack service create --name nova --description "OpenStack Compute" compute
e、创建 Nova API (admin,public,internal)
# openstack endpoint create --region RegionOne compute public http://controller:8774/v2.1
#openstack endpoint create --region RegionOne compute internal http://controller:8774/v2.1
#openstack endpoint create --region RegionOne compute admin http://controller:8774/v2.1
f、创建 Placement 用户
# openstack user create --domain default --password-prompt placement
g、分配 Placement 到 指定project 和 role
# openstack role add --project service --user placement admin
h、创建 Placement API (admin,public,internal)
# openstack endpoint create --region RegionOne placement public http://controller:8778
# openstack endpoint create --region RegionOne placement internal http://controller:8778
# openstack endpoint create --region RegionOne placement admin http://controller:8778
3、 Nova 包安装 (所有controller-node)
# yum install openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler openstack-nova-placement-api -y
4、修改 nova 配置文件
a、# vim /etc/nova/nova.conf
[DEFAULT] # ... enabled_apis = osapi_compute,metadata transport_url = rabbit://openstack:Nihao.521@controller1:5672,openstack:Nihao.521@controller2:5672,openstack:Nihao.521@controller3:5672 my_ip = 10.6.32.51 #各控制节点配置不同之处 use_neutron = True firewall_driver = nova.virt.firewall.NoopFirewallDriver
osapi_compute_listen=10.6.32.51 #各控制节点配置不同之处
osapi_compute_listen_port=8774
novncproxy_host=10.6.32.51
novncproxy_port=6080
[api_database] # ... connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova_api [database] # ... connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova [api] # ... auth_strategy = keystone [keystone_authtoken] # ... auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = nova password = NOVA_PASS [vnc] enabled = true # ... vncserver_listen = $my_ip vncserver_proxyclient_address = $my_ip [glance] # ... api_servers = http://controller:9292 [oslo_concurrency] # ... lock_path = /var/lib/nova/tmp [placement] # ... os_region_name = RegionOne project_domain_name = Default project_name = service auth_type = password user_domain_name = Default auth_url = http://controller:35357/v3 username = placement password = PLACEMENT_PASS
b、#vim /etc/httpd/conf.d/00-nova-placement-api.conf
Listen 10.6.32.51:8778 #修改此处,各控制节点配置不同之处 #最后添加如下行 <Directory /usr/bin> <IfVersion >= 2.4> Require all granted </IfVersion> <IfVersion < 2.4> Order allow,deny Allow from all </IfVersion> </Directory>
c、同步配置文件到其他节点,然后分别修改配置文件不同之处
# scp /etc/nova/nova.conf root@controller2:/etc/nova/nova.conf
# scp /etc/nova/nova.conf root@controller3:/etc/nova/nova.conf
# scp /etc/httpd/conf.d/00-nova-placement-api.conf root@controller2:/etc/httpd/conf.d/00-nova-placement-api.conf
# scp /etc/httpd/conf.d/00-nova-placement-api.conf root@controller3:/etc/httpd/conf.d/00-nova-placement-api.conf
d、重启httpd 服务(所有controller节点)
# systemctl restart httpd
e、按照官网初始化数据库 (任意控制节点)
# su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
# su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
# su -s /bin/sh -c "nova-manage db sync" nova
f、查看
# nova-manage cell_v2 list_cells
# openstack host list
g、启动服务和开机自启动
# systemctl enable openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
# systemctl start openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
h、配置 Haproxy
博客:http://www.cnblogs.com/weijie0717/p/8530102.html
更具博客 配置:nova-api server 、nova novncproxy server 、nova-placement-api server
三、部署 Nova -computer
1、包安装
# yum install openstack-nova-compute
2、修改 Nova 配置文件
#vim /etc/nova/nova.conf
[DEFAULT] # ... enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:Nihao.521@controller1:5672,openstack:Nihao.521@controller2:5672,openstack:Nihao.521@controller3:5672 my_ip = 10.6.32.54 use_neutron = True firewall_driver = nova.virt.firewall.NoopFirewallDriver [api] # ... auth_strategy = keystone [keystone_authtoken] # ... auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = nova password = NOVA_PASS [vnc] # ... enabled = True vncserver_listen = 0.0.0.0 vncserver_proxyclient_address = $my_ip novncproxy_base_url = http://10.6.32.200:6080/vnc_auto.html [glance] # ... api_servers = http://controller:9292 [oslo_concurrency] # ... lock_path = /var/lib/nova/tmp [placement] # ... os_region_name = RegionOne project_domain_name = Default project_name = service auth_type = password user_domain_name = Default auth_url = http://controller:35357/v3 username = placement password = PLACEMENT_PASS 另外执行以下命令,如果返回值大于0使用默认kvm,如果等于零,需要修改为qemu。 # egrep -c '(vmx|svm)' /proc/cpuinfo [libvirt] # ... virt_type = qemu
3、启动服务,并开机自启动
# systemctl enable libvirtd.service openstack-nova-compute.service
# systemctl start libvirtd.service openstack-nova-compute.service
4、添加 computer 节点到 call database. (任意computer 节点运行)
# source admin-openr
# openstack compute service list --service nova-compute
# su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
四、 验证 (控制节点)
1、List service components to verify successful launch and registration of each process:
# openstack compute service list
2、List API endpoints in the Identity service to verify connectivity with the Identity service:
# openstack catalog list
3、List images in the Image service to verify connectivity with the Image service:
# openstack image list
4、Check the cells and placement API are working successfully:
# nova-status upgrade check
完成