1、控制节点
1.1、数据库配置
mysql -uroot -p123456
CREATE DATABASE cinder;
GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY 'cinder';
GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY 'cinder';
1.2、创建项目
openstack user create --domain default --password cinder cinder
openstack role add --project service --user cinder admin
openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2
openstack service create --name cinderv3 --description "OpenStack Block Storage" volumev3
openstack endpoint create --region RegionOne volumev2 public http://controller:8776/v2/%\(project_id\)s
openstack endpoint create --region RegionOne volumev2 internal http://controller:8776/v2/%\(project_id\)s
openstack endpoint create --region RegionOne volumev2 admin http://controller:8776/v2/%\(project_id\)s
openstack endpoint create --region RegionOne volumev3 public http://controller:8776/v3/%\(project_id\)s
openstack endpoint create --region RegionOne volumev3 internal http://controller:8776/v3/%\(project_id\)s
openstack endpoint create --region RegionOne volumev3 admin http://controller:8776/v3/%\(project_id\)s
1.3、安装cinder
yum install openstack-cinder -y
cp /etc/cinder/cinder.conf /etc/cinder/cinder.conf.bak
vim /etc/cinder/cinder.conf
[database]
# ...
connection = mysql+pymysql://cinder:cinder@controller/cinder
[DEFAULT]
# ...
transport_url = rabbit://openstack:openstack@controller
auth_strategy = keystone
my_ip = 192.168.189.150
[keystone_authtoken]
# ...
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = cinder
[oslo_concurrency]
# ...
lock_path = /var/lib/cinder/tmp
1.4、同步数据库
su -s /bin/sh -c "cinder-manage db sync" cinder
1.5、将计算配置使用块存储
vim /etc/nova/nova.conf
[cinder]
os_region_name = RegionOne
1.6、启动
systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
systemctl restart openstack-cinder-api.service openstack-cinder-scheduler.service
systemctl status openstack-cinder-api.service openstack-cinder-scheduler.service
2、存储节点
2.1、块设备准备
#安装
yum install lvm2 device-mapper-persistent-data -y
systemctl enable lvm2-lvmetad.service
systemctl restart lvm2-lvmetad.service
systemctl status lvm2-lvmetad.service
#创建 LVM 物理卷:/dev/sdb
pvcreate /dev/sdb
#创建 LVM 卷组:cinder-volumes
vgcreate cinder-volumes /dev/sdb
#配置过滤规则
cp /etc/lvm/lvm.conf /etc/lvm/lvm.conf.bak
vim /etc/lvm/lvm.conf
devices {
...
filter = [ "a|/sdb|", "r|/.*/|"]
2.2、安装cinder
yum install openstack-cinder targetcli python-keystone -y
cp /etc/cinder/cinder.conf /etc/cinder/cinder.conf.bak
sed -ri '/^[ \t]*(#|$)/d' /etc/cinder/cinder.conf
vim /etc/cinder/cinder.conf
[database]
# ...
connection = mysql+pymysql://cinder:cinder@controller/cinder
[DEFAULT]
# ...
transport_url = rabbit://openstack:openstack@controller
auth_strategy = keystone
my_ip = 192.168.189.153
enabled_backends = lvm
glance_api_servers = http://controller:9292
[keystone_authtoken]
# ...
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = cinder
[lvm]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
target_protocol = iscsi
target_helper = lioadm
[oslo_concurrency]
# ...
lock_path = /var/lib/cinder/tmp
2.3、启动
systemctl enable openstack-cinder-volume.service target.service
systemctl restart openstack-cinder-volume.service target.service
systemctl status openstack-cinder-volume.service target.service
3、验证
openstack volume service list
#创建1GB的卷
openstack volume create --size 1 volume1
4、配置多个存储后端
- 多个存储后端
- cinder replication 链接2
修改配置文件
[DEFAULT]
enabled_backends=lvmdriver-1,lvmdriver-2,lvmdriver-3
[lvmdriver-1]
volume_group=cinder-volumes-1
volume_driver=cinder.volume.drivers.lvm.LVMVolumeDriver
volume_backend_name=LVM
[lvmdriver-2]
volume_group=cinder-volumes-2
volume_driver=cinder.volume.drivers.lvm.LVMVolumeDriver
volume_backend_name=LVM
[lvmdriver-3]
volume_group=cinder-volumes-3
volume_driver=cinder.volume.drivers.lvm.LVMVolumeDriver
volume_backend_name=LVM_b
添加卷类型
openstack volume type create lvm1
openstack volume type set lvm1 --property volume_backend_name=lvm1
openstack volume type create lvm2
openstack volume type set lvm2 --property volume_backend_name=lvm2
openstack volume type list --long