作者:【吴业亮】
博客:http://blog.csdn.net/wylfengyujiancheng
一、前提条件
各个节点的时间同步
二、基础配置
1、安装软件包
# yum -y install openstack-cinder python2-crypto targetcli
2、修改配置文件
# mv /etc/cinder/cinder.conf /etc/cinder/cinder.conf.org
# vi /etc/cinder/cinder.conf
[DEFAULT]
# define own IP address
my_ip = 172.16.8.63
log_dir = /var/log/cinder
state_path = /var/lib/cinder
auth_strategy = keystone
# RabbitMQ connection info
transport_url = rabbit://openstack:Changeme_123@172.16.8.50
# Glance connection info
glance_api_servers = http://172.16.8.50:9292
# MariaDB connection info
[database]
connection = mysql+pymysql://cinder:Changeme_123@172.16.8.50/cinder
# Keystone auth info
[keystone_authtoken]
auth_uri = http://172.16.8.50:5000
auth_url = http://172.16.8.50:35357
memcached_servers = node1:11211,node2:11211,node3:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = Changeme_123
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp
3、修改权限
# chmod 640 /etc/cinder/cinder.conf
# chgrp cinder /etc/cinder/cinder.conf
4、启动服务
# systemctl start openstack-cinder-volume
# systemctl enable openstack-cinder-volume
三、配置lvm后端存储
创建逻辑卷
# pvcreate /dev/sdb
# vgcreate Cinder-LVM /dev/sdb
修改配置文件/etc/cinder/cinder.conf
[DEFAULT]
enabled_backends = lvm
[lvm]
iscsi_helper = lioadm
# volume group name just created
volume_group = Cinder-LVM
# IP address of Storage Node
iscsi_ip_address = 172.16.8.63
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volumes_dir = $state_path/volumes
iscsi_protocol = iscsi
volume_backend_name = lvm
重启服务
# systemctl restart openstack-cinder-volume
在计算节点上修改配置文件/etc/nova/nova.conf
[cinder]
os_region_name = RegionOne
在计算节点上重启服务
# systemctl restart openstack-nova-compute
四、配置nfs后端存储(存储节点上)
安装软件包
# yum -y install nfs-utils
# systemctl start rpcbind
# systemctl enable rpcbind
修改配置文件/etc/cinder/cinder.conf
[DEFAULT]
enabled_backends = nfs
[nfs]
volume_driver = cinder.volume.drivers.nfs.NfsDriver
nfs_shares_config = /etc/cinder/nfs_shares
volume_backend_name = nfs
创建文件/etc/cinder/nfs_shares
172.16.8.63:/opt/cinder-nfs
172.16.8.63 是nfs服务器的IP
修改权限
# chmod 640 /etc/cinder/nfs_shares
# chgrp cinder /etc/cinder/nfs_shares
重启服务
# systemctl restart openstack-cinder-volume
修改权限
# chown -R cinder. /var/lib/cinder/mnt
以下操作计算节点上
安装rpm
# yum -y install nfs-utils
启动服务并设置开机启动
# systemctl start rpcbind
# systemctl enable rpcbind
修改配置文件/etc/nova/nova.conf
[cinder]
os_region_name = RegionOne
重启服务
# systemctl restart openstack-nova-compute
五、创建多后端存储
修改配置文件/etc/cinder/cinder.conf
[DEFAULT]
enabled_backends = lvm,nfs
[lvm]
iscsi_helper = lioadm
volume_group = Cinder-LVM
iscsi_ip_address = 172.16.100.50
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volumes_dir = $state_path/volumes
iscsi_protocol = iscsi
volume_backend_name = lvm
[nfs]
volume_driver = cinder.volume.drivers.nfs.NfsDriver
volume_backend_name = NFS
nfs_shares_config = /etc/cinder/nfs_shares
nfs_mount_point_base = $state_path/mnt_nfs
volume_backend_name = nfs
创建挂载目录
# mkdir /var/lib/cinder/mnt_nfs
# chown cinder:cinder /var/lib/cinder/mnt_nfs
创建存储类型(控制节点执行)
# openstack volume type create lvm
# openstack volume type create nfs
# openstack volume type list
# cinder --os-username admin --os-tenant-name admin type-key lvm set volume_backend_name=lvm
# cinder --os-username admin --os-tenant-name admin type-key nfs set volume_backend_name=nfs
六、配置cinder-backup
修改配置文件 /etc/cinder/cinder.conf
[DEFAULT]
backup_driver = cinder.backup.drivers.nfs
backup_mount_point_base = $state_path/backup_nfs
backup_share = 172.16.8.63:/var/lib/cinder-backup
启动服务
# systemctl start openstack-cinder-backup
# systemctl enable openstack-cinder-backup
修改权限
# chown -R cinder. /var/lib/cinder/backup_nfs