4532423 发表于 2016-7-6 09:11:48

openstack M版安装 镜像(image,glance)服务篇

配置安装image镜像服务
在controller节点

一、创建数据库

1
2
3
4
# mysql -u root -p
>>CREATE DATABASE glance;
>>GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'GLANCE_DBPASS';
>>GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%'IDENTIFIED BY 'GLANCE_DBPASS';




GLANCE_DBPASS改成自己 的密码。

二、创建服务实体和api接口

1
2
3
4
5
6
7
# source /root/admin-openrc.sh
# 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
#openstack endpoint create --region RegionOne   image internal http://controller:9292
#openstack endpoint create --region RegionOne   image admin




三、安装image镜像服务

1
# yum install openstack-glance




编辑镜像服务配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# mv /etc/glance/glance-api.conf /etc/glance/glance-api.conf_bak
# vim /etc/glance/glance-api.conf

connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance#改为自己的数据库密码

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 = glance
password = GLANCE_PASS#改为自己的服务密码


flavor = keystone

stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/






1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# /etc/glance/glance-registry.conf /etc/glance/glance-registry.conf_bak
# vim /etc/glance/glance-registry.conf

connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance#改为自己的数据库密码

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 = glance
password = GLANCE_PASS#改为自己的服务密码


flavor = keystone




同步数据库

1
# su -s /bin/sh -c "glance-manage db_sync" glance




启动image相关服务,并加入开机启动

1
2
# systemctl enable openstack-glance-api.service   openstack-glance-registry.service
# systemctl start openstack-glance-api.service   openstack-glance-registry.service





四、验证

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# source /root/admin-openrc.sh
# wget
# openstack image create "cirros-linux"   --file cirros-0.3.4-x86_64-disk.img   --disk-format qcow2 --container-format bare   --public
+------------------+------------------------------------------------------+
| Field            | Value                                                |
+------------------+------------------------------------------------------+
| checksum         | ee1eca47dc88f4879d8a229cc70a07c6                     |
| container_format | bare                                                 |
| created_at       | 2016-06-16T11:15:04Z                                 |
| disk_format      | qcow2                                                |
| file             | /v2/images/75a82c7f-39cb-4eb4-ba72-5d92c3a52c02/file |
| id               | 75a82c7f-39cb-4eb4-ba72-5d92c3a52c02               |
| min_disk         | 0                                                    |
| min_ram          | 0                                                    |
| name             | cirros-linux                                       |
| owner            | 00a82ac5055d4ddd934d14eaed7c76ac                     |
| protected      | False                                                |
| schema         | /v2/schemas/image                                    |
| size             | 13287936                                             |
| status         | active                                             |
| tags             |                                                      |
| updated_at       | 2016-06-16T11:15:06Z                                 |
| virtual_size   | None                                                 |
| visibility       | public                                             |
+------------------+------------------------------------------------------+




出现上面信息表示成功

1
2
3
4
5
6
7
8
# openstack image list
+--------------------------------------+--------------+--------+
| ID                                 | Name         | Status |
+--------------------------------------+--------------+--------+
| 75a82c7f-39cb-4eb4-ba72-5d92c3a52c02 | cirros-linux | active | #改成添加的镜像
| 81b71bcd-133a-48a4-868e-4d1970bee9f3 | test_for_1   | active |
| 8a3754a8-86c6-499a-b4f3-bc0f76ab2e8c | cirros       | active |
+--------------------------------------+--------------+--------+






compute(nova)服务请参考:
页: [1]
查看完整版本: openstack M版安装 镜像(image,glance)服务篇