[关闭]
@zhangyy 2020-01-08T14:20:57.000000Z 字数 6688 阅读 150

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

openstack系列


  • 一:nova计算节点初始化
  • 二:nova 计算节点配置

一: nova计算节点初始化

1.1 配置主机名

  1. login: 10.0.0.31
  2. cat /etc/hosts
  3. ---
  4. 10.0.0.11 controller
  5. 10.0.0.31 computer1
  6. 10.0.0.41 block1
  7. 10.0.0.51 object1
  8. 10.0.0.52 object2
  9. ---

image_1d8ndt0911bsa10hqht42lq12t29.png-80.9kB

1.2 关闭防火墙和selinux

  1. systemctl stop firewalld.service
  2. systemctl disable firewalld.service
  3. systemctl status firewalld.service
  4. 关闭 selinux
  5. setenforce 0
  6. getenforce
  7. sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/sysconfig/selinux
  8. grep SELINUX=disabled /etc/sysconfig/selinux

image_1d8ndtqrrp4aqso1pnpskn1hjdm.png-64.4kB

1.3 配置时间同步

  1. 1)在在计算节点配置时间同步服务
  2. # 安装时间同步的软件包
  3. yum install chrony -y
  4. 2)编辑配置文件确认有以下配置
  5. vim /etc/chrony.conf
  6. -------------------------------------
  7. # 修改引用控制节点controller的IP
  8. server 10.0.0.11 iburst
  9. -------------------------------------
  10. 3)重启chronyd服务,并配置开机自启动
  11. systemctl restart chronyd.service
  12. systemctl status chronyd.service
  13. systemctl enable chronyd.service
  14. systemctl list-unit-files |grep chronyd.service
  15. 4)设置时区,首次同步时间
  16. timedatectl set-timezone Asia/Shanghai
  17. chronyc sources -v
  18. timedatectl status
  19. # 至此,时间同步配置完成

image_1d8ne0l9r1p4pvf0159340o1qe513.png-96.5kB

image_1d8ne1f981e1i5mi5e1fs13i61g.png-53.1kB

1.4 配置相关yum源

  1. 配置阿里云的baseepel
  2. mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
  3. wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
  4. mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
  5. wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
  6. 安装openstack-rocky的仓库
  7. yum install centos-release-openstack-rocky -y
  8. yum clean all
  9. yum makecache
  10. yum update -y
  11. 安装openstack客户端相关软件
  12. yum install python-openstackclient openstack-selinux -y
  13. yum install openstack-nova-compute python-openstackclient openstack-utils -y

image_1d8ne88crli81rvhndn1loi1dfh2d.png-128.4kB


1.5 配置文件(/etc/nova/nova.conf)

  1. openstack-config --set /etc/nova/nova.conf DEFAULT my_ip 10.0.0.31
  2. openstack-config --set /etc/nova/nova.conf DEFAULT use_neutron True
  3. openstack-config --set /etc/nova/nova.conf DEFAULT firewall_driver nova.virt.firewall.NoopFirewallDriver
  4. openstack-config --set /etc/nova/nova.conf DEFAULT enabled_apis osapi_compute,metadata
  5. openstack-config --set /etc/nova/nova.conf DEFAULT transport_url rabbit://openstack:openstack@controller
  6. openstack-config --set /etc/nova/nova.conf api auth_strategy keystone
  7. openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_url http://controller:5000/v3
  8. openstack-config --set /etc/nova/nova.conf keystone_authtoken memcached_servers controller:11211
  9. openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_type password
  10. openstack-config --set /etc/nova/nova.conf keystone_authtoken project_domain_name default
  11. openstack-config --set /etc/nova/nova.conf keystone_authtoken user_domain_name default
  12. openstack-config --set /etc/nova/nova.conf keystone_authtoken project_name service
  13. openstack-config --set /etc/nova/nova.conf keystone_authtoken username nova
  14. openstack-config --set /etc/nova/nova.conf keystone_authtoken password nova
  15. openstack-config --set /etc/nova/nova.conf vnc enabled True
  16. openstack-config --set /etc/nova/nova.conf vnc server_listen 0.0.0.0
  17. openstack-config --set /etc/nova/nova.conf vnc server_proxyclient_address '$my_ip'
  18. openstack-config --set /etc/nova/nova.conf vnc novncproxy_base_url http://controller:6080/vnc_auto.html
  19. openstack-config --set /etc/nova/nova.conf glance api_servers http://controller:9292
  20. openstack-config --set /etc/nova/nova.conf oslo_concurrency lock_path /var/lib/nova/tmp
  21. openstack-config --set /etc/nova/nova.conf placement region_name RegionOne
  22. openstack-config --set /etc/nova/nova.conf placement project_domain_name Default
  23. openstack-config --set /etc/nova/nova.conf placement project_name service
  24. openstack-config --set /etc/nova/nova.conf placement auth_type password
  25. openstack-config --set /etc/nova/nova.conf placement user_domain_name Default
  26. openstack-config --set /etc/nova/nova.conf placement auth_url http://controller:5000/v3
  27. openstack-config --set /etc/nova/nova.conf placement username placement
  28. openstack-config --set /etc/nova/nova.conf placement password placement

