作者:【吴业亮】
博客:http://blog.csdn.net/wylfengyujiancheng
创建数据库ova_api, nova, and nova_cell0 databases:
# mysql -u root -pChangeme_123
CREATE DATABASE nova_placement ;
CREATE DATABASE nova_cell0 ;
CREATE DATABASE nova ;
CREATE DATABASE nova_api ;
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY 'Changeme_123';
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'Changeme_123';
GRANT ALL PRIVILEGES ON nova_placement.* TO 'nova'@'localhost' IDENTIFIED BY 'Changeme_123';
GRANT ALL PRIVILEGES ON nova_placement.* TO 'nova'@'%' IDENTIFIED BY 'Changeme_123';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'Changeme_123';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'Changeme_123';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'Changeme_123';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'Changeme_123';
创建用户
# openstack user create --domain default --password Changeme_123 nova
赋予admin权限
# openstack role add --project service --user nova admin
这个命令没有回显
创建service
# openstack service create --name nova \
--description "OpenStack Compute" compute
创建endpoint
# openstack endpoint create --region RegionOne \
compute public http://172.16.8.50:8774/v2.1
# openstack endpoint create --region RegionOne \
compute internal http://172.16.8.50:8774/v2.1
# openstack endpoint create --region RegionOne \
compute admin http://172.16.8.50:8774/v2.1
创建placement用户
# openstack user create --domain default --password Changeme_123 placement
赋予admin权限
# openstack role add --project service --user placement admin
创建服务
# openstack service create --name placement --description "Placement API" placement
创建endpoint
# openstack endpoint create --region RegionOne placement public http://172.16.8.50:8778
# openstack endpoint create --region RegionOne placement internal http://172.16.8.50:8778
# openstack endpoint create --region RegionOne placement admin http://172.16.8.50:8778
安装软件包
# yum install openstack-nova-api openstack-nova-conductor \
openstack-nova-console openstack-nova-novncproxy \
openstack-nova-scheduler openstack-nova-placement-api -y
修改配置文件/etc/nova/nova.conf
[DEFAULT]
enabled_apis = osapi_compute,metadata
my_ip = 172.16.8.60
novncproxy_host = 172.16.8.60
metadata_listen = 172.16.8.60
osapi_volume_listen = 172.16.8.60
osapi_compute_listen = 172.16.8.60
ec2_listen = 172.16.8.60
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
transport_url = rabbit://openstack:Changeme_123@172.16.8.50
[api]
auth_strategy = keystone
[api_database]
connection = mysql+pymysql://nova:Changeme_123@172.16.8.50/nova_api
[barbican]
[cache]
[cells]
[cinder]
[compute]
[conductor]
[console]
[consoleauth]
[cors]
[crypto]
[database]
connection = mysql+pymysql://nova:Changeme_123@172.16.8.50/nova
[ephemeral_storage_encryption]
[filter_scheduler]
[glance]
api_servers = http://172.16.8.50:9292
[guestfs]
[healthcheck]
[hyperv]
[ironic]
[key_manager]
[keystone_authtoken]
auth_uri = http://172.16.8.50:5000
auth_url = http://172.16.8.50:35357
memcached_servers = node1:11211,node2:11211,node3:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = Changeme_123
[libvirt]
[matchmaker_redis]
[metrics]
[mks]
[neutron]
[notifications]
[osapi_v21]
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_messaging_zmq]
[oslo_middleware]
[oslo_policy]
[pci]
[placement]
os_region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://172.16.8.50:35357/v3
username = placement
password = Changeme_123
[quota]
[rdp]
[remote_debug]
[scheduler]
[serial_console]
[service_user]
[spice]
[trusted_computing]
[upgrade_levels]
[vendordata_dynamic_auth]
[vmware]
[vnc]
enabled = true
vncserver_listen = $my_ip
vncserver_proxyclient_address = $my_ip
[workarounds]
[wsgi]
[xenserver]
[xvp]
写入配置文件 /etc/httpd/conf.d/00-nova-placement-api.conf
Listen 172.16.8.60:8778
<VirtualHost 172.16.8.60:8778>
WSGIProcessGroup nova-placement-api
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
WSGIDaemonProcess nova-placement-api processes=3 threads=1 user=nova group=nova
WSGIScriptAlias / /usr/bin/nova-placement-api
<IfVersion >= 2.4>
ErrorLogFormat "%M"
</IfVersion>
ErrorLog /var/log/nova/nova-placement-api.log
#SSLEngine On
#SSLCertificateFile ...
#SSLCertificateKeyFile ...
<Directory /usr/bin>
Require all granted
</Directory>
</VirtualHost>
Alias /nova-placement-api /usr/bin/nova-placement-api
<Location /nova-placement-api>
SetHandler wsgi-script
Options +ExecCGI
WSGIProcessGroup nova-placement-api
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
</Location>
注意修改IP
重启服务
# systemctl restart httpd
验证监听
# ss -tanlp | grep 8778
同步数据库
# 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
# nova-manage cell_v2 list_cells
启动服务并设置开机启动
# systemctl enable openstack-nova-api.service \
openstack-nova-consoleauth.service openstack-nova-scheduler.service \
openstack-nova-conductor.service openstack-nova-novncproxy.service
# systemctl restart openstack-nova-api.service \
openstack-nova-consoleauth.service openstack-nova-scheduler.service \
openstack-nova-conductor.service openstack-nova-novncproxy.service