[关闭]
@zhangyy 2020-01-07T10:18:43.000000Z 字数 7043 阅读 174

Openstack 云计算(二): Openstack Rocky部署三 nova 部署与验证 (控制节点)

openstack系列


  • 一: nova 的部署
  • 二: nova 验证

一: nova的部署

1.1 nova 数据库创建

  1. mysql -uroot -p flyfish225
  2. CREATE DATABASE nova_api;
  3. CREATE DATABASE nova;
  4. CREATE DATABASE nova_cell0;
  5. CREATE DATABASE placement;
  6. GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'nova';
  7. GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'nova';
  8. GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'nova';
  9. GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'nova';
  10. GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY 'nova';
  11. GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'nova';
  12. GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'localhost' IDENTIFIED BY 'placement';
  13. GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' IDENTIFIED BY 'placement';
  14. flush privileges;
  15. show databases;
  16. select user,host from mysql.user;

image_1d8n86kok1mrdvcbc0on6q13n69.png-193.3kB

image_1d8n87epp1t0pf435bist2c2m.png-164.7kB

image_1d8n886ck1je616nv131e1uj7bq013.png-158.8kB

1.2 在keystone上面注册nova服务

  1. openstack user create --domain default --password=nova nova
  2. openstack user list

image_1d8n8a7r3d5c4rc1rn5141a1thi1g.png-110.4kB

  1. keystone上将nova用户配置为admin角色并添加进service项目
  2. openstack role add --project service --user nova admin

image_1d8n8c05pl1d1kku4bq62uc9j2g.png-23.3kB

  1. 创建nova计算服务的实体
  2. openstack service create --name nova --description "OpenStack Compute" compute
  3. openstack service list

4.png-69.1kB

  1. 创建计算服务的API端点(endpoint
  2. openstack endpoint create --region RegionOne compute public http://controller:8774/v2.1
  3. openstack endpoint create --region RegionOne compute internal http://controller:8774/v2.1
  4. openstack endpoint create --region RegionOne compute admin http://controller:8774/v2.1
  5. openstack endpoint list

image_1d8n8j7891f1e14ao1vg27q61mfm39.png-143.2kB

image_1d8n8k4su59dv5qudv1b311vsp3m.png-219.1kB

  1. 这个版本的nova增加了placement项目
  2. 同样,创建并注册该项目的服务证书
  3. openstack user create --domain default --password=placement placement
  4. openstack role add --project service --user placement admin
  5. openstack service create --name placement --description "Placement API" placement

5.png-73.2kB

  1. 创建placement项目的endpointAPI端口)
  2. openstack endpoint create --region RegionOne placement public http://controller:8778
  3. openstack endpoint create --region RegionOne placement internal http://controller:8778
  4. openstack endpoint create --region RegionOne placement admin http://controller:8778
  5. openstack endpoint list

6.png-98kB

7.png-198.3kB

  1. 在控制节点安装nova相关服务
  2. yum install openstack-nova-api openstack-nova-conductor \
  3. openstack-nova-console openstack-nova-novncproxy \
  4. openstack-nova-scheduler openstack-nova-placement-api -y
  1. openstack-config --set /etc/nova/nova.conf DEFAULT enabled_apis osapi_compute,metadata
  2. openstack-config --set /etc/nova/nova.conf DEFAULT my_ip 10.0.0.11
  3. openstack-config --set /etc/nova/nova.conf DEFAULT use_neutron true
  4. openstack-config --set /etc/nova/nova.conf DEFAULT firewall_driver nova.virt.firewall.NoopFirewallDriver
  5. openstack-config --set /etc/nova/nova.conf DEFAULT transport_url rabbit://openstack:openstack@controller
  6. openstack-config --set /etc/nova/nova.conf api_database connection mysql+pymysql://nova:nova@controller/nova_api
  7. openstack-config --set /etc/nova/nova.conf database connection mysql+pymysql://nova:nova@controller/nova
  8. openstack-config --set /etc/nova/nova.conf placement_database connection mysql+pymysql://placement:placement@controller/placement
  9. openstack-config --set /etc/nova/nova.conf api auth_strategy keystone
  10. openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_url http://controller:5000/v3
  11. openstack-config --set /etc/nova/nova.conf keystone_authtoken memcached_servers controller:11211
  12. openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_type password
  13. openstack-config --set /etc/nova/nova.conf keystone_authtoken project_domain_name default
  14. openstack-config --set /etc/nova/nova.conf keystone_authtoken user_domain_name default
  15. openstack-config --set /etc/nova/nova.conf keystone_authtoken project_name service
  16. openstack-config --set /etc/nova/nova.conf keystone_authtoken username nova
  17. openstack-config --set /etc/nova/nova.conf keystone_authtoken password nova
  18. openstack-config --set /etc/nova/nova.conf vnc enabled true
  19. openstack-config --set /etc/nova/nova.conf vnc server_listen '$my_ip'
  20. openstack-config --set /etc/nova/nova.conf vnc server_proxyclient_address '$my_ip'
  21. openstack-config --set /etc/nova/nova.conf glance api_servers http://controller:9292
  22. openstack-config --set /etc/nova/nova.conf oslo_concurrency lock_path /var/lib/nova/tmp
  23. openstack-config --set /etc/nova/nova.conf placement region_name RegionOne
  24. openstack-config --set /etc/nova/nova.conf placement project_domain_name Default
  25. openstack-config --set /etc/nova/nova.conf placement project_name service
  26. openstack-config --set /etc/nova/nova.conf placement auth_type password
  27. openstack-config --set /etc/nova/nova.conf placement user_domain_name Default
  28. openstack-config --set /etc/nova/nova.conf placement auth_url http://controller:5000/v3
  29. openstack-config --set /etc/nova/nova.conf placement username placement
  30. openstack-config --set /etc/nova/nova.conf placement password placement
  31. openstack-config --set /etc/nova/nova.conf scheduler discover_hosts_in_cells_interval 300

