记录,方便查阅。
重复的配置信息不做解释。
To configure prerequisites
mysql -p123456 -e "CREATE DATABASE cinder;GRANT ALL PRIVILEGES ON cinder.* TO ‘cinder‘@‘192.168.23.11‘ IDENTIFIED BY ‘cinder‘;GRANT ALL PRIVILEGES ON cinder.* TO ‘cinder‘@‘%‘ IDENTIFIED BY ‘cinder‘;"
keystone user-create --name cinder --pass cinder
keystone user-role-add --user cinder --tenant service --role admin
keystone service-create --name cinder --type volume --description "OpenStack Block Storage"
keystone service-create --name cinderv2 --type volumev2 --description "OpenStack Block Storage"
keystone endpoint-create --service-id $(keystone service-list | awk ‘/ volume / {print $2}‘) --publicurl http://controller:8776/v1/%\(tenant_id\)s \
--internalurl http://controller:8776/v1/%\(tenant_id\)s \
--adminurl http://controller:8776/v1/%\(tenant_id\)s \
--region regionOne
keystone endpoint-create --service-id $(keystone service-list | awk ‘/ volumev2 / {print $2}‘) --publicurl http://controller:8776/v2/%\(tenant_id\)s \
--internalurl http://controller:8776/v2/%\(tenant_id\)s \
--adminurl http://controller:8776/v2/%\(tenant_id\)s \
--region regionOne
install and configure Block Storage controller components
yum install openstack-cinder python-cinderclient python-oslo-db –y
/etc/cinder/cinder.conf
[database]
connection = mysql://cinder:cinder@controller/cinder
[DEFAULT]
rpc_backend = rabbit
rabbit_host = controller
#rabbit_password = RABBIT_PASS
[DEFAULT]
auth_strategy = keystone
[keystone_authtoken]
auth_uri = http://controller:5000/v2.0
identity_uri = http://controller:35357
admin_tenant_name = service
admin_user = cinder
admin_password = cinder
[DEFAULT]
my_ip = 192.168.23.11
[DEFAULT]
verbose = True
systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service
Install and configure a storage node
新添加磁盘sd;
使用fdisk分区sdb1即可,不添加文件系统。
yum install lvm2 -y
systemctl enable lvm2-lvmetad.service
systemctl start lvm2-lvmetad.service
pvcreate /dev/sdb1 #创建物理卷
vgcreate cinder-volumes /dev/sdb1 #创建卷组
/etc/lvm/lvm.conf
devices
#filter = [ "a/sdb/", "r/.*/"]
filter = [ "a/sda/", "a/sdb/", "r/.*/"] #添加扫描过滤信息,应为本机系统sda也使用lvm,一同添加进去
yum install openstack-cinder targetcli python-oslo-db MySQL-python
/etc/cinder/cinder.conf
[database]
connection = mysql://cinder:cinder@controller/cinder
[DEFAULT]
rpc_backend = rabbit
rabbit_host = controller
#rabbit_password = RABBIT_PASS
[DEFAULT]
auth_strategy = keystone
[keystone_authtoken]
auth_uri = http://controller:5000/v2.0
identity_uri = http://controller:35357
admin_tenant_name = service
admin_user = cinder
admin_password = cinder
[DEFAULT]
my_ip = 192.168.23.11
[DEFAULT]
glance_host = controller
[DEFAULT]
iscsi_helper = lioadm #iscsi使用lioadm服务
[DEFAULT]
verbose = True
systemctl enable openstack-cinder-volume.service target.service
systemctl start openstack-cinder-volume.service target.service
查看集群启动的关于cinder的服务:
glusterfs
cinder的后端若采用glusterfs;
wget -P /etc/yum.repos.d http://download.gluster.org/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-epel.repo
yum -y install glusterfs glusterfs-fuse glusterfs-server
systemctl enable glusterd
systemctl start glusterd
创建glusterfs集群
gluster peer probe compute
gluster peer status #查看连接
mkdir -p /data/gluster-controller
mkdir -p /data/gluster-compute
创建卷
gluster volume create demo replica 2 192.168.23.11:/data/gluster-controller 192.168.23.12:/data/gluster-compute force
gluster volume info all #查看所有卷
启动卷
gluster volume start demo
/etc/cinder/cinder.conf
volume_driver=cinder.volume.drivers.glusterfs.GlusterfsDriver
glusterfs_shares_config=/etc/cinder/glusterfs_shares
glusterfs_mount_point_base=$state_path/mnt
vim /etc/cinder/glusterfs_shares
chmod 0640 /etc/cinder/glusterfs_shares
chown root:cinder /etc/cinder/glusterfs_shares
重启服务
for i in api scheduler volume; do sudo service openstack-cinder-${i} restart; done
查看挂载
创建云硬盘后,可查看挂载位置或是/data/glusterfs-controller下有对应data文件
至此,cinder安装完成。
openstack学习(六):cinder配置以及使用