OpenStack搭建之Cinder服务的安装(五)

一、controller节点

创建cinder数据库并配置cinder数据库访问权限

mysql -uroot -p000000
create database cinder;
grant all privileges on cinder.* to 'cinder'@'localhost' identified by '000000';
grant all privileges on cinder.* to 'cinder'@'%' identified by '000000';
exit

创建cinder用户并分配角色

. admin-openrc 
openstack user create --domain default --password-prompt cinder
openstack role add --project service --user cinder admin

创建service

openstack service create --name cinderv2 --description "openStack Block Storage" volumev2
openstack service create --name cinderv3 --description "openStack Block Storage" volumev3

创建endpoint

openstack endpoint create --region RegionOne volumev2 public http://controller:8776/v2/%\(tenant_id\)s
openstack endpoint create --region RegionOne volumev2 internal http://controller:8776/v2/%\(tenant_id\)s
openstack endpoint create --region RegionOne volumev2 admin  http://controller:8776/v2/%\(tenant_id\)s

openstack endpoint create --region RegionOne volumev3 public http://controller:8776/v3/%\(tenant_id\)s
openstack endpoint create --region RegionOne volumev3 internal http://controller:8776/v3/%\(tenant_id\)s
openstack endpoint create --region RegionOne volumev3 admin http://controller:8776/v3/%\(tenant_id\)s

安装cinder软件包

yum install -y openstack-cinder

生成UUID

uuidgen
81fce1bb-d55a-4b88-a0de-d3bf90107c39

修改cinder配置文件

mv /etc/cinder/cinder.conf /etc/cinder/cinder.conf_bak
cat>/etc/cinder/cinder.conf<<EOF
[DEFAULT]
my_ip = 192.168.100.103
transport_url = rabbit://openstack:000000@controller
auth_strategy = keystone
[backend]
[backend_defaults]
[barbican]
[brcd_fabric_example]
[cisco_fabric_example]
[coordination]
[cors]
[database]
connection = mysql+pymysql://cinder:000000@controller/cinder
[fc-zone-manager]
[healthcheck]
[key_manager]
[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=000000
[nova]
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_middleware]
[oslo_policy]
[oslo_reports]
[oslo_versionedobjects]
[privsep]
[profiler]
[sample_castellan_source]
[sample_remote_file_source]
[service_user]
[ssl]
[vault]

EOF

初始化数据库

su -s /bin/sh -c "cinder-manage db sync" cinder

启动服务并设置开机启动

systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service openstack-cinder-volume.service
systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service openstack-cinder-volume.service

查看服务器启动状态

systemctl status openstack-cinder-api.service openstack-cinder-scheduler.service openstack-cinder-volume.service

验证

cinder service-list
cinder create --display-name demo-volume1 1
cinder list

二、存储节点(计算节点)

安装软件包

yum install lvm2 device-mapper-persistent-data -y

启动lvm2并设置开机启动

systemctl enable lvm2-lvmetad
systemctl start lvm2-lvmetad

创建物理卷

pvcreate /dev/vdb

创建卷组

vgcreate cinder-volumes /dev/vdb

配置LVM2组件

编辑/etc/lvm/lvm.conf文件配置过滤器

编辑# Configuration section devices部分,添加

filter = ["a/vdg/","r/.*/"]

安装并配置组件

安装组件

yum install openstack-cinder targetcli python-keystone -y

配置cinder配置文件

mv /etc/cinder.conf /etc/cinder.conf_bak
cat>/etc/cinder/cinder.conf<<EOF
[DEFAULT]
transport_url = rabbit://openstack:000000@controller
auth_strategy = keystone
my_ip = 192.168.100.104
enabled_backends = lvm
glance_api_servers = http://controller:9292
[lvm]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
target_protocol = iscsi
target_helper = lioadm
[backend]
[backend_defaults]
[barbican]
[brcd_fabric_example]
[cisco_fabric_example]
[coordination]
[cors]
[database]
connection = mysql+pymysql://cinder:000000@controller/cinder
[fc-zone-manager]
[healthcheck]
[key_manager]
[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=000000
[nova]
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_middleware]
[oslo_policy]
[oslo_reports]
[oslo_versionedobjects]
[privsep]
[profiler]
[sample_castellan_source]
[sample_remote_file_source]
[service_user]
[ssl]
[vault]
EOF

启动cinder服务

systemctl enable openstack-cinder-volume.service target
systemctl start openstack-cinder-volume.service target

查看服务状态

systemctl status openstack-cinder-volume.service target

在控制节点验证服务

. admin-openrc
openstack volume service list

cinder所有配置配置完成了~

发表评论

后才能评论