设为首页 收藏本站
查看: 1143|回复: 0

[经验分享] openstack学习笔记八 glance安装配置

[复制链接]
发表于 2018-6-1 08:31:52 | 显示全部楼层 |阅读模式
  镜像    安装过系统的虚拟硬盘
  管理是用glance来完成。
  镜像的状态:
  active   镜像已经上传完成,并且是可用的
  saving         正在被上传,还没有完成
  killed          上传出错
  queued       并没有真的上传完成,但是被标记有这个镜像
  安装glance
  在 keystone注册
  glance所需要的账户
  创建glance服务
  指定glance服务的endpoint
  

  

  安装
[root@h4 ~]# yum -y install openstack-glance.noarch
[root@h4 ~]# openstack-db  --init  --service glance --password 123456 -rootpw 123456
[root@h4 ~(keystone_admin)]# keystone user-create --name glance  --pass 123456
[root@h4 ~(keystone_admin)]# keystone  user-role-add  --user glance --tenant services --role admin
[root@h4 ~(keystone_admin)]# keystone  service-create  --name glance --type image  --description "glance jingxiang"
[root@h4 ~(keystone_admin)]# keystone  endpoint-create  --service-id  3d0969b633044029a895da1ca2855464  --publicurl  'http://192.168.1.204:9292'  --internalurl  'http://192.168.1.204:9292'  --adminurl  'http://192.168.1.204:9292'
+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
|   adminurl  |    http://192.168.1.204:9292     |
|      id     | e0f7718b18444f71a43762ca3336ef06 |
| internalurl |    http://192.168.1.204:9292     |
|  publicurl  |    http://192.168.1.204:9292     |
|    region   |            regionOne             |
|  service_id | 3d0969b633044029a895da1ca2855464 |
+-------------+----------------------------------+  

  修改配置文件
[root@h4 glance(keystone_admin)]# systemctl  list-unit-files  | grep glanc
openstack-glance-api.service                  disabled   接受用户的请求
openstack-glance-registry.service             disabled   和数据库进行交互
openstack-glance-scrubber.service             disabled   和其他接口进行交互
[root@h4 glance(keystone_admin)]# ls
glance-api.conf    glance-registry.conf  metadefs     schema-image.json
glance-cache.conf  glance-scrubber.conf  policy.json
[root@h4 glance(keystone_admin)]# cd /usr/share/glance/模板
[root@h4 glance(keystone_admin)]# ls
glance-api-dist.conf       glance-registry-dist.conf
glance-api-dist-paste.ini  glance-registry-dist-paste.ini
glance-cache-dist.conf     glance-scrubber-dist.conf
[root@h4 glance(keystone_admin)]# cp glance-api-dist.conf  /etc/glance/glance-api.conf ##拷贝模板[root@h4 glance(keystone_admin)]# vim glance-api.conf
[DEFAULT]
debug = False
verbose = True
use_stderr = False
log_file = /var/log/glance/api.log
filesystem_store_datadir = /var/lib/glance/images/
scrubber_datadir = /var/lib/glance/scrubber
image_cache_dir = /var/lib/glance/image-cache/
rabbit_host = 192.168.1.204
rabbit_port = 5672
rabbit_hosts = $rabbit_host:$rabbit_port
rabbit_use_ssl = false
rabbit_userid = guest
rabbit_password = guest
rabbit_login_method = AMQPLAIN
[database]
connection = mysql://glance:123456@192.168.1.204/glance
[keystone_authtoken]
admin_tenant_name = services
admin_user = glance
admin_password = 123456
auth_host = 192.168.1.204
auth_port = 35357
auth_protocol = http
auth_uri = http://192.168.1.204:5000/
[paste_deploy]
config_file = /usr/share/glance/glance-api-dist-paste.ini
flavor = keystone[root@h4 glance]# chown root.glance glance-api.conf
[root@h4 glance]# systemctl  start openstack-glance-api.service openstack-glance-registry.service  openstack-glance-scrubber.service
[root@h4 glance]# systemctl  enable openstack-glance-api.service openstack-glance-registry.service  openstack-glance-scrubber.service  管理
[root@h4 ~(keystone_admin)]# glance image-list
+----+------+
| ID | Name |
+----+------+
+----+------+
[root@h4 ~(keystone_admin)]# glance help  image-create
##########################先上传一个镜像再创建
[root@h4 ~(keystone_admin)]# glance   image-create  --name hequan --file hequan.img  --disk-format qcow2   --visibility publice  --container-format bare             ##创建
[root@h4 ~(keystone_admin)]# glance   image-create  --name hequan --os-distro http://mirrors.163.com/centos/7.2.1511/isos/x86_64/CentOS-7-x86_64-Minimal-1511.iso  --disk-format iso     --container-format bare
filesystem_store_datadir = /var/lib/glance/images/ ###镜像保存的位置
#default_store=file  修改镜像存储位置
  swift  做后端存储
  6 #filesystem_store_datadir = /var/lib/glance/images/  ##先禁用
