首页 > 其他 > 详细

openstack搭建之-glance配置(17)

时间:2019-02-05 18:21:29      阅读:287      评论:0      收藏:0      [点我收藏+]

 

一、 base节点配置

#设置数据库,创建glance数据库,并设置权限

mysql -u root -proot

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‘;

二、 ctrl节点配置

#运行变量

. admin-openrc

 

#创建用户glance、角色为admin

openstack user create --domain default --password GLANCE_PASS glance

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

 

#创建glance服务并设置endpoint

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

openstack endpoint create --region RegionOne image public http://ctrl.test.com:9292

openstack endpoint create --region RegionOne image internal http://ctrl.test.com:9292

openstack endpoint create --region RegionOne image admin http://ctrl.test.com:9292

 

#安装镜像软件并编辑glance-api配置文件

yum install openstack-glance -y

vim /etc/glance/glance-api.conf

[database]
connection = mysql+pymysql://glance:GLANCE_DBPASS@base.test.com/glance

[keystone_authtoken]
auth_uri = http://ctrl.test.com:5000
auth_url = http://ctrl.test.com:35357
memcached_servers = base.test.com: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/

 

#编辑glance-registry的注册配置文件

vim  /etc/glance/glance-registry.conf

[database]
connection = mysql+pymysql://glance:GLANCE_DBPASS@base.test.com/glance
 

[keystone_authtoken]
auth_uri = http://ctrl.test.com:5000
auth_url = http://ctrl.test.com:35357
memcached_servers = base.test.com:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = GLANCE_PASS


[paste_deploy]
flavor = keystone

 

#初始化镜像数据库(21个数据表)

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

 

#启动服务

systemctl restart openstack-glance-api.service

systemctl restart openstack-glance-registry.service

 

systemctl enable openstack-glance-api.service

systemctl enable openstack-glance-registry.service

 

#运行变量

. admin-openrc

 

#下载镜像

wget http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img

scp root@172.16.3.1:/var/lib/libvirt/image/chen.qcow2 /root/

 

openstack image create "cirros" \

--file cirros-0.3.5-x86_64-disk.img \

--disk-format qcow2 --container-format bare \

--public

 

openstack image create "chen" \

--file chen.qcow2 \

--disk-format qcow2 --container-format bare \

--public

 

#查看image镜像:openstack image list

 

openstack搭建之-glance配置(17)

原文:https://www.cnblogs.com/chenli90/p/10351516.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!