Openstak queens部署筆記(三) 安裝glance/nova服務
- 安裝配置glance服務
- 登錄數據庫
mysql -uroot -p #登錄
- 創建數據庫
MariaDB [(none)]> CREATE DATABASE glance;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO ‘glance‘@‘localhost‘ IDENTIFIED BY ‘Aa123456‘;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO ‘glance‘@‘%‘ IDENTIFIED BY ‘Aa123456‘;
- 添加用戶\組\服務
openstack user create --domain default --password-prompt glance
openstack role add --project service --user glance admin
openstack service create --name glance --description "OpenStack Image" image
openstack endpoint create --region RegionOne image public http://controller:9292
openstack endpoint create --region RegionOne image admin http://controller:9292
- 安裝glance軟件包
apt install glance -y
- 配置glance
vim /etc/glance/glance-api.conf
[database]
# ...
connection = mysql+pymysql://glance:Aa123456@controller/glance
[keystone_authtoken]
# ...
auth_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = glance
password = Aa123456
[paste_deploy]
# ...
flavor = keystone
[glance_store]
# ...
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
vim /etc/glance/glance-registry.conf
[database]
# ...
connection = mysql+pymysql://glance:Aa123456@controller/glance
[keystone_authtoken]
# ...
auth_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = glance
password = Aa123456
[paste_deploy]
# ...
flavor = keystone
- 導入數據庫
su -s /bin/sh -c "glance-manage db_sync" glance
- 重啟服務
service glance-registry restart
service glance-api restart
- 驗證
. admin-openrc
wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img
openstack image create "cirros" \
--file cirros-0.4.0-x86_64-disk.img \
--disk-format qcow2 --container-format bare \
--public
+------------------+------------------------------------------------------+
| Field | Value |
+------------------+------------------------------------------------------+
| checksum | 443b7623e27ecf03dc9e01ee93f67afe |
| container_format | bare |
| created_at | 2018-10-20T02:31:50Z |
| disk_format | qcow2 |
| file | /v2/images/283f7cd9-1804-46df-8e5e-ce0e9ba3301d/file |
| id | 283f7cd9-1804-46df-8e5e-ce0e9ba3301d |
| min_disk | 0 |
| min_ram | 0 |
| name | cirros |
| owner | bc776f24088840dbb29017d069f564cb |
| protected | False |
| schema | /v2/schemas/image |
| size | 12716032 |
| status | active |
| tags | |
| updated_at | 2018-10-20T02:31:50Z |
| virtual_size | None |
| visibility | public |
+------------------+------------------------------------------------------+
openstack image list
+--------------------------------------+--------+--------+
| ID | Name | Status |
+--------------------------------------+--------+--------+
| 283f7cd9-1804-46df-8e5e-ce0e9ba3301d | cirros | active |
+--------------------------------------+--------+--------+
- 安裝Compute服務(計算服務)
- 創建數據庫並授權
MariaDB [(none)]> CREATE DATABASE nova_api;
MariaDB [(none)]> CREATE DATABASE nova;
MariaDB [(none)]> CREATE DATABASE nova_cell0;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO ‘nova‘@‘localhost‘ \
IDENTIFIED BY ‘Aa123456‘;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO ‘nova‘@‘%‘ \
IDENTIFIED BY ‘Aa123456‘;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO ‘nova‘@‘localhost‘ \
IDENTIFIED BY ‘Aa123456‘;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO ‘nova‘@‘%‘ \
IDENTIFIED BY ‘Aa123456‘;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO ‘nova‘@‘localhost‘ \
IDENTIFIED BY ‘Aa123456‘;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO ‘nova‘@‘%‘ \
IDENTIFIED BY ‘Aa123456‘;
- 創建nova用戶
. admin-openrc
openstack user create --domain default --password-prompt nova
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | b3646682d2df4e98b7d345bd898dfd92 |
| name | nova |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
openstack role add --project service --user nova admin #將nova加入admin角色
openstack service create --name nova --description "OpenStack Compute" compute
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Compute |
| enabled | True |
| id | 93c9ba49f1574e68be8a03f993ccfda3 |
| name | nova |
| type | compute |
+-------------+----------------------------------+
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
- 創建placement service
openstack user create --domain default --password-prompt placement
openstack role add --project service --user placement admin
openstack service create --name placement --description "Placement API" placement
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
- 安裝nova軟件包
apt install nova-api nova-conductor nova-consoleauth nova-novncproxy nova-scheduler nova-placement-api
- 配置nova
vim /etc/nova/nova.conf
[api_database]
# ...
connection = mysql+pymysql://nova:Aa123456@controller/nova_api
[database]
# ...
connection = mysql+pymysql://nova:Aa123456@controller/nova
[DEFAULT]
log_dir = /var/log/nova
lock_path = /var/lock/nova
state_path = /var/lib/nova
transport_url = rabbit://openstack:Aa123456@controller
my_ip = 192.168.122.151
use_neutron = true
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[vnc]
enabled = true
server_listen = $my_ip
server_proxyclient_address = $my_ip
[placement]
os_region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller:5000/v3
username = placement
password = Aa123456
[glance]
# ...
api_servers = http://controller:9292
[oslo_concurrency]
# ...
lock_path = /var/lib/nova/tmp
- 導入數據庫/註冊/建立ceill
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
+-------+--------------------------------------+------------------------------------+------------------------+
| Name | UUID | Transport URL | Database Connection |
+-------+--------------------------------------+------------------------------------+---------
| cell0 | 00000000-0000-0000-0000-000000000000 | none:/ |mysql+pymysql://nova:****@controller/nova_cell0 |
| cell1 | 910ceccf-7782-46f1-a130-13515bb1b20c | rabbit://openstack:****@controller|mysql+pymysql://nova:****@controller/nova |
+-------+--------------------------------------+------------------------------------+--------------+
- 重啟服務
service nova-api restart
service nova-consoleauth restart
service nova-scheduler restart
service nova-conductor restart
service nova-novncproxy restart
Openstak queens部署筆記(三) 安裝glance/nova服務