image_1d8n9dsg98a2oba1o5hkq71dm057.png-372.3kB

image_1d8n9ej5v35g1dq6bfv1bvt7ub5k.png-313.3kB

  1. egrep -v "^#|^$" /etc/nova/nova.conf

image_1d8n9fi8qqsoo11bg71u22bl96h.png-135.1kB

  1. 修改nova的虚拟主机配置文件
  2. cp /etc/httpd/conf.d/00-nova-placement-api.conf /etc/httpd/conf.d/00-nova-placement-api.conf.bak
  3. vim /etc/httpd/conf.d/00-nova-placement-api.conf
  4. ----
  5. Listen 8778
  6. <VirtualHost *:8778>
  7. WSGIProcessGroup nova-placement-api
  8. WSGIApplicationGroup %{GLOBAL}
  9. WSGIPassAuthorization On
  10. WSGIDaemonProcess nova-placement-api processes=3 threads=1 user=nova group=nova
  11. WSGIScriptAlias / /usr/bin/nova-placement-api
  12. <IfVersion >= 2.4>
  13. ErrorLogFormat "%M"
  14. </IfVersion>
  15. ErrorLog /var/log/nova/nova-placement-api.log
  16. #SSLEngine On
  17. #SSLCertificateFile ...
  18. #SSLCertificateKeyFile ...
  19. </VirtualHost>
  20. Alias /nova-placement-api /usr/bin/nova-placement-api
  21. <Location /nova-placement-api>
  22. SetHandler wsgi-script
  23. Options +ExecCGI
  24. WSGIProcessGroup nova-placement-api
  25. WSGIApplicationGroup %{GLOBAL}
  26. WSGIPassAuthorization On
  27. </Location>
  28. # made by zhangyy
  29. <Directory /usr/bin>
  30. <IfVersion >= 2.4>
  31. Require all granted
  32. </IfVersion>
  33. <IfVersion < 2.4>
  34. Order allow,deny
  35. Allow from all
  36. </IfVersion>
  37. </Directory>
  38. ------
  39. systemctl restart httpd
  40. systemctl status httpd

image_1d8n9nbiq11nlvb7cb3r8a18v16u.png-218.2kB

  1. 至此,nova计算服务的软件包安装完成

1.3 同步nova数据(注意同步顺序)

  1. nova_api32张表,placement32张表,nova_cell0110张表,nova也有110张表
  2. 初始化nova-apiplacement数据库
  3. su -s /bin/sh -c "nova-manage api_db sync" nova
  4. mysql -h10.0.0.11 -unova -pnova -e "use nova_api;show tables;"
  5. mysql -h10.0.0.11 -uplacement -pplacement -e "use placement;show tables;"

image_1d8n9unucsooc7v1ppr1ka1dfp7b.png-146.5kB

image_1d8n9vdg3rc11gnn1d5f1ua217jv7r.png-128.6kB

  1. nova_apiplacement都有32张表,区别在于nova_api数据库的cell_mappings表多两条数据,存放的是novarabbitmq等的配置信息
  1. 初始化nova_cell0nova数据库
  2. # 注册cell0数据库
  3. su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
  4. # 创建cell1单元
  5. su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
  6. # 初始化nova数据库
  7. su -s /bin/sh -c "nova-manage db sync" nova
  8. # 检查确认cell0和cell1注册成功
  9. su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova
  10. # 验证数据库
  11. mysql -h10.0.0.11 -unova -pnova -e "use nova_cell0;show tables;"
  12. mysql -h10.0.0.11 -unova -pnova -e "use nova;show tables;"

image_1d8nbj687rqer07st01kn518l388.png-232.9kB

image_1d8nbkckc1aen46a18c541i1jfb8l.png-158.5kB

  1. 通过对比可知,这两个数据库的表目前完全一样,区别在于nova数据库的service表中有4条数据,存放的是当前版本nova相关服务的注册信息

  1. 检查确认cell0cell1注册成功
  2. su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova

image_1d8nbmvu06841ug81r5ue6q149s92.png-76.5kB

  1. 返回的数据存储在nova_api数据库的cell_mappings表中
  1. 启动nova服务
  2. 需要启动5个服务
  3. systemctl start openstack-nova-api.service openstack-nova-consoleauth.service \
  4. openstack-nova-scheduler.service openstack-nova-conductor.service \
  5. openstack-nova-novncproxy.service
  6. systemctl status openstack-nova-api.service openstack-nova-consoleauth.service \
  7. openstack-nova-scheduler.service openstack-nova-conductor.service \
  8. openstack-nova-novncproxy.service
  9. systemctl enable openstack-nova-api.service openstack-nova-consoleauth.service \
  10. openstack-nova-scheduler.service openstack-nova-conductor.service \
  11. openstack-nova-novncproxy.service
  12. systemctl list-unit-files |grep openstack-nova* |grep enabled

8.png-193.7kB

image_1d8nbufdl1o21tiprff1vde1ubfar.png-259.3kB

image_1d8nc0c8ror8ia21q12p9h87bco.png-330.4kB

  1. 至此,在控制节点安装nova计算服务就完成了,下篇文章介绍独立的nova计算节点的安装方法
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注