一、简介
OpenStack计算服务nova负责管理计算资源、网络、认证和平台扩展性,Nova自身不具备虚拟化能力,通过Libvirt API来与底层的Hypervisors交互。
Nova组件主要包括:
- nova-api 服务:主要负责接收和响应来自最终用户的计算API请求;
- nova-api-metadata 服务:负责接受来自虚拟机发送的元数据请求,例如虚拟机密码、主机名等元数据的获取;
- nova-scheduler服务:接受到来自队列的创建虚拟机实例的请求,然后通过调度策略决定那台计算节点来创建虚拟机;
- nova-conductor服务:媒介作用于“nova-compute”服务与数据库之间。它排除了由“nova-compute”服务对云数据库的直接访问;
- nova-consoleauth守护进程:授权控制台代理所提供的用户令牌,该服务必须为控制台代理运行才可奏效;
- nova-novncproxy 守护进程:提供一个代理,用于访问正在运行的实例,通过VNC协议,支持基于浏览器的novnc客户端;
- nova-compute服务:一个持续工作的守护进程,通过Hypervior的API来创建和销毁虚拟机实例,Hypervior的API包括XenServer/XCP 的 XenAPI、KVM 或 QEMU 的 libvirt和VMware 的 VMwareAPI。一般运行在计算节点上。
二、部署脚本
首先在三个控制节点上安装nova的nova-api、nova-scheduler、nova-conductor、nova-novncproxy和nova-consoleauth服务,脚本install-configure-nova.sh如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
#!/bin/sh . ../0-set-config.sh ./style/print-split.sh "Nova Installation" ### [所有控制节点] 修改/etc/haproxy/haproxy.cfg文件 . ./1-gen-haproxy-cfg.sh nova ##[所有控制节点]安装配置 ./pssh-exe C "yum install -y openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler" for ((i=0; i<${#controller_map[@]}; i+=1)); do name=${controller_name[$i]}; ip=${controller_map[$name]}; . style/print-info.sh "Openstack configure in $name" ssh root@$ip /bin/bash << EOF openstack-config --set /etc/nova/nova.conf DEFAULT enabled_apis osapi_compute,metadata openstack-config --set /etc/nova/nova.conf DEFAULT memcached_servers controller01:11211,controller02:11211,controller03:11211 openstack-config --set /etc/nova/nova.conf api_database connection mysql+pymysql://nova:$password@$virtual_ip/nova_api openstack-config --set /etc/nova/nova.conf database connection mysql+pymysql://nova:$password@$virtual_ip/nova openstack-config --set /etc/nova/nova.conf DEFAULT rpc_backend rabbit openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_hosts controller01:5672,controller02:5672,controller03:5672 openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_ha_queues true openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_retry_interval 1 openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_retry_backoff 2 openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_max_retries 0 openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_durable_queues true openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_userid openstack openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_password $password openstack-config --set /etc/nova/nova.conf DEFAULT auth_strategy keystone openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_uri http://$virtual_ip:5000 openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_url http://$virtual_ip:35357 openstack-config --set /etc/nova/nova.conf keystone_authtoken memcached_servers controller01:11211,controller02:11211,controller03:11211 openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_type password openstack-config --set /etc/nova/nova.conf keystone_authtoken project_domain_name default openstack-config --set /etc/nova/nova.conf keystone_authtoken user_domain_name default openstack-config --set /etc/nova/nova.conf keystone_authtoken project_name service openstack-config --set /etc/nova/nova.conf keystone_authtoken username nova openstack-config --set /etc/nova/nova.conf keystone_authtoken password $password openstack-config --set /etc/nova/nova.conf DEFAULT my_ip $ip openstack-config --set /etc/nova/nova.conf DEFAULT use_neutron True openstack-config --set /etc/nova/nova.conf DEFAULT firewall_driver nova.virt.firewall.NoopFirewallDriver openstack-config --set /etc/nova/nova.conf vnc vncserver_listen $ip openstack-config --set /etc/nova/nova.conf vnc vncserver_proxyclient_address $ip openstack-config --set /etc/nova/nova.conf vnc novncproxy_host $ip openstack-config --set /etc/nova/nova.conf glance api_servers http://$virtual_ip:9292 openstack-config --set /etc/nova/nova.conf oslo_concurrency lock_path /var/lib/nova/tmp openstack-config --set /etc/nova/nova.conf DEFAULT osapi_compute_listen $ip openstack-config --set /etc/nova/nova.conf DEFAULT metadata_listen $ip EOF done; ### [任一节点]创建数据库 mysql -uroot -p$password_galera_root -h $virtual_ip -e "CREATE DATABASE nova; GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY '"$password"'; GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY '"$password"'; GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'controller01' IDENTIFIED BY '"$password"'; CREATE DATABASE nova_api; GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY '"$password"'; GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY '"$password"'; GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'controller01' IDENTIFIED BY '"$password"'; FLUSH PRIVILEGES;" ### [任一节点]创建用户等 . /root/keystonerc_admin openstack user create --domain default --password $password nova openstack role add --project service --user nova admin openstack service create --name nova --description "OpenStack Compute" compute openstack endpoint create --region RegionOne compute public http://$virtual_ip:8774/v2.1/%\(tenant_id\)s openstack endpoint create --region RegionOne compute internal http://$virtual_ip:8774/v2.1/%\(tenant_id\)s openstack endpoint create --region RegionOne compute admin http://$virtual_ip:8774/v2.1/%\(tenant_id\)s ### [任一节点]生成数据库 su -s /bin/sh -c "nova-manage api_db sync" nova su -s /bin/sh -c "nova-manage db sync" nova ### [任一节点]添加pacemaker资源 pcs resource create openstack-nova-consoleauth systemd:openstack-nova-consoleauth --clone interleave=true pcs resource create openstack-nova-novncproxy systemd:openstack-nova-novncproxy --clone interleave=true pcs resource create openstack-nova-api systemd:openstack-nova-api --clone interleave=true pcs resource create openstack-nova-scheduler systemd:openstack-nova-scheduler --clone interleave=true pcs resource create openstack-nova-conductor systemd:openstack-nova-conductor --clone interleave=true pcs constraint order start openstack-keystone-clone then openstack-nova-consoleauth-clone pcs constraint order start openstack-nova-consoleauth-clone then openstack-nova-novncproxy-clone pcs constraint colocation add openstack-nova-novncproxy-clone with openstack-nova-consoleauth-clone pcs constraint order start openstack-nova-novncproxy-clone then openstack-nova-api-clone pcs constraint colocation add openstack-nova-api-clone with openstack-nova-novncproxy-clone pcs constraint order start openstack-nova-api-clone then openstack-nova-scheduler-clone pcs constraint colocation add openstack-nova-scheduler-clone with openstack-nova-api-clone pcs constraint order start openstack-nova-scheduler-clone then openstack-nova-conductor-clone pcs constraint colocation add openstack-nova-conductor-clone with openstack-nova-scheduler-clone pcs resource op add openstack-nova-consoleauth start timeout=300 pcs resource op add openstack-nova-consoleauth stop timeout=300 pcs resource op add openstack-nova-novncproxy start timeout=300 pcs resource op add openstack-nova-novncproxy stop timeout=300 pcs resource op add openstack-nova-api start timeout=300 pcs resource op add openstack-nova-api stop timeout=300 pcs resource op add openstack-nova-scheduler start timeout=300 pcs resource op add openstack-nova-scheduler stop timeout=300 pcs resource op add openstack-nova-conductor start timeout=300 pcs resource op add openstack-nova-conductor stop timeout=300 ### 重启Pcs集群 . restart-pcs-cluster.sh ### [任一节点]测试 sleep 5 . /root/keystonerc_admin openstack compute service list |
注明:nova-compute服务会在计算节点上统一配置,这里不做介绍。
三、参考文档
https://docs.openstack.org/mitaka/install-guide-rdo/nova.html
https://docs.openstack.org/mitaka/zh_CN/install-guide-rdo/common/get_started_compute.html
四、源码
脚本源码:https://github.com/zjmeixinyanzhi/Openstack-HA-Install-Shells
五、系列文章
Openstack云平台脚本部署之Galera高可用集群配置(二)
Openstack云平台脚本部署之RabbitMQ高可用集群部署(三)
Openstack云平台脚本部署之Memcached配置(五)
Openstack云平台脚本部署之Keystone认证服务配置(六)
Openstack云平台脚本部署之Glance镜像服务配置(七)
Openstack云平台脚本部署之Nova计算服务配置(八)
Openstack云平台脚本部署之Neutron网络服务配置(九)
Openstack云平台脚本部署之Dashboard配置(十)
Openstack云平台脚本部署之Cinder块存储服务配置(十一)
Openstack云平台脚本部署之Ceilometer数据收集服务配置(十二)
Openstack云平台脚本部署之Aodh告警服务配置(十三)
code
more code
~~~~