image_1d8nec5rhphchca1eb7beh26g2q.png-387.9kB

image_1d8necn4g1t9m114bvsubir1s1l37.png-281.6kB

  1. egrep -v "^#|^$" /etc/nova/nova.conf
  2. ---
  3. [DEFAULT]
  4. my_ip = 10.0.0.31
  5. use_neutron = True
  6. firewall_driver = nova.virt.firewall.NoopFirewallDriver
  7. enabled_apis = osapi_compute,metadata
  8. transport_url = rabbit://openstack:openstack@controller
  9. log_date_format=%Y-%m-%d %H:%M:%S ### 打开 分割日志
  10. log_file=nova-compute.log ### 打开日志
  11. log_dir=/var/log/nova ###打开日志目录
  12. [api]
  13. auth_strategy = keystone
  14. [api_database]
  15. [barbican]
  16. [cache]
  17. [cells]
  18. [cinder]
  19. [compute]
  20. [conductor]
  21. [console]
  22. [consoleauth]
  23. [cors]
  24. [database]
  25. [devices]
  26. [ephemeral_storage_encryption]
  27. [filter_scheduler]
  28. [glance]
  29. api_servers = http://controller:9292
  30. [guestfs]
  31. [healthcheck]
  32. [hyperv]
  33. [ironic]
  34. [key_manager]
  35. [keystone]
  36. [keystone_authtoken]
  37. auth_url = http://controller:5000/v3
  38. memcached_servers = controller:11211
  39. auth_type = password
  40. project_domain_name = default
  41. user_domain_name = default
  42. project_name = service
  43. username = nova
  44. password = nova
  45. [libvirt]
  46. virt_type=kvm
  47. [matchmaker_redis]
  48. [metrics]
  49. [mks]
  50. [neutron]
  51. [notifications]
  52. [osapi_v21]
  53. [oslo_concurrency]
  54. lock_path = /var/lib/nova/tmp
  55. [oslo_messaging_amqp]
  56. [oslo_messaging_kafka]
  57. [oslo_messaging_notifications]
  58. [oslo_messaging_rabbit]
  59. [oslo_messaging_zmq]
  60. [oslo_middleware]
  61. [oslo_policy]
  62. [pci]
  63. [placement]
  64. region_name = RegionOne
  65. project_domain_name = Default
  66. project_name = service
  67. auth_type = password
  68. user_domain_name = Default
  69. auth_url = http://controller:5000/v3
  70. username = placement
  71. password = placement
  72. [placement_database]
  73. [powervm]
  74. [profiler]
  75. [quota]
  76. [rdp]
  77. [remote_debug]
  78. [scheduler]
  79. [serial_console]
  80. [service_user]
  81. [spice]
  82. [upgrade_levels]
  83. [vault]
  84. [vendordata_dynamic_auth]
  85. [vmware]
  86. [vnc]
  87. enabled = True
  88. server_listen = 0.0.0.0
  89. server_proxyclient_address = 10.0.0.31
  90. novncproxy_base_url = http://controller:6080/vnc_auto.html
  91. [workarounds]
  92. [wsgi]
  93. [xenserver]
  94. [xvp]
  95. [zvm]
  96. ---

