glance镜像服务
官方文档:https://docs.openstack.org/glance/stein/install/install-rdo.html#install-and-configure-components
一、数据库
1、 创建数据库
mysql -uroot -p123456
MariaDB [(none)]> CREATE DATABASE glance;
2、 创建用户
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'glance123';
测试能否连接# mysql -uglance -pglance123 -hopenstack-mysql.heng.net
二、创建相应的服务并注册api
1、导入admin账号的变量,创建glance用户,并加入admin角色组
source scripts/admin-stein.sh
openstack user create --domain default --password-prompt glance
密码glance
openstack role add --project service --user glance admin
2、创建image服务
[root@controller1 ~]#openstack service create --name glance --description "OpenStack Image" image
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Image |
| enabled | True |
| id | 1616cdd9d4f54f87812dc183321cdcf1 |
| name | glance |
| type | image |
+-------------+----------------------------------+
3、注册后端api
openstack endpoint create --region RegionOne image public http://openstack-vip.heng.net:9292
openstack endpoint create --region RegionOne image internal http://openstack-vip.heng.net:9292
openstack endpoint create --region RegionOne image admin http://openstack-vip.heng.net:9292
三、安装对应服务的软件包并修改配置文件
1、安装openstack-glance客户端(先安装后注册服务也可以)
yum install openstack-glance
2、为了实现以后实现控制端的高可用,将镜像放在nfs上,配置nfs
在数据库和控制端上安装nfs
yum install nfs-utils -y
vi /etc/exports
/data/openstack/images *(rw,no_root_squash)
mkdir -p /data/openstack/images
systemctl start nfs
systemctl enable nfs
控制端测试
showmount -e 192.168.12.19
3、修改配置文件glance-api.conf
vi /etc/glance/glance-api.conf
[database]
connection = mysql+pymysql://glance:glance123@openstack-mysql.heng.net/glance
[keystone_authtoken]
www_authenticate_uri = http://openstack-vip.heng.net:5000
auth_url = http://openstack-vip.heng.net:5000
memcached_servers = openstack-mysql.heng.net:11211 memcached在mysql上
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = glance
password = glance glance账户的密码
[paste_deploy]
flavor = keystone 认证方式取消注释即可,所有服务认证方式都是keystone
[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
4、修改配置文件/etc/glance/glance-registry.conf
vi /etc/glance/glance-registry.conf
[database]
connection = mysql+pymysql://glance:glance123@openstack-mysql.heng.net/glance
[keystone_authtoken]
www_authenticate_uri = http://openstack-vip.heng.net:5000
auth_url = http://openstack-vip.heng.net:5000
memcached_servers = openstack-mysql.heng.net:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = glance
password = glance
[paste_deploy]
flavor = keystone
5、初始化数据库
su -s /bin/sh -c "glance-manage db_sync" glance
6、启动服务,并设置开机启动
systemctl enable openstack-glance-api.service openstack-glance-registry.service
systemctl start openstack-glance-api.service openstack-glance-registry.service
7、挂载nfs
启动服务之后自动生成/var/lib/glance/images
ll /var/lib/glance/images -d
停止第6步的服务再挂载
vi /etc/fstab 设置自动挂载, _netdev表示无法挂载跳过,不影响开机
192.168.12.19:/data/openstack/images /var/lib/glance/images/ nfs defaults,_netdev 0 0
mount -a
注意/var/lib/glance/images的权限必须是glance
8、验证glance能否上传
wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img
[root@controller1 ~]# openstack image create "cirros-0.4.0" \
--file /root/cirros-0.4.0-x86_64-disk.img \
--disk-format qcow2 --container-format bare \
--public
openstack image list
cat /var/log/glance/*.log 日志 用于排错
placement服务
官方文档:https://docs.openstack.org/placement/stein/install/install-rdo.html
一、数据库
1、创建数据库授权
mysql -uroot -p123456
MariaDB [(none)]> CREATE DATABASE placement;
GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' IDENTIFIED BY 'placement123';
2、在控制端连接测试
mysql -uplacement -pplacement123 -h292.168.12.19
二、创建相应的服务并注册api
1、创建placement用户
source scripts/admin-stein.sh
openstack user create --domain default --password-prompt placement
2、将placement用户加入admin角色组
openstack role add --project service --user placement admin
3、创建placement服务
openstack service create --name placement --description "Placement API" placement
4、注册api到服务
openstack endpoint create --region RegionOne placement public http://openstack-vip.heng.net:8778
openstack endpoint create --region RegionOne placement internal http://openstack-vip.heng.net:8778
openstack endpoint create --region RegionOne placement admin http://openstack-vip.heng.net:8778
openstack endpoint list 现在就有3组endpoint
三、安装对应服务的软件包并修改配置文件
1、 安装包
yum install openstack-placement-api
2、 修改配置文件
vi /etc/placement/placement.conf
[placement_database]
connection=mysql+pymysql://placement:placement123@openstack-mysql.heng.net/placement
[api]
auth_strategy = keystone 去掉注释
[keystone_authtoken]
auth_url = http://openstack-vip.heng.net:5000/v3
memcached_servers = openstack-mysql.heng.net:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = placement
password = placement
3、初始化数据库
su -s /bin/sh -c "placement-manage db sync" placement
重启httpd
source scripts/admin-stein.sh
placement-status upgrade check