企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
在控制节点上,nova-api负责虚拟机生命周期的操作,nova-scheduler实现控制在哪个计算节点上启动实例,nova-conductor主要是防止云端上计算节点直接访问数据库。需要明确的一点是,控制节点上没有提供计算资源虚拟化功能,都是由计算节点上的nova-compute来完成供给实例计算资源。 1)在controller1上创建nova数据库 ``` MariaDB [(none)]> CREATE DATABASE nova; MariaDB [(none)]> CREATE DATABASE nova_api; ``` 2)在controller1创建数据库用户并赋予权限 ``` MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'yjscloud'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'yjscloud'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'yjscloud'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'yjscloud'; ``` 3)在controller1上创建nova用户及赋予admin权限 ``` source /root/admin-openrc openstack user create --domain default nova --password yjscloud openstack role add --project service --user nova admin ``` 4)在controller1上创建computer服务 ``` openstack service create --name nova --description "OpenStack Compute" compute ``` 5)在controller1创建nova的endpoint ``` openstack endpoint create --region RegionOne compute public http://yjscloud.com:8774/v2.1/%\(tenant_id\)s openstack endpoint create --region RegionOne compute internal http://yjscloud.com:8774/v2.1/%\(tenant_id\)s openstack endpoint create --region RegionOne compute admin http://yjscloud.com:8774/v2.1/%\(tenant_id\)s ``` 6)在controller1、2、3上安装nova相关软件 ``` yum install -y openstack-nova-api openstack-nova-conductor openstack-nova-cert openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler 7)在controller1、2、3上配置nova的配置文件/etc/nova/nova.conf cp /etc/nova/nova.conf /etc/nova/nova.conf.bak >/etc/nova/nova.conf openstack-config --set /etc/nova/nova.conf DEFAULT debug False openstack-config --set /etc/nova/nova.conf DEFAULT verbose True openstack-config --set /etc/nova/nova.conf DEFAULT enabled_apis osapi_compute,metadata openstack-config --set /etc/nova/nova.conf DEFAULT osapi_compute_listen_port 9774 openstack-config --set /etc/nova/nova.conf DEFAULT metadata_listen_port 9775 openstack-config --set /etc/nova/nova.conf DEFAULT my_ip 10.1.1.150 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 DEFAULT rpc_backend rabbit openstack-config --set /etc/nova/nova.conf DEFAULT auth_strategy keystone openstack-config --set /etc/nova/nova.conf DEFAULT scheduler_use_baremetal_filters False openstack-config --set /etc/nova/nova.conf DEFAULT scheduler_default_filters RamFilter,CoreFilter,DiskFilter openstack-config --set /etc/nova/nova.conf DEFAULT scheduler_weight_classes nova.scheduler.weights.all_weighers openstack-config --set /etc/nova/nova.conf DEFAULT scheduler_host_subset_size 30 openstack-config --set /etc/nova/nova.conf DEFAULT scheduler_driver nova.scheduler.filter_scheduler.FilterScheduler openstack-config --set /etc/nova/nova.conf DEFAULT scheduler_max_attempts 3 openstack-config --set /etc/nova/nova.conf DEFAULT scheduler_available_filters nova.scheduler.filters.all_filters openstack-config --set /etc/nova/nova.conf DEFAULT ram_allocation_ratio 3.0 openstack-config --set /etc/nova/nova.conf DEFAULT disk_allocation_ratio 1.0 openstack-config --set /etc/nova/nova.conf DEFAULT cpu_allocation_ratio 16.0 openstack-config --set /etc/nova/nova.conf DEFAULT service_down_time 180 openstack-config --set /etc/nova/nova.conf DEFAULT osapi_compute_workers 4 openstack-config --set /etc/nova/nova.conf DEFAULT metadata_workers 4 openstack-config --set /etc/nova/nova.conf DEFAULT rootwrap_config /etc/nova/rootwrap.conf openstack-config --set /etc/nova/nova.conf DEFAULT notify_on_state_change vm_and_task_state openstack-config --set /etc/nova/nova.conf DEFAULT allow_resize_to_same_host True openstack-config --set /etc/nova/nova.conf DEFAULT novncproxy_host 10.1.1.150 openstack-config --set /etc/nova/nova.conf DEFAULT novncproxy_port 6080 openstack-config --set /etc/nova/nova.conf database connection mysql+pymysql://nova:yjscloud@yjscloud.com/nova openstack-config --set /etc/nova/nova.conf database idle_timeout 3600 openstack-config --set /etc/nova/nova.conf database max_pool_size 30 openstack-config --set /etc/nova/nova.conf database retry_interval 2 openstack-config --set /etc/nova/nova.conf database max_retries -1 openstack-config --set /etc/nova/nova.conf api_database connection mysql+pymysql://nova:yjscloud@yjscloud.com/nova_api openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_hosts controller1:5672,controller2:5672,controller3:5672 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 yjscloud openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_use_ssl False 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 amqp_durable_queues False openstack-config --set /etc/nova/nova.conf oslo_concurrency lock_path /var/lib/nova/tmp openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_uri http://yjscloud.com:5000 openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_url http://yjscloud.com:35357 openstack-config --set /etc/nova/nova.conf keystone_authtoken memcached_servers controller1:11211,controller2:11211,controller3: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 yjscloud openstack-config --set /etc/nova/nova.conf glance api_servers http://yjscloud.com:9292 openstack-config --set /etc/nova/nova.conf conductor use_local False openstack-config --set /etc/nova/nova.conf conductor workers 4 openstack-config --set /etc/nova/nova.conf vnc enabled True openstack-config --set /etc/nova/nova.conf vnc vncserver_listen 0.0.0.0 openstack-config --set /etc/nova/nova.conf vnc vncserver_proxyclient_address 10.1.1.150 openstack-config --set /etc/nova/nova.conf vnc novncproxy_base_url http://192.168.0.168:6080/vnc_auto.html openstack-config --set /etc/nova/nova.conf neutron url http://yjscloud.com:9696 openstack-config --set /etc/nova/nova.conf neutron auth_url http://yjscloud.com:35357 openstack-config --set /etc/nova/nova.conf neutron auth_plugin password openstack-config --set /etc/nova/nova.conf neutron project_domain_id default openstack-config --set /etc/nova/nova.conf neutron user_domain_id default openstack-config --set /etc/nova/nova.conf neutron region_name RegionOne openstack-config --set /etc/nova/nova.conf neutron project_name service openstack-config --set /etc/nova/nova.conf neutron username neutron openstack-config --set /etc/nova/nova.conf neutron password yjscloud openstack-config --set /etc/nova/nova.conf neutron service_metadata_proxy True openstack-config --set /etc/nova/nova.conf neutron metadata_proxy_shared_secret yjscloud openstack-config --set /etc/nova/nova.conf cinder os_region_name RegionOne ``` ``` scp -p /etc/nova/nova.conf controller2:/etc/nova/nova.conf scp -p /etc/nova/nova.conf controller3:/etc/nova/nova.conf ``` **注意修改ip** 8)在controller1同步nova数据 ``` su -s /bin/sh -c "nova-manage api_db sync" nova su -s /bin/sh -c "nova-manage db sync" nova ``` 9)在controller1上设置开机启动 ``` systemctl enable openstack-nova-api.service openstack-nova-cert.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service ``` controller2、3上设置开机启动(注意比controller1节点少了`openstack-nova-consoleauth.service`): ``` systemctl enable openstack-nova-api.service openstack-nova-cert.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service ``` controller1上启动nova服务: ``` systemctl restart openstack-nova-api.service openstack-nova-cert.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service systemctl status openstack-nova-api.service openstack-nova-cert.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service ``` controller2、3上启动nova服务: ``` systemctl restart openstack-nova-api.service openstack-nova-cert.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service systemctl status openstack-nova-api.service openstack-nova-cert.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service systemctl list-unit-files | grep openstack-noca-* ``` 10)随便一个节点上验证nova服务 ``` unset OS_TOKEN OS_URL echo "export OS_REGION_NAME=RegionOne" >> admin-openrc source /root/admin-openrc nova service-list openstack endpoint list ```