B09-openstack高可用(t版)-nova控制节点集群部署
1. 创建nova相关数据库
[root@controller01 ~]# mysql -u root -phuayun -e "CREATE DATABASE nova_api;"
[root@controller01 ~]# mysql -u root -phuayun -e "CREATE DATABASE nova;"
[root@controller01 ~]# mysql -u root -phuayun -e "CREATE DATABASE nova_cell0;"
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' \
-> IDENTIFIED BY 'huayun';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' \
-> IDENTIFIED BY 'huayun';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' \
-> IDENTIFIED BY 'huayun';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' \
-> IDENTIFIED BY 'huayun';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' \
-> IDENTIFIED BY 'huayun';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' \
-> IDENTIFIED BY 'huayun';
2. 创建nova
1)创建nova
[root@controller01 ~]# openstack user create --domain default --password=huayun nova
2)为nova用户赋予admin权限
[root@controller01 ~]# openstack role add --project service --user nova admin
3)创建nova服务实体
[root@controller01 ~]# openstack service create --name nova --description "OpenStack Compute" compute
4)创建/placement-api
# 注意--region与初始化admin用户时生成的region一致; # api地址统一采用vip,如果public/internal/admin分别使用不同的vip,请注意区分; # nova-api 服务类型为compute,placement-api服务类型为placement; # nova public api
创建nova的api
[root@controller01 ~]# openstack endpoint create --region RegionOne compute public http://10.100.214.200:8774/v2.1
[root@controller01 ~]# openstack endpoint create --region RegionOne compute internal http://10.100.214.200:8774/v2.1
[root@controller01 ~]# openstack endpoint create --region RegionOne compute admin http://10.100.214.200:8774/v2.1
3. 安装nova
[root@controller01 ~]# yum install openstack-nova-api openstack-nova-conductor openstack-nova-novncproxy openstack-nova-scheduler -y
4. 配置nova.conf
[root@controller01 ~]# egrep -v "^#|^$" /etc/nova/nova.conf
[DEFAULT]
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:huayun@10.100.214.201:5672,10.100.214.202:5672,10.100.214.203:5672
my_ip = 10.100.214.201
use_neutron = true
firewall_driver = nova.virt.firewall.NoopFirewallDriver
osapi_compute_listen_port=8774
metadata_listen_port=8775
metadata_listen=$my_ip
osapi_compute_listen=$my_ip
[api]
auth_strategy = keystone
[api_database]
connection = mysql+pymysql://nova:huayun@10.100.214.200/nova_api
[barbican]
[cache]
backend=oslo_cache.memcache_pool
enabled=True
memcache_servers=10.100.214.201:11211,10.100.214.202:11211,10.100.214.203:11211
[cinder]
[compute]
[conductor]
[console]
[consoleauth]
[cors]
[database]
connection = mysql+pymysql://nova:huayun@10.100.214.200/nova
[devices]
[ephemeral_storage_encryption]
[filter_scheduler]
[glance]
api_servers = http://10.100.214.200:9292
[guestfs]
[healthcheck]
[hyperv]
[ironic]
[key_manager]
[keystone]
[keystone_authtoken]
www_authenticate_uri = http://10.100.214.200:5000/
auth_url = http://10.100.214.200:5000/
memcached_servers = 10.100.214.201:11211,10.100.214.202:11211,10.100.214.203:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = nova
password = huayun
[libvirt]
[metrics]
[mks]
[neutron]
[notifications]
[osapi_v21]
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_middleware]
[oslo_policy]
[pci]
[placement]
region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://10.100.214.200:5000/v3
username = placement
password = huayun
[powervm]
[privsep]
[profiler]
[quota]
[rdp]
[remote_debug]
[scheduler]
[serial_console]
[service_user]
[spice]
[upgrade_levels]
[vault]
[vendordata_dynamic_auth]
[vmware]
[vnc]
enabled = true
server_listen = $my_ip
server_proxyclient_address = $my_ip
novncproxy_host=$my_ip
novncproxy_port=6080
[workarounds]
[wsgi]
[xenserver]
[xvp]
[zvm]
将nova的配置文件拷贝到另外的控制节点上:
[root@controller01 ~]# scp /etc/nova/nova.conf 10.100.214.202:/etc/nova/
[root@controller01 ~]# scp /etc/nova/nova.conf 10.100.214.203:/etc/nova/
6. 同步nova相关数据库
# 任意控制节点操作;
# 同步nova-api数据库
[root@controller01 ~]# su -s /bin/sh -c "nova-manage api_db sync" nova
# 注册cell0数据库
[root@controller01 ~]# su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
# 创建cell1 cell
[root@controller01 ~]# su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
# 同步nova数据库;
# 忽略”deprecated”信息
[root@controller01 ~]# su -s /bin/sh -c "nova-manage db sync" nova
[root@controller01 ~]# su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova
+-------+--------------------------------------+---------------------------------------------+-----------------------------------------------------+----------+
| Name | UUID | Transport URL | Database Connection | Disabled |
+-------+--------------------------------------+---------------------------------------------+-----------------------------------------------------+----------+
| cell0 | 00000000-0000-0000-0000-000000000000 | none:/ | mysql+pymysql://nova:****@10.100.214.200/nova_cell0 | False |
| cell1 | 73beb316-80db-447d-bbfe-e968b8c2c880 | rabbit://openstack:****@10.100.214.200:5672 | mysql+pymysql://nova:****@10.100.214.200/nova | False |
+-------+--------------------------------------+---------------------------------------------+-----------------------------------------------------+----------+
7. 启动服务
[root@controller01 ~]# systemctl enable openstack-nova-api.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
[root@controller02 ~]# systemctl start openstack-nova-api.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
8. 验证
[root@controller01 ~]# netstat -tunlp | egrep '8774|8775|8778|6080'
[root@controller01 ~]# openstack compute service list
[root@controller01 ~]# openstack catalog list
检查cell与placement api运行正常
[root@controller01 ~]# nova-status upgrade check
检测的时候会发现下面的报错,这个是t版本的一个bug
只需要在执行下面操作:(在该文件最下面添加即可)
[root@controller01 ~]# vim /etc/httpd/conf.d/00-placement-api.conf
<Directory /usr/bin>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
<IfVersion < 2.4>
Order allow,deny
Allow from all
</IfVersion>
</Directory>
重启httpd服务:
systemctl restart httpd
9. 设置pcs资源
[root@controller01 ~]# pcs resource create openstack-nova-api systemd:openstack-nova-api --clone interleave=true
[root@controller01 ~]# pcs resource create openstack-nova-scheduler systemd:openstack-nova-scheduler --clone interleave=true
[root@controller01 ~]# pcs resource create openstack-nova-conductor systemd:openstack-nova-conductor --clone interleave=true
[root@controller01 ~]# pcs resource create openstack-nova-novncproxy systemd:openstack-nova-novncproxy --clone interleave=true
查看pcs资源