openstack kilo与ceph

本文仅做记录。 http://docs.openstack.org/liberty/zh_CN/install-guide-rdo/launch-instance-public.html http://www.cnblogs.com/shihuc/p/5201085.html 创建网络。 1 neutron net-create public --shared --provider:physical_network public --provider:network_type flat 上述指令中的配置信息,依据的是配置文件/etc/neutron/plugins/ml2/ml2_conf.ini中的内容。 [ml2_type_flat] flat_networks = public [linux_bridge] physical_interface_mappings = public:em1 下面创建public的网络,指定网络的起点IP以及结束IP,指定一个IP范围,指定dns以及gateway。 1 [root@node0 opt]# neutron subnet-create public 192.168.1.0/24 --name public --allocation-pool start=192.168.1.140,end=192.168.1.254 --dns-nameserver 219.141.136.10 --gateway 192.168.1.1 web端DNS不能解析的时候,将控制节点的nova.conf文件中的 vnc controller 改为管理IP 然后重启nova服务 systemctl restart openstack-nova-compute 与ceph对接 2个节点一个mon mds 每台主机1个osd http://my.oschina.net/JerryBaby/blog/376858 Ceph for Glance and Cinder in OpenStack Liberty 09 MAY 2016 on openstack, ceph, glance, cinder 1.创建新pool Bash # ceph osd pool create volumes 4096 # ceph osd pool create images 128 # ceph osd pool create backups 128 # ceph osd pool create vms 4096 2.在控制节点,计算节点安装RPM包 Bash # yum -y install python-rbd ceph 3.开启cephx情况下,给nova,cinder添加3个用户权限 Bash # ceph auth get-or-create client.cinder mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=volumes, allow rwx pool=vms, allow rx pool=images' # ceph auth get-or-create client.glance mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=images' # ceph auth get-or-create client.cinder-backup mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=backups' 4.控制节点需要以下几个keys ceph.client.glance.keyring, ceph.client.cinder.keyring, ceph.client.cinder-backup.keyring Bash # ceph auth get-or-create client.glance | ssh controller sudo tee /etc/ceph/ceph.client.glance.keyring # ssh controller sudo chown glance:glance /etc/ceph/ceph.client.glance.keyring # ceph auth get-or-create client.cinder | ssh controller sudo tee /etc/ceph/ceph.client.cinder.keyring # ssh controller sudo chown cinder:cinder /etc/ceph/ceph.client.cinder.keyring # ceph auth get-or-create client.cinder-backup | ssh controller sudo tee /etc/ceph/ceph.client.cinder-backup.keyring # ssh controller sudo chown cinder:cinder /etc/ceph/ceph.client.cinder-backup.keyring 5.计算节点添加client.cinder.key Bash # for i in compute1 compute2;do ceph auth get-or-create client.cinder | ssh $i sudo tee /etc/ceph/ceph.client.cinder.keyring ceph auth get-key client.cinder | ssh $i tee client.cinder.key ; done 6.控制节点添加ceph.client.admin.keyring Bash # scp ceph.client.admin.keyring controller:/etc/ceph/ 7.编辑ceph.conf 添加以下内容 Bash [client] rbd cache = true rbd cache writethrough until flush = true rbd default format = 2 [client.glance] keyring = /etc/ceph/ceph.client.glance.keyring [client.cinder] keyring = /etc/ceph/ceph.client.cinder.keyring [client.cinder-backup] keyring = /etc/ceph/ceph.client.cinder-backup.keyring 8.复制ceph.conf到所以计算节点 Bash # for i in compute1 compute2;do scp /etc/ceph/ceph.conf $i:/etc/ceph/ done 9.添加一个secret key到libvirt Bash # uuidgen 397eb3ee-925b-4391-b3d3-36e984a4dc27 cat > secret.xml <<EOF <secret ephemeral='no' private='no'> <uuid>397eb3ee-925b-4391-b3d3-36e984a4dc27</uuid> <usage type='ceph'> <name>client.cinder secret</name> </usage> </secret> EOF 导入secret key Bash # virsh secret-define --file secret.xml Secret 397eb3ee-925b-4391-b3d3-36e984a4dc27 created # virsh secret-set-value --secret 397eb3ee-925b-4391-b3d3-36e984a4dc27 $(cat client.cinder.key) glance-api.conf修改 Bash [DEFAULT] ... default_store = rbd show_image_direct_url = True [glance_store] #default_store = file #filesystem_store_datadir = /var/lib/glance/images/ ## stores = rbd,file rbd_store_pool = images rbd_store_user = glance rbd_store_ceph_conf = /etc/ceph/ceph.conf rbd_store_chunk_size = 8 11.cinder.conf修改 添加以下内容: Bash [DEFAULT] ... enabled_backends = lvm,ceph [ceph] volume_driver = cinder.volume.drivers.rbd.RBDDriver volume_backend_name = ceph rbd_pool = volumes rbd_ceph_conf = /etc/ceph/ceph.conf rbd_flatten_volume_from_snapshot = false rbd_max_clone_depth = 5 rbd_store_chunk_size = 4 rados_connect_timeout = -1 glance_api_version = 2 rbd_user = cinder rbd_secret_uuid = 397eb3ee-925b-4391-b3d3-36e984a4dc27 12.nova.conf修改 修改libvirt段 Bash [libvirt] images_type = rbd images_rbd_pool = vms images_rbd_ceph_conf = /etc/ceph/ceph.conf rbd_user = nova inject_password = false inject_key = false inject_partition = -2 rbd_user = cinder rbd_secret_uuid = 397eb3ee-925b-4391-b3d3-36e984a4dc27 live_migration_flag=VIR_MIGRATE_UNDEFINE_SOURCE, VIR_MIGRATE_PEER2PEER, VIR_MIGRATE_LIVE, VIR_MIGRATE_TUNNELLED 13.重启glance,cinder,nova服务 14.创建新cinder 类型 ceph Bash # cinder type-create ceph # cinder type-key ceph set volume_backend_name=ceph # cinder service-list 15.创建卷测试 Bash # cinder create --volume-type ceph --display-name ceph-test 1 # cinder list # rbd -p volumes ls 16.下载vm 模板系统,导入glance tips: 需要将模板镜像格式转换为 RAW

posted on 2016-11-15 15:14  歪歪121  阅读(64)  评论(0)    收藏  举报