1.6 配置虚拟机的硬件加速

  1. # 首先确定您的计算节点是否支持虚拟机的硬件加速。
  2. egrep -c '(vmx|svm)' /proc/cpuinfo
  3. # 如果返回位0,表示计算节点不支持硬件加速,需要配置libvirt使用QEMU方式管理虚拟机,使用以下命令:
  4. openstack-config --set /etc/nova/nova.conf libvirt virt_type qemu
  5. egrep -v "^#|^$" /etc/nova/nova.conf|grep 'virt_type'
  6. # 如果返回为其他值,表示计算节点支持硬件加速且不需要额外的配置,使用以下命令:
  7. openstack-config --set /etc/nova/nova.conf libvirt virt_type kvm
  8. egrep -v "^#|^$" /etc/nova/nova.conf|grep 'virt_type'

image_1d8nfea7s1qtpo92ibm1rrc1goa3k.png-50kB

  1. 启动nova相关服务,并配置为开机自启动
  2. 需要启动2个服务
  3. systemctl start libvirtd.service openstack-nova-compute.service
  4. systemctl status libvirtd.service openstack-nova-compute.service
  5. systemctl enable libvirtd.service openstack-nova-compute.service
  6. systemctl list-unit-files |grep libvirtd.service
  7. systemctl list-unit-files |grep openstack-nova-compute.service

image_1d8nfhc0j1q8mcql13551obiu0q41.png-265.7kB

1.7 将计算节点增加到cell数据库

  1. # 以下命令在控制节点操作:
  2. cd /openstack
  3. source keystone-admin-pass.sh
  4. # 检查确认数据库有新的计算节点
  5. openstack compute service list --service nova-compute

image_1d8nfkkbvfh51ubt1e9rh3a1mnf4u.png-46.5kB

  1. 手动将新的计算节点添加到openstack集群
  2. su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova

image_1d8nfolso3il19dh1ojchjb1gi45b.png-46.9kB


  1. 设置新创建节点自动注册的任务(已经添加到配置文件中)
  2. vim /etc/nova/nova.conf
  3. ---
  4. [scheduler]
  5. discover_hosts_in_cells_interval = 300
  6. ---
  7. 至此,计算节点安装完毕,接下来需要进行测试,检查nova节点的状态

1.8 在控制节点进行验证

  1. 参考文章:https://docs.openstack.org/nova/rocky/install/compute-install-rdo.html
  2. 1)应用管理员环境变量脚本
  3. cd /openstack
  4. source keystone-admin-pass.sh
  5. 2)列表查看安装的nova服务组件
  6. # 验证是否成功注册并启动了每个进程
  7. openstack compute service list

image_1d8nfusgc148eq1g3481bopn4u5o.png-117.8kB

  1. 在身份认证服务中列出API端点以验证其连接性
  2. openstack catalog list

image_1d8ng0dn51gsa1r62gsk299e1m65.png-147.2kB

  1. 在镜像服务中列出已有镜像已检查镜像服务的连接性
  2. openstack image list

image_1d8ng1j2kbmo176fji37fe1ec6i.png-27.7kB

  1. 检查nova各组件的状态
  2. 检查placement APIcell服务是否正常工作
  3. nova-status upgrade check

image_1d8ng3s78fbd18l2117g1qutcfm7f.png-116.5kB


  1. 至此,nova计算节点,安装完毕并添加到openstack集群中
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注