iloe

导航

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

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

$ mysql -u root -p

2.创建 glance 数据库:

MariaDB [(none)]> CREATE DATABASE glance;

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

MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \
  IDENTIFIED BY 'GLANCE_DBPASS';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \
  IDENTIFIED BY 'GLANCE_DBPASS';

//用一个合适的密码替换 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

 

posted on 2022-11-24 00:39  ILOE  阅读(23)  评论(0编辑  收藏  举报