Skip to content

安装及配置控制节点的Nova服务

安装Nova软件包

yum -y install openstack-nova-api openstack-nova-scheduler openstack-nova-conductor openstack-nova-novncproxy
cat /etc/passwd | grep nova
cat /etc/group | grep nova

创建Nova数据库并授权

mysql -uroot -p000000 -e "CREATE DATABASE nova_api;"
mysql -uroot -p000000 -e "CREATE DATABASE nova_cell0;"
mysql -uroot -p000000 -e "CREATE DATABASE nova;"
mysql -uroot -p000000 -e "GRANT ALL PRIVILEGES ON nova_api.* TO nova@localhost IDENTIFIED BY '000000';"
mysql -uroot -p000000 -e "GRANT ALL PRIVILEGES ON nova_api.* TO nova@'%' IDENTIFIED BY '000000';"
mysql -uroot -p000000 -e "GRANT ALL PRIVILEGES ON nova_cell0.* TO nova@localhost IDENTIFIED BY '000000';"
mysql -uroot -p000000 -e "GRANT ALL PRIVILEGES ON nova_cell0.* TO nova@'%' IDENTIFIED BY '000000';"
mysql -uroot -p000000 -e "GRANT ALL PRIVILEGES ON nova.* TO nova@localhost IDENTIFIED BY '000000';"
mysql -uroot -p000000 -e "GRANT ALL PRIVILEGES ON nova.* TO nova@'%' IDENTIFIED BY '000000';"

修改Nova配置文件

备份

cp /etc/nova/nova.conf /etc/nova/nova.bak
grep -Ev '^$|#' /etc/nova/nova.bak > /etc/nova/nova.conf

编辑

vi /etc/nova/nova.conf

修改[api_database]和[database]

[api_database]
connection = mysql+pymysql://nova:000000@controller/nova_api
[database]
connection = mysql+pymysql://nova:000000@controller/nova

修改[api]和[keystone_authtoken]

[api]
auth_strategy = keystone
[keystone_authtoken]
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
username = nova
password = 000000
project_name = project
user_domain_name = Default
project_domain_name = Default

修改[placement]

[placement]
auth_url = http://controller:5000
auth_type = password
username = placement
password = 000000
project_name = project
user_domain_name = Default
project_domain_name = Default
region_name = RegionOne

修改[glance]

[glance]
api_servers = http://controller:9292

修改[oslo_concurrency]

[oslo_concurrency]
lock_path = /var/lib/nova/tmp

修改[DEFAULT]

[DEFAULT]
enabled_apis = osapi_compute,metadata
transport_url = rabbit://rabbitmq:000000@controller:5672
my_ip = 192.168.10.160
use_neutron = true
firewall_driver = nova.virt.firewall.NoopFirewallDriver

修改[vnc]

[vnc]
enabled = true
server_listen = $my_ip
server_proxyclient_address = $my_ip

初始化Nova的数据库

su nova -s /bin/sh -c "nova-manage api_db sync"
su nova -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell"
su nova -s /bin/sh -c "nova-manage cell_v2 map_cell0"
su nova -s /bin/sh -c "nova-manage db sync"   #出现Warning不用管

验证单元

nova-manage cell_v2 list_cells

Nova组件初始化

创建Nova用户并分配角色admin

openstack user create --domain default --password 000000 nova
openstack role add --project project --user nova admin

创建Nova服务及服务端点

openstack service create --name nova compute
openstack endpoint create --region RegionOne nova public http://controller:8774/v2.1
openstack endpoint create --region RegionOne nova internal http://controller:8774/v2.1

创建admin用户访问的端点

openstack endpoint create --region RegionOne nova admin http://controller:8774/v2.1

启动加开机自启

systemctl enable openstack-nova-api.service  openstack-nova-scheduler.service  openstack-nova-conductor.service  openstack-nova-novncproxy.service 
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 

检测控制节点的Nova服务

查看端口占用情况

netstat -nutpl | grep 877

查看计算服务列表

openstack compute service list

配置计算节点nova服务(配置完再回来)

发现计算节点

. admin-login
su nova -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose"
nova-manage cell_v2 list_hosts

编辑配置文件,设置间隔60s自动发现

cp /etc/nova/nova.conf /etc/nova/nova.conf.back
vi /etc/nova/nova.conf
[scheduler]
discover_hosta_in_cells_interval = 60
systemctl restart openstack-nova-api

验证Nova服务

openstack compute service list
openstack catalog list
nova-status upgrade check 

所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自linlink~文档