一、建立glance数据库并且给权限设置第三方登录
mysql -uroot -p0330
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‘;
二、部署glance
①宣告环境变量
source openrc或 . openrc
②创建glance用户
openstack user create --domain default --password=glance glance
③将项目service中的用户glance设置为admin角色
openstack role add --project service --user glance admin
④创建glance服务
openstack service create --name glance \ --description "OpenStack Image" image
⑤创建服务端点(RegionOne是一个域)
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
三、安装glance镜像服务,并编辑配置文件
①安装
yum install openstack-glance
②先复制再编辑配置文件(复制和无需更改)
cp /etc/glance/glance-api.conf
/etc/glance/glance-api.conf
.bak
cp /etc/glance/glance-registry.conf /etc/glance/glance-registry.conf.bak
[DEFAULT]
[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
[image_format]
[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
[matchmaker_redis]
[oslo_concurrency]
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_messaging_zmq]
[oslo_middleware]
[oslo_policy]
[paste_deploy]
flavor = keystone
[profiler]
[store_type_location_strategy]
[task]
[taskflow_executor]
[DEFAULT]
[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
[matchmaker_redis]
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_messaging_zmq]
[oslo_policy]
[paste_deploy]
flavor = keystone
[profiler]
③同步数据库
su -s /bin/sh -c "glance-manage db_sync" glance
④重启并设置开机自启
systemctl enable openstack-glance-api.service openstack-glance-registry.service
systemctl start openstack-glance-api.service openstack-glance-registry.service
四、上传镜像
①上传镜像
cirros-0.3.3-x86_64-disk.img
source openrc
②查看镜像列表(镜像保存在/var/lib/glance/images)
opentack image list或glance image-list
【补充】
第三方进入数据库
1.必须安装mariadb客户端
2.登录的用户必须可以第三方登录
mysql -h ip -ukeystone -pkeystone
3.注释多行
ctrl +v—— 全部选中——shift i ——#——esc两次
取消多行注释
ctrl +v——全部选中——dd
4、常用服务端口号:
8778 placement
6080 novncproxy
9292 glance-registry
8774 nova
9191 registry-api
11211 memcached
9696 neutron
6080 novncproxy
6633 openvswitch
6640 openvswitch
5000 keystone
35357 keystone (虽说时keystone的端口号,但是启动与否与apache服务是否启动有最直接关系)
5672(25672) rabbitmq
8776 cinder
5、报错:
1)Missing value auth-url required for auth plugin password
因为没声明变量
2)Unable to establish connection to http://controller:35357
因为35357服务没启动,查看msgi配置文件和httpd服务情况
原文:https://www.cnblogs.com/xiaoxiaotiejiang/p/11084575.html