控制节点配置
1. 建库建用户
CREATE DATABASE nova_api; CREATE DATABASE nova; GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY ''; GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY ''; GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY ''; GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY ''; flush privileges;
2. keystone相关操作
. admin-openrc openstack user create --domain default --password-prompt nova +---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | 135e691ebbb74fefb5086970eac74706 |
| enabled | True |
| id | 2fc41fbf983f4f1a97e0c9566dc71b8c |
| name | nova |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+ openstack role add --project service --user nova admin openstack service create --name nova --description "OpenStack Compute" compute +-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Compute |
| enabled | True |
| id | e6a8b9decf6049ebb682b4069989f27d |
| name | nova |
| type | compute |
+-------------+----------------------------------+ openstack endpoint create --region RegionOne compute public http://controller01:8774/v2.1/%\(tenant_id\)s +--------------+---------------------------------------------+
| Field | Value |
+--------------+---------------------------------------------+
| enabled | True |
| id | 4e62d09ea6004277b90664e1aa9d0ba4 |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | e6a8b9decf6049ebb682b4069989f27d |
| service_name | nova |
| service_type | compute |
| url | http://controller01:8774/v2.1/%(tenant_id)s |
+--------------+---------------------------------------------+ openstack endpoint create --region RegionOne compute internal http://controller01:8774/v2.1/%\(tenant_id\)s +--------------+---------------------------------------------+
| Field | Value |
+--------------+---------------------------------------------+
| enabled | True |
| id | 5067b38682e246f29d92383d621a2c13 |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | e6a8b9decf6049ebb682b4069989f27d |
| service_name | nova |
| service_type | compute |
| url | http://controller01:8774/v2.1/%(tenant_id)s |
+--------------+---------------------------------------------+ openstack endpoint create --region RegionOne compute admin http://controller01:8774/v2.1/%\(tenant_id\)s +--------------+---------------------------------------------+
| Field | Value |
+--------------+---------------------------------------------+
| enabled | True |
| id | aa9bcd43b13a485da08c2c6bd2e55aad |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | e6a8b9decf6049ebb682b4069989f27d |
| service_name | nova |
| service_type | compute |
| url | http://controller01:8774/v2.1/%(tenant_id)s |
+--------------+---------------------------------------------+
3. 安装软件包
yum install openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler -y
yum install openstack-nova-placement-api
4. 修改配置
vim /etc/nova/nova.conf
[DEFAULT] enabled_apis = osapi_compute,metadata rpc_backend = rabbit auth_strategy = keystone transport_url = rabbit://openstack:123456@controller #下面的为管理ip my_ip = 192.168.198.128 use_neutron = True firewall_driver = nova.virt.firewall.NoopFirewallDriver [api_database] connection = mysql+pymysql://nova:123456@controller/nova_api [database] connection = mysql+pymysql://nova:123456@controller/nova [oslo_messaging_rabbit] rabbit_host = controller rabbit_userid = openstack rabbit_password = 123456 [keystone_authtoken] auth_url = http://controller:5000 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = nova password = 123456 [vnc] enabled = True # 下面的为管理ip vncserver_listen = 192.168.198.128 # 下面的为管理ip vncserver_proxyclient_address = 192.168.198.128 [glance] api_servers = http://controller:9292 [placement] auth_url = http://controller:35357/v3 auth_type=password os_region_name = RegionOne project_domain_name = default user_domain_name = default region_name = RegionOne project_name = service username = neutron password = 123456 [oslo_concurrency] lock_path = /var/lib/nova/tmp
vim /etc/httpd/conf.d/00-nova-placement-api.conf
# append this code <Directory /usr/bin>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
<IfVersion < 2.4>
Order allow,deny
Allow from all
</IfVersion>
</Directory>
5. 同步数据库
此处会报一些关于future的问题,自行忽略
su -s /bin/sh -c "nova-manage api_db sync" nova
su -s /bin/sh -c "nova-manage db sync" nova
6. 启动服务
systemctl enable openstack-nova-api.service openstack-nova-consoleauth.service
systemctl enable 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
systemctl start openstack-nova-conductor.service openstack-nova-novncproxy.service
7. 验证
netstat -ntlp | grep 6080 tcp 0 0 0.0.0.0:6080 0.0.0.0:* LISTEN 85554/python2 netstat -ntlp | grep 8774 tcp 0 0 0.0.0.0:8774 0.0.0.0:* LISTEN 85481/python2 netstat -ntlp | grep 8775 tcp 0 0 0.0.0.0:8775 0.0.0.0:* LISTEN 85481/python2
计算节点配置
1. 安装软件包
yum install openstack-nova-compute libvirt-daemon-lxc -y
2. 修改配置
vim /etc/nova/nova.conf
[DEFAULT] rpc_backend = rabbit auth_strategy = keystone #计算节点管理网络ip my_ip = 192.168.198.129 use_neutron = True firewall_driver = nova.virt.firewall.NoopFirewallDriver enabled_apis = osapi_compute,metadata transport_url = rabbit://openstack:123456@controller [oslo_messaging_rabbit] rabbit_host = controller rabbit_userid = openstack rabbit_password = 123456 [vnc] enabled = True vncserver_listen = 0.0.0.0 #计算节点管理网络ip vncserver_proxyclient_address = 192.168.198.129 #控制节点管理网络ip novncproxy_base_url = http://192.168.198.128:6080/vnc_auto.html [glance] api_servers = http://controller:9292 [oslo_concurrency] lock_path = /var/lib/nova/tmp [placement] auth_url = http://controller:5000 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = nova password = 123456 os_region_name = RegionOne [scheduler] discover_hosts_in_cells_interval = 300 [database] connection = mysql+pymysql://root:secret@192.168.111.69/nova_cell0?charset=utf8 [api_database] connection = mysql+pymysql://root:secret@192.168.111.69/nova_api?charset=utf8
3. 如果在不支持虚拟化的机器上部署nova,请确认
egrep -c '(vmx|svm)' /proc/cpuinfo结果为0 # 则编辑/etc/nova/nova.conf vim /etc/nova/nova.conf [libvirt] virt_type = qemu . admin-openrc openstack hypervisor list # Discover compute hosts su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
4. 启动服务
systemctl enable libvirtd.service openstack-nova-compute.service
systemctl start libvirtd.service openstack-nova-compute.service
验证
控制节点
source admin-openrc openstack compute service list +----+------------------+--------------+----------+---------+-------+----------------------------+
| ID | Binary | Host | Zone | Status | State | Updated At |
+----+------------------+--------------+----------+---------+-------+----------------------------+
| 1 | nova-consoleauth | controller01 | internal | enabled | up | 2018-02-02T05:36:13.000000 |
| 2 | nova-scheduler | controller01 | internal | enabled | up | 2018-02-02T05:36:09.000000 |
| 5 | nova-conductor | controller01 | internal | enabled | up | 2018-02-02T05:36:11.000000 |
| 6 | nova-compute | compute01 | nova | enabled | up | 2018-02-02T05:36:13.000000 |
+----+------------------+--------------+----------+---------+-------+----------------------------+
参考博客 http://blog.51cto.com/egon09/1839667