Ⅰ、在controller节点上配置nova
1.创建nova服务凭据
#先使用脚本登陆admin
[[email protected] ~]# . admin-openstack.sh
①创建nova user
openstack user create --domain default --password-prompt nova
②关联
openstack role add --project service --user nova admin
③创建nova service
openstack service create --name nova --description "OpenStack Compute" compute
④创建服务API
openstack endpoint create --region RegionOne compute public http://controller:8774/v2.1
openstack endpoint create --region RegionOne compute internal http://controller:8774/v2.1
openstack endpoint create --region RegionOne compute admin http://controller:8774/v2.1
2.创建placement服务凭据
[[email protected] ~]# . admin-openstack.sh
①创建placement user
openstack user create --domain default --password-prompt placement
②关联
openstack role add --project service --user placement admin
③创建placement service
openstack service create --name placement --description "Placement API" placement
④创建API
openstack endpoint create --region RegionOne placement public http://controller:8778
openstack endpoint create --region RegionOne placement internal http://controller:8778
openstack endpoint create --region RegionOne placement admin http://controller:8778
3.安装nova相关软件
[[email protected] ~]# yum install openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler openstack-nova-placement-api -y
4.配置nova.conf
[[email protected] ~]# cp /etc/nova/nova.conf /etc/nova/nova.conf.bak
[[email protected] ~]# cat /etc/nova/nova.conf
#
[DEFAULT]
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:[email protected]
my_ip = 20.0.20.21
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[api_database]
connection = mysql+pymysql://nova:[email protected]/nova_api
[database]
connection = mysql+pymysql://nova:[email protected]/nova
[api]
auth_strategy = keystone
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = nova
[vnc]
enabled = true
vncserver_listen = $my_ip
vncserver_proxyclient_address = $my_ip
[glance]
api_servers = http://controller:9292
[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://controller:35357/v3
username = placement
password = placement
[scheduler]
discover_hosts_in_cells_interval = 300
5.配置00-nova-placement-api.conf
[[email protected] ~]# vim /etc/httpd/conf.d/00-nova-placement-api.conf
#在文件末尾添加
<Directory /usr/bin>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
<IfVersion < 2.4>
Order allow,deny
Allow from all
</IfVersion>
</Directory>
6.重启httpd
[[email protected] ~]# systemctl restart httpd
7.填充数据库
su -s /bin/sh -c "nova-manage api_db sync" nova
su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
su -s /bin/sh -c "nova-manage db sync" nova
8.检测数据
nova-manage cell_v2 list_cells
mysql -h controller -u nova -pnova -e "use nova_api;show tables;"
mysql -h controller -u nova -pnova -e "use nova;show tables;"
mysql -h controller -u nova -pnova -e "use nova_cell0;show tables;"
9.启动服务
systemctl enable openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
systemctl start openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
Ⅱ、在compute节点配置nova
1.安装nova
[[email protected] ~]# yum install openstack-nova-compute -y
2.配置nova.conf
[[email protected] ~]# cp /etc/nova/nova.conf /etc/nova/nova.conf.bak
[[email protected] ~]# cat /etc/nova/nova.conf
#
[DEFAULT]
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:[email protected]
my_ip = 20.0.20.22
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[api]
auth_strategy = keystone
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = nova
[vnc]
enabled = true
vncserver_listen = 0.0.0.0
vncserver_proxyclient_address = $my_ip
novncproxy_base_url = http://controller:6080/vnc_auto.html
[glance]
api_servers = http://controller:9292
[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://controller:35357/v3
username = placement
password = placement
3.查看计算节点是否支持硬件加速
[[email protected] ~]# egrep -c ‘(vmx|svm)‘ /proc/cpuinfo
0
#如果返回值为0,则不支持硬件加速,需要配置nova.conf中[libvirt] 部分
[[email protected] ~]# vim /etc/nova/nova.conf
[libvirt]
virt_type = qemu
4.启动服务
[[email protected] ~]# systemctl enable libvirtd.service openstack-nova-compute.service
[[email protected] ~]# systemctl start libvirtd.service openstack-nova-compute.service
.
Ⅲ、在controller上添加compute到cell数据库
1.查看计算节点
[[email protected] ~]# . admin-openstack.sh
[[email protected] ~]# openstack compute service list --service nova-compute
+----+--------------+---------+------+---------+-------+----------------------------+
| ID | Binary | Host | Zone | Status | State | Updated At |
+----+--------------+---------+------+---------+-------+----------------------------+
| 6 | nova-compute | compute | nova | enabled | up | 2018-09-06T09:38:49.000000 |
+----+--------------+---------+------+---------+-------+----------------------------+
2.自动注册compute节点
[[email protected] ~]#vim /etc/chrony.conf
[scheduler]
discover_hosts_in_cells_interval = 300
3.验证
openstack compute service list
openstack catalog list
openstack image list
nova-status upgrade check
原文地址:http://blog.51cto.com/lullaby/2171320