第六章 glance组件安装

1、在控制节点上,keystone中为glance增加用户、赋予角色、添加服务入口
export controller1=192.168.222.29
openstack user create --domain default --project service --password servicepassword glance

openstack role add --project service --user glance admin      # 此步骤没有显示信息
openstack service create --name glance --description "OpenStack Image service" image

# add endpoint for glance (public)
openstack endpoint create --region RegionOne image public http://$controller1:9292

# add endpoint for glance (internal)
openstack endpoint create --region RegionOne image internal http://$controller1:9292

# add endpoint for glance (admin)
openstack endpoint create --region RegionOne image admin http://$controller1:9292

2、在控制节点上,为glance组件增加数据库
mysql -u root -p
# 输入之前设置的数据库密码root
create database glance;
grant all privileges on glance.* to glance@'localhost' identified by 'password';
grant all privileges on glance.* to glance@'%' identified by 'password';
flush privileges;
exit
3、在控制节点上,安装glance组件
apt -y install glance
# 修改配置文件
mv /etc/glance/glance-api.conf /etc/glance/glance-api.conf.org # 备份老的
vi /etc/glance/glance-api.conf
# 修改如下
# create new
[DEFAULT]
debug = True                                    # 打开调试功能
bind_host = 0.0.0.0                             # ( bind the API network和Storage network)此处最好这样填写,为了后面建设单独的存储网

[glance_store]
default_store = file
filesystem_store_datadir = /var/lib/glance/images/   # 镜像的保存路径

[database]
# MariaDB connection info
connection = mysql+pymysql://glance:password@192.168.222.29/glance

# keystone auth info
[keystone_authtoken]
www_authenticate_uri = http://192.168.222.29:5000
auth_url = http://192.168.222.29:5000
memcached_servers = 192.168.222.29:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = servicepassword

[paste_deploy]
flavor = keystone

# 修改文件权限
chmod 644 /etc/glance/glance-api.conf
chown glance:glance /etc/glance/glance-api.conf

# 同步数据库,python的orm对象关系映射,需要初始化来生成数据库表结构;最后输出“Database is synced successfully.”即为成功
su -s /bin/bash glance -c "glance-manage db_sync"
# 重启服务
systemctl restart glance-api                        # 服务已经开机自启动

备注:先不要急着上传系统镜像到glance中,后面会有。

 

 

 

 

posted @ 2019-08-23 17:17  流放的圣徒  阅读(249)  评论(0编辑  收藏  举报