OpenStack OTACA版本安装-3.镜像服务()

1.用数据库连接客户端以  用户连接到数据库服务器:

root
$ mysql -u root -p

2.创建  数据库:

glance
MariaDB [(none)]> CREATE DATABASE glance;

3.对“glance“数据库授予恰当的权限:

GLANCE_DBPASS

4.获得  凭证来获取只有管理员能执行的命令的访问权限:

admin
$ . admin-openrc

5.创建  用户:

glance
$ openstack user create --domain default --password-prompt glance

6.添加  角色到  用户和  项目上。

admin
glance
service
$ openstack role add --project service --user glance admin

7.创建“glance“服务实体:

openstack service create --name glance \
  --description "OpenStack Image" image

8.创建镜像服务的 API 端点:

openstack endpoint create --region RegionOne \
  image public http://controller:9292
$ openstack endpoint create --region RegionOne \
  image internal http://controller:9292
openstack endpoint create --region RegionOne \
  image admin http://controller:9292

9.安装软件包

yum install openstack-glance

10.编辑配置文件/etc/glance/glance-api.conf

[database]
# ...
connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance
[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 = glance
password = GLANCE_PASS

[paste_deploy]
# ...
flavor = keystone
[glance_store]
# ...
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/

11.编辑配置文件/etc/glance/glance-registry.conf

[database]
# ...
connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance
[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 = glance
password = GLANCE_PASS

[paste_deploy]
# ...
flavor = keystone

12.写入镜像服务数据库:

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

13.启动镜像服务并将其配置为随机启动:

# systemctl enable openstack-glance-api.service \
  openstack-glance-registry.service
# systemctl start openstack-glance-api.service \
  openstack-glance-registry.service
————————

1.用数据库连接客户端以  用户连接到数据库服务器:

root
$ mysql -u root -p

2.创建  数据库:

glance
MariaDB [(none)]> CREATE DATABASE glance;

3.对“glance“数据库授予恰当的权限:

GLANCE_DBPASS

4.获得  凭证来获取只有管理员能执行的命令的访问权限:

admin
$ . admin-openrc

5.创建  用户:

glance
$ openstack user create --domain default --password-prompt glance

6.添加  角色到  用户和  项目上。

admin
glance
service
$ openstack role add --project service --user glance admin

7.创建“glance“服务实体:

openstack service create --name glance \
  --description "OpenStack Image" image

8.创建镜像服务的 API 端点:

openstack endpoint create --region RegionOne \
  image public http://controller:9292
$ openstack endpoint create --region RegionOne \
  image internal http://controller:9292
openstack endpoint create --region RegionOne \
  image admin http://controller:9292

9.安装软件包

yum install openstack-glance

10.编辑配置文件/etc/glance/glance-api.conf

[database]
# ...
connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance
[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 = glance
password = GLANCE_PASS

[paste_deploy]
# ...
flavor = keystone
[glance_store]
# ...
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/

11.编辑配置文件/etc/glance/glance-registry.conf

[database]
# ...
connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance
[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 = glance
password = GLANCE_PASS

[paste_deploy]
# ...
flavor = keystone

12.写入镜像服务数据库:

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

13.启动镜像服务并将其配置为随机启动:

# systemctl enable openstack-glance-api.service \
  openstack-glance-registry.service
# systemctl start openstack-glance-api.service \
  openstack-glance-registry.service