#Glance 镜像服务群集

openstack pike 部署 目录汇总 http://www.cnblogs.com/elvi/p/7613861.html#4.Glance 镜像服务群集

##.Glance 镜像服务群集

###############以下在controller1节点执行

#Glance群集需要使用共享存储,用来存储镜像文件,这里以NFS为例
#先在controller1节点配置,然后拷贝配置到其它节点controller2,controller3
#创建Glance数据库、用户、认证,前面已设置 # keystone上服务注册 ,创建glance服务实体,API端点(公有、私有、admin)
source ./admin-openstack.sh || { echo "加载前面设置的admin-openstack.sh环境变量脚本";exit; }
openstack service create --name glance --description "OpenStack Image" image
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 -y openstack-glance python-glance
#配置
cp /etc/glance/glance-api.conf{,.bak}
cp /etc/glance/glance-registry.conf{,.bak}
# images默认/var/lib/glance/images/
Imgdir=/date/glance
mkdir -p $Imgdir
chown glance:nobody $Imgdir
echo "镜像目录: $Imgdir"
echo "#
[DEFAULT]
debug = False
verbose = True
bind_host = controller1
bind_port =
auth_region = RegionOne
registry_client_protocol = http
[database]
connection = mysql+pymysql://glance:glance@controller/glance
[keystone_authtoken]
auth_uri = http://controller:5000/v3
auth_url = http://controller:35357/v3
memcached_servers = controller1:,controller2:,controller3:
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = glance
[paste_deploy]
flavor = keystone
[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = $Imgdir
[oslo_messaging_rabbit]
rabbit_userid =openstack
rabbit_password = openstack
rabbit_durable_queues=true
rabbit_ha_queues = True
rabbit_max_retries=
rabbit_port =
rabbit_hosts = controller1:,controller2:,controller3:
#">/etc/glance/glance-api.conf
#
echo "#
[DEFAULT]
debug = False
verbose = True
bind_host = controller1
bind_port =
workers =
[database]
connection = mysql+pymysql://glance:glance@controller/glance
[keystone_authtoken]
auth_uri = http://controller:5000/v3
auth_url = http://controller:35357/v3
memcached_servers = controller1:,controller2:,controller3:
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = glance
[paste_deploy]
flavor = keystone
[oslo_messaging_rabbit]
rabbit_userid =openstack
rabbit_password = openstack
rabbit_durable_queues=true
rabbit_ha_queues = True
rabbit_max_retries=
rabbit_port =
rabbit_hosts = controller1:,controller2:,controller3:
#">/etc/glance/glance-registry.conf #同步数据库,检查数据库
su -s /bin/sh -c "glance-manage db_sync" glance
mysql -h controller -u glance -pglance -e "use glance;show tables;" #启动服务并设置开机自启动
systemctl enable openstack-glance-api openstack-glance-registry
systemctl restart openstack-glance-api openstack-glance-registry
sleep
netstat -antp|grep python2 #检测服务端口
#netstat -antp|egrep '9292|9191' #检测服务端口 #haproxy代理设置
echo '
#glance_api_cluster
listen glance_api_cluster
bind controller:
#balance source
option tcpka
option httpchk
option tcplog
server controller1 controller1: check inter rise fall
server controller2 controller2: check inter rise fall
server controller3 controller3: check inter rise fall
'>>/etc/haproxy/haproxy.cfg
systemctl restart haproxy.service
netstat -antp|grep haproxy #镜像测试,下载有时很慢
wget http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img #下载测试镜像源
#使用qcow2磁盘格式,bare容器格式,上传镜像到镜像服务并设置公共可见
source ./admin-openstack.sh
openstack image create "cirros" \
--file cirros-0.3.-x86_64-disk.img \
--disk-format qcow2 --container-format bare \
--public #检查是否上传成功
openstack image list
ls $Imgdir
#删除镜像 glance image-delete 镜像id ############### 配置其它节点controller2、controller3###############
#以下操作同样是在controller1执行 ############
#把controller1节点的glance镜像通过NFS共享给其它节点(仅测试环境使用)
#NFS 服务端 (centos7)
yum install nfs-utils rpcbind -y
echo "/date/glance 192.168.58.0/24(rw,no_root_squash,sync)">>/etc/exports
exportfs -r
systemctl enable rpcbind nfs-server
systemctl start rpcbind nfs-server
showmount -e localhost #controller2、controller3 作为 NFS客户端
ssh controller2 "systemctl enable rpcbind;systemctl start rpcbind"
ssh controller2 "mkdir -p /date/glance;mount -t nfs controller1:/date/glance /date/glance"
ssh controller2 'echo "/usr/bin/mount -t nfs controller1:/date/glance /date/glance">>/etc/rc.local;chmod +x /etc/rc.d/rc.local;df -h' ssh controller3 "systemctl enable rpcbind;systemctl start rpcbind"
ssh controller3 "mkdir -p /date/glance;mount -t nfs controller1:/date/glance /date/glance"
ssh controller3 'echo "/usr/bin/mount -t nfs controller1:/date/glance /date/glance">>/etc/rc.local;chmod +x /etc/rc.d/rc.local;df -h'
############ # Glance 安装
ssh controller2 "yum install -y openstack-glance python-glance"
ssh controller3 "yum install -y openstack-glance python-glance"

#同步controller1配置到其它节点(用scp会改变属性)
rsync -avzP -e 'ssh -p 22' /etc/glance/* controller2:/etc/glance/
rsync -avzP -e 'ssh -p 22' /etc/glance/* controller3:/etc/glance/
rsync -avzP -e 'ssh -p 22' /etc/haproxy/haproxy.cfg controller2:/etc/haproxy/
rsync -avzP -e 'ssh -p 22' /etc/haproxy/haproxy.cfg controller3:/etc/haproxy/

#更改配置
ssh controller2 "sed -i '1,10s/controller1/controller2/' /etc/glance/glance-api.conf /etc/glance/glance-registry.conf"
ssh controller3 "sed -i '1,10s/controller1/controller3/' /etc/glance/glance-api.conf /etc/glance/glance-registry.conf"

#启动服
ssh controller2 "systemctl enable openstack-glance-api openstack-glance-registry"
ssh controller2 "systemctl restart openstack-glance-api openstack-glance-registry haproxy.service;"
ssh controller3 "systemctl enable openstack-glance-api openstack-glance-registry"
ssh controller3 "systemctl restart openstack-glance-api openstack-glance-registry haproxy.service;"

Glance 镜像服务群集的更多相关文章

  1. ##4.Glance 镜像服务-- openstack pike

    ##4.Glance 镜像服务 openstack pike 安装 目录汇总 http://www.cnblogs.com/elvi/p/7613861.html ##.Glance 镜像服务.txt ...

  2. CentOS7安装OpenStack(Rocky版)-03.安装Glance镜像服务组件(控制节点)

    上篇文章分享了keystone的安装配置,本文接着分享openstack的镜像服务glance. --------------- 完美的分割线 ---------------- 3.0.glance概 ...

  3. glance镜像服务

    一.glance介绍: 因为云平台是提供Iass层的基础设施服务,我们拿到的是一台虚拟机,那么要用虚拟机的话必须有底层的镜像做支撑,所以说镜像的话也有一个服务来管理.但是我们云平台用的镜像不是装操作系 ...

  4. OpenStack核心组件-glance镜像服务

    1. glance介绍 Glance是Openstack项目中负责镜像管理的模块,其功能包括虚拟机镜像的查找.注册和检索等. Glance提供Restful API可以查询虚拟机镜像的metadata ...

  5. openstack——glance镜像服务

    一.glance介绍:                Glance是Openstack项目中负责镜像管理的模块,其功能包括虚拟机镜像的查找.注册和检索等. Glance提供Restful API可以查 ...

  6. openstack核心组件——glance— 镜像服务(6)

    云计算openstack核心组件——glance— 镜像服务(6)   一.glance介绍:              Glance是Openstack项目中负责镜像管理的模块,其功能包括虚拟机镜像 ...

  7. Openstack glance 镜像服务 (五)

    Openstack glance 镜像服务 (五) 引用: 官方文档glance安装 https://docs.openstack.org/ocata/zh_CN/install-guide-rdo/ ...

  8. OpenStack Train版-3.安装glance镜像服务

    安装glance镜像服务 创建数据库并授权 mysql -u root create database glance; GRANT ALL PRIVILEGES ON glance.* TO 'gla ...

  9. 4.openstack之mitaka搭建glance镜像服务

    部署镜像服务 一:安装和配置服务 1.建库建用户 mysql -u root -p CREATE DATABASE glance; GRANT ALL PRIVILEGES ON glance.* T ...

随机推荐

  1. Python Nose框架编写测试用例方法

    1. 关于Nose nose项目是于2005年发布的,也就是 py.test改名后的一年.它是由 Jason Pellerin 编写的,支持与 py.test 相同的测试习惯做法,但是这个包更容易安装 ...

  2. django中使用sha1,md5加密

    # salt 盐 使用sha1加密算法,返回str加密后的字符串 # 提高字符串的复杂的 from hashlib import sha1 def get_hash(str, salt=None): ...

  3. base64减少图片请求

    1. 使用base64减少 a)            2. 页面解析 CSS 生成的 CSSOM 时间增加 Base64 跟 CSS 混在一起,大大增加了浏览器需要解析CSS树的耗时.其实解析CSS ...

  4. JMeter性能测试,完整入门篇

    1. Jmeter简介 Apache JMeter是一款纯java编写负载功能测试和性能测试开源工具软件.相比Loadrunner而言,JMeter小巧轻便且免费,也越来越流行成为了主流的性能测试工具 ...

  5. 顺序栈--Java实现

    /*栈和队列:逻辑结构属于操作受限的线性表 *栈:特点先进后出,只允许在栈顶操作 *栈的实现方式:顺序栈和链栈 *常见的操作:进栈,出栈,获取栈顶,判空,判满,栈的容量 *栈的应用 *1.逆序相关操作 ...

  6. yii2之GridView小部件

    GridView小部件用于展示多条数据的列表.GridView小部件的使用需要数据提供器即yii\data\ActiveDataProvider的实例作为参数,所以 第一步就是要在控制器方法中创建这个 ...

  7. Group(), Groups(),& Groupdict()

    group() 返回一个或多个匹配的字串.如果只有一个参数,结果只有单个字符串:如果有多个参数,结果是一个元组,元组里每一项对应一个参数.没有参数,group1默认是0(整个匹配串被返回).如果gro ...

  8. jQuery选择器(添加节点及删除节点及克隆及替换及包装)第九节

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  9. HTML学习笔记 cs2D3D展示基础 第十四节 (原创) 参考使用表

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  10. HTML学习笔记 域元素(form表单、textarea文本域、fieldset域集合、input使用) 案例 第四节 (原创)

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...