[glance_store]
default_store = swift          默认为file 改为swift
stores = file, http                默认不用动
swift_store_auth_version = 2        默认版本为2
stores=glance.store.swift.Store,glance.store.filesystem.Store      此项一定要加上,不然无法上传
swift_store_auth_address = http://192.168.1.204:5000/v2.0/   controller的keystone认证
swift_store_user = service:swift    使用swift用户
swift_store_key = hequan        密码
swift_store_container = glance        将要被创建的容器
swift_store_create_container_on_put = True        上传开
swift_store_large_object_size = 5120        最大5G限制,但与glance结合后限制无效
swift_store_large_object_chunk_size = 200        最大200个容器
swift_enable_snet = False
[root@h4 glance(keystone_admin)]# systemctl restart openstack-glance-api.service openstack-glance-registry.service  openstack-glance-scrubber.service  ceph  共享存储
DSC0000.png

  安装epel仓库
rpm -vih http://mirrors.sohu.com/fedora-epel/7/x86_64/e/epel-release-7-2.noarch.rpm
添加yum ceph仓库
vim /etc/yum.repos.d/ceph.repo
[ceph]
name=Ceph noarch packages
baseurl=http://mirrors.163.com/ceph/rpm-hammer/el7/x86_64/
enabled=1
gpgcheck=1
type=rpm-md
gpgkey=http://mirrors.163.com/ceph/keys/release.asc
安装ceph-deploy,ceph(ceph所有节点都安装,ceph-deploy只需admin节点安装)
yum -y update && yum -y install --release hammer ceph ceph-deploy  1 生成相关的MOD信息   监控服务器  h5
[root@h5 xx]# ceph-deploy  new  h5
[root@h5 xx]# ls
ceph.conf  ceph-deploy-ceph.log  ceph.mon.keyring  2 要根据自己的情况修改配置文件ceph.conf
osd_pool_default_size = 2      ##几个节点组成,默认是3
osd_pool_defaults_min_size = 1 ##最小值是1  3 生成key   当客户端要链接到ceph服务器,需要用户名和密码
[root@h5 xx]# ceph-deploy mon      create-initial
[root@h5 myceph]# ls
ceph.bootstrap-mds.keyring  ceph.client.admin.keyring  ceph.mon.keyring
ceph.bootstrap-osd.keyring  ceph.conf
ceph.bootstrap-rgw.keyring  ceph.log  4 开始准备配置OSD
mkdir path1  path2
[root@h5 xx]# ceph-deploy osd prepare  h5:/path1  h6:/path2
[root@h5 xx]# ceph-deploy osd activate h5:/path1  h6:/path2    ##激活
[ceph_deploy.osd][DEBUG ] Host h5 is now ready for osd use.  5 把key复制到各个节点上去
[root@h5 ceph]# ceph-deploy  admin  h5 h6
[root@h5 ceph]# ceph health  ##健康性检查  6 生成元数据
[root@h5 ceph]# ceph-deploy  mds  create h5
[root@h5 ceph]# rados lspools
[root@h5 ceph]# rados mkpool glance
[root@h5 ceph]# rados rmpool glance  glance --yes-i-really-really-mean-it  ##删除  glance配置成ceph的客户端
  安装ceph
[root@h4 ceph(keystone_admin)]# ls
rbdmap
[root@h5 myceph]# ceph-deploy  admin h4
[root@h4 ceph(keystone_admin)]# ls
ceph.client.admin.keyring  ceph.conf  rbdmap  tmp6BxOoY
vim glance-api.conf
[glance_store]
default_store = rbd
stores = rbd
rbd_store_pool = glance
rbd_store_user = admin
rbd_store_ceph_conf = /etc/ceph/ceph.conf
rbd_store_chunk_size = 8     
systemctl  restart openstack-glance-api.service openstack-glance-registry.service  openstack-glance-scrubber.service
-rw------- 1 root root  63 7月  21 16:43 ceph.client.admin.keyring
setfacl  -m u:glance:r--  ceph.client.admin.keyring         ##设置权限 能读  制作镜像
yum -y groupinstall "Server with GUI"
yum install virt-manager python-virtinst qemu-kvm-tools   qemu-kvm  libvirt

KVM
创建存储卷    centos.qcow2
基本安装
配置网卡  删除MAC
安装基本组件openssh-clients
cloud-init   ##云包

[root@h4 ~]# vim /etc/default/grub
GRUB_CMDLINE_LINUX="net.ifnames=0  biosdevname=0 console=tty0 console=ttyS0,115200n8 rhgb quiet"##指定串口的参数
[root@h4 ~]# grub2-mkconfig  -o  /boot/grub2/grub.cfg

封装
[root@h5 ~]# yum whatprovides */virt-sysprep
[root@h5 ~]# yum -y install libguestfs-bash-completion-1.28.1-1.55.el7.centos.noarch
[root@h4 ~]# virt-sysprep  -d centos
[root@h4 ~]# cd /openstack-image/
[root@h4 openstack-image]# qemu-img  info centos.qcow2
qemu-img  conver -c -o qcow2  centos.qcow2   newcentos.qcow2 ###3 压缩命令  

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-496798-1-1.html 上篇帖子: openstack安装配置(三) 下篇帖子: Mirantis OpenStack Fuel6.0安装使用—Step1
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表