openstack学习笔记八 glance安装配置
镜像 安装过系统的虚拟硬盘管理是用glance来完成。
镜像的状态:
active 镜像已经上传完成,并且是可用的
saving 正在被上传,还没有完成
killed 上传出错
queued 并没有真的上传完成,但是被标记有这个镜像
安装glance
在 keystone注册
glance所需要的账户
创建glance服务
指定glance服务的endpoint
安装
# yum -y install openstack-glance.noarch
# openstack-db--init--service glance --password 123456 -rootpw 123456
# keystone user-create --name glance--pass 123456
# keystoneuser-role-add--user glance --tenant services --role admin
# keystoneservice-create--name glance --type image--description "glance jingxiang"
# keystoneendpoint-create--service-id3d0969b633044029a895da1ca2855464--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 |
+-------------+----------------------------------+
修改配置文件
# systemctllist-unit-files| grep glanc
openstack-glance-api.service disabled 接受用户的请求
openstack-glance-registry.service disabled 和数据库进行交互
openstack-glance-scrubber.service disabled 和其他接口进行交互
# ls
glance-api.conf glance-registry.confmetadefs schema-image.json
glance-cache.confglance-scrubber.confpolicy.json
# cd /usr/share/glance/模板
# ls
glance-api-dist.conf glance-registry-dist.conf
glance-api-dist-paste.iniglance-registry-dist-paste.ini
glance-cache-dist.conf glance-scrubber-dist.conf
# cp glance-api-dist.conf/etc/glance/glance-api.conf ##拷贝模板# vim glance-api.conf
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
connection = mysql://glance:123456@192.168.1.204/glance
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/
config_file = /usr/share/glance/glance-api-dist-paste.ini
flavor = keystone# chown root.glance glance-api.conf
# systemctlstart openstack-glance-api.service openstack-glance-registry.serviceopenstack-glance-scrubber.service
# systemctlenable openstack-glance-api.service openstack-glance-registry.serviceopenstack-glance-scrubber.service 管理
# glance image-list
+----+------+
| ID | Name |
+----+------+
+----+------+
# glance helpimage-create
##########################先上传一个镜像再创建
# glance image-create--name hequan --file hequan.img--disk-format qcow2 --visibility publice--container-format bare ##创建
# 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/##先禁用
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
# systemctl restart openstack-glance-api.service openstack-glance-registry.serviceopenstack-glance-scrubber.service ceph共享存储
安装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
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
# ceph-deploynewh5
# ls
ceph.confceph-deploy-ceph.logceph.mon.keyring 2 要根据自己的情况修改配置文件ceph.conf
osd_pool_default_size = 2 ##几个节点组成,默认是3
osd_pool_defaults_min_size = 1 ##最小值是1 3 生成key 当客户端要链接到ceph服务器,需要用户名和密码
# ceph-deploy mon create-initial
# ls
ceph.bootstrap-mds.keyringceph.client.admin.keyringceph.mon.keyring
ceph.bootstrap-osd.keyringceph.conf
ceph.bootstrap-rgw.keyringceph.log 4 开始准备配置OSD
mkdir path1path2
# ceph-deploy osd prepareh5:/path1h6:/path2
# ceph-deploy osd activate h5:/path1h6:/path2 ##激活
Host h5 is now ready for osd use. 5 把key复制到各个节点上去
# ceph-deployadminh5 h6
# ceph health##健康性检查 6 生成元数据
# ceph-deploymdscreate h5
# rados lspools
# rados mkpool glance
# rados rmpool glanceglance --yes-i-really-really-mean-it##删除 glance配置成ceph的客户端
安装ceph
# ls
rbdmap
# ceph-deployadmin h4
# ls
ceph.client.admin.keyringceph.confrbdmaptmp6BxOoY
vim glance-api.conf
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
systemctlrestart openstack-glance-api.service openstack-glance-registry.serviceopenstack-glance-scrubber.service
-rw------- 1 root root63 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-kvmlibvirt
KVM
创建存储卷 centos.qcow2
基本安装
配置网卡删除MAC
安装基本组件openssh-clients
cloud-init ##云包
# vim /etc/default/grub
GRUB_CMDLINE_LINUX="net.ifnames=0biosdevname=0 console=tty0 console=ttyS0,115200n8 rhgb quiet"##指定串口的参数
# grub2-mkconfig-o/boot/grub2/grub.cfg
封装
# yum whatprovides */virt-sysprep
# yum -y install libguestfs-bash-completion-1.28.1-1.55.el7.centos.noarch
# virt-sysprep-d centos
# cd /openstack-image/
# qemu-imginfo centos.qcow2
qemu-imgconver -c -o qcow2centos.qcow2 newcentos.qcow2 ###3 压缩命令
页:
[1]