openstack-3-Glance

一 Glance 介绍

存镜像-(做好的虚拟机的镜像)
openstack-3-Glance
openstack-3-Glance

二 配置与安装

[[email protected] ~]# mysql -h 10.0.0.17 -uglance –pglance -确认库在不在
MariaDB [(none)]> show databases;

[[email protected] ~]# source admin-openstack.sh 指定下环境变量
[[email protected] ~]# openstack user create --domain default --password-prompt glance –
glaUser Password: --创建个glance用户

添加 admin 角色到 glance 用户和 service 项目上。
[[email protected] ~]# openstack role add --project service --user glance admin

[[email protected] ~]# yum install openstack-glance 安装glance

[[email protected] ~]# vim /etc/glance/glance-api.conf
connection = mysql+pymysql://glance:[email protected]/glance --修改数据库1823行

auth_uri = http://10.0.0.17:5000 --3283行配置认证服务访问
auth_url = http://10.0.0.17:35357
memcached_servers = 10.0.0.17:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = glance

flavor = keystone —4238行

[[email protected] ~]# vim /etc/glance/glance-registry.conf
connection = mysql+pymysql://glance:[email protected]/glance —1141行
[keystone_authtoken]
auth_uri = http://10.0.0.17:5000
auth_url = http://10.0.0.17:35357
memcached_servers = 10.0.0.17:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = glance

flavor = keystone ----2159行
[[email protected] ~]# su -s /bin/sh -c “glance-manage db_sync” glance 同步glance数据库
检测下
[[email protected] ~]# mysql -h 10.0.0.17 -u glance -pglance -e “use glance;show tables;”

[[email protected] ~]# vim /etc/sysconfig/memcached
OPTIONS="-l 10.0.0.17,::1"

[email protected] ~]# systemctl enable memcached
[[email protected] ~]# systemctl start memcached
tcp6 0 0 ::1:11211 —这个端口

[[email protected] ~]# systemctl enable openstack-glance-api.service \

openstack-glance-registry.service

[[email protected] ~]# systemctl start openstack-glance-api.service \

openstack-glance-registry.service

tcp 0 0 0.0.0.0:9191 registry
tcp 0 0 0.0.0.0:9292 api

创建glance服务实体 —这里可以三网卡,或者单网卡,可针对 管理 内网 外网自己配置
[[email protected] ~]# openstack service create --name glance \

–description “OpenStack Image” image

创建镜像服务的 API 端点:
[[email protected] ~]# openstack endpoint create --region RegionOne \

image public http://10.0.0.17:9292

[[email protected] ~]# openstack endpoint create --region RegionOne \

image internal http://10.0.0.17:9292

[[email protected] ~]# openstack endpoint create --region RegionOne \

image admin http://10.0.0.17:9292

[[email protected] ~]# openstack endpoint list 可以查看
[[email protected] ~]# openstack endpoint delete f09a9a792ff54bb383abb99aca92d15c | 可以删除

验证:
[[email protected] ~]# wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img

[[email protected] ~]# openstack image create “cirros” \

–file cirros-0.3.4-x86_64-disk.img
–disk-format qcow2 --container-format bare
–public

[[email protected] ~]# openstack image list
[[email protected] ~]# cd /var/log/glance/ —日志位置
[[email protected] glance]# ll
total 8
-rw-r–r-- 1 glance glance 1189 Sep 7 16:01 api.log
-rw-r–r-- 1 glance glance 772 Sep 7 15:49 registry.log

未来怎么看日志
grep ‘ERROR’ api.log
grep ‘ERROR’ registry.log