-
数据库创库授权
#创建nova数据库: CREATE DATABASE nova_api; CREATE DATABASE nova; create database nova_cell0; #授予恰当的权限 grant all privileges on nova_api.* to 'nova'@'localhost' identified by 'NOVA_CXK_DBPASS'; grant all privileges on nova_api.* to 'nova'@'%' identified by 'NOVA_CXK_DBPASS'; grant all privileges on nova.* to 'nova'@'localhost' identified by 'NOVA_CXK_DBPASS'; grant all privileges on nova.* to 'nova'@'%' identified by 'NOVA_CXK_DBPASS'; grant all privileges on nova_cell0.* to 'nova'@'localhost' identified by 'NOVA_CXK_DBPASS'; grant all privileges on nova_cell0.* to 'nova'@'%' identified by 'NOVA_CXK_DBPASS'; flush privileges;
-
在keystone创建Nova用户,授权关联角色在任意一个控制节点上
source /sh/admin-openstack.sh #创建用户 #创建nova用户 openstack user create --domain default --password NOVA_CXK_PASS nova #关联 在service 项目(租户)上,给nova 用户赋予admin角色 openstack role add --project service --user nova admin #查看 openstack role assignment list
-
在keystone创建服务,注册api在任意一个控制节点上
#创建nova服务实体 openstack service create --name nova --description "OpenStack Compute" compute #创建Nova服务API端点 openstack endpoint create --region RegionOne compute public http://vip:8774/v2.1 openstack endpoint create --region RegionOne compute internal http://vip:8774/v2.1 openstack endpoint create --region RegionOne compute admin http://vip:8774/v2.1
-
安装服务相关的软件包(控制节点)
yum install -y openstack-nova-api openstack-nova-conductor openstack-nova-novncproxy openstack-nova-scheduler openstack-utils python-openstackclient python2-PyMySQL python-memcached
-
修改配置文件(控制节点)
判断计算节点是否支持虚拟机的硬件加速 egrep -c '(vmx|svm)' /proc/cpuinfo #如果此命令返回值不是0,则计算节点支持硬件加速 #如果此命令返回值是0,则计算节点不支持硬件加速
#备份配置文件 cp -a /etc/nova/nova.conf{,.bak} grep -Ev '^$|#' /etc/nova/nova.conf.bak > /etc/nova/nova.conf
vi /etc/nova/nova.conf [DEFAULT] #nova-compute在并发创建虚拟机过程中,有并发任务限制 max_concurrent_builds = 10 #物理 CPU 超售比例,默认是 16 倍,超线程也算作一个物理 CPU,需要根据具体负载和物理 CPU 能力进行综合判断后确定具体的配置 cpu_allocation_ratio = 4.0 initial_cpu_allocation_ratio = 16.0 #内存分配超售比例,默认是 1.5 倍,生产环境不建议开启超售。 ram_allocation_ratio = 1.0 initial_ram_allocation_ratio = 1.5 #内存预留量,这部分内存不能被虚拟机使用 reserved_host_memory_mb = 4096 #磁盘预留空间,这部分空间不能被虚拟机使用 reserved_host_disk_mb = 10240 #服务下线时间阈值,默认60,如果一个节点上的 nova 服务超过这个时间没有上报心跳到数据库,api 服务会认为该服务已经下线,如果配置过短或过长,都会导致误判。 service_down_time = 120 my_ip = 管理网卡ip #rootwrap daemon方式运行命令,缩短nova/neutron等组件调用系统命令的时间 use_rootwrap_daemon = True transport_url = rabbit://openstack:RABBIT_CXK_PASS@openstack-controller01:5672,openstack:RABBIT_CXK_PASS@openstack-controller02:5672,openstack:RABBIT_CXK_PASS@openstack-controller03:5672 #启用对网络服务的支持 use_neutron = true firewall_driver = nova.virt.firewall.NoopFirewallDriver #仅启用计算和元数据 API enabled_apis = osapi_compute,metadata metadata_host = $my_ip metadata_listen_port = 8775 metadata_listen= 0.0.0.0 metadata_cache_expiration= 15 osapi_compute_listen = $my_ip osapi_compute_listen_port = 8774 log_dir = /var/log/nova #有时候碰到硬盘太大,会失败,vif超时参数 vif_plugging_timeout = 0 vif_plugging_is_fatal = false debug=true [api] auth_strategy = keystone [api_database] connection = mysql+pymysql://nova:NOVA_CXK_DBPASS@192.168.188.29/nova_api [cache] backend = oslo_cache.memcache_pool enabled = True cache = memcache_servers memcache_servers = openstackcontroller1ip:11211,openstackcontroller2ip:11211,openstackcontroller3ip:11211 [database] connection = mysql+pymysql://nova:NOVA_CXK_DBPASS@192.168.188.29/nova [filter_scheduler] #主机组配置 #关联:实例创建在同一个计算节点上,当该计算节点资源不够就会失败。 #不关联:实例创建在不同计算节点上,当计算节点数不够时失败。 #软关联:实例尽量创建在同一个计算节点上,当计算节点资源不够不会失败,会落在另一个计算节点上 #软不关联:实例尽量创建在不同计算节点上,当计算节点数量不够时,实力会落在同一个计算节点上 vailable_filters=nova.scheduler.filters.all_filters enabled_filters=AvailabilityZoneFilter,ComputeFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter [glance] api_servers = http://vip:9292 [keystone_authtoken] auth_url = http://vip:5000/v3 cache = true token_cache_time = 3600 memcached_servers = openstackcontroller1ip:11211,openstackcontroller2ip:11211,openstackcontroller3ip:11211 auth_type = password project_domain_name = Default user_domain_name = Default project_name = service username = nova password = NOVA_CXK_PASS [oslo_concurrency] #配置锁路径 lock_path = /var/lib/nova/tmp [placement] os_region_name = RegionOne project_domain_name = Default project_name = service auth_type = password user_domain_name = Default auth_url = http://vip:5000/v3 username = placement password = PLACEMENT_CXK_PASS [scheduler] #间隔性注册新计算节点 discover_hosts_in_cells_interval = 300 [vnc] enabled = true server_listen = $my_ip server_proxyclient_address = $my_ip novncproxy_host = $my_ip novncproxy_port = 6080 #支持网络,等待网络安装 [neutron] url = http://vip:9696 auth_url = http://vip:5000 auth_type = password project_domain_name = default user_domain_name = default region_name = RegionOne project_name = service username = neutron password = NEUTRON_CXK_PASS #启用元数据代理和配置密钥 service_metadata_proxy = true metadata_proxy_shared_secret = METADATA_SECRET #支持cinder块存储,等待块存储安装 [cinder] os_region_name = RegionOne
-
初始化数据在任意一个控制节点上
#同步nova-api数据库 su -s /bin/sh -c "nova-manage api_db sync" nova #注册cell0数据库 su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova #创建cell1原件 su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova 9ecbb8b7-0235-4446-9d93-54db77d18dd5 #同步nova数据库 su -s /bin/sh -c "nova-manage db sync" nova #验证novacell0和cell1注册情况 su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova #检测数据 mysql -u nova -pNOVA_CXK_DBPASS -e "use nova_api;show tables;" mysql -u nova -pNOVA_CXK_DBPASS -e "use nova;show tables;" mysql -u nova -pNOVA_CXK_DBPASS -e "use nova_cell0;show tables;"
-
启动服务(控制节点)
systemctl start openstack-nova-api.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service systemctl status openstack-nova-api.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service systemctl enable openstack-nova-api.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
-
验证在任意一个控制节点上
#列出各服务控制组件,查看状态; openstack compute service list #展示api端点; openstack catalog list #检查cell与placement api;都为success为正常 nova-status upgrade check
喜欢的亲可以关注点赞评论哦!以后每天都会更新的哦!本文为小编原创文章; 文章中用到的文件、安装包等可以加小编联系方式获得;
欢迎来交流小编联系方式VX:CXKLittleBrother 进入运维交流群