首页 > 代码库 > openstack controller ha测试环境搭建记录(十三)——配置cinder(控制节点)

openstack controller ha测试环境搭建记录(十三)——配置cinder(控制节点)

在任一控制节点创建用户:
mysql -u root -p
CREATE DATABASE cinder;
GRANT ALL PRIVILEGES ON cinder.* TO ‘cinder‘@‘localhost‘ IDENTIFIED BY ‘123456‘;
GRANT ALL PRIVILEGES ON cinder.* TO ‘cinder‘@‘%‘ IDENTIFIED BY ‘123456‘;


在任一控制节点创建相关用户:
source admin-openrc.sh
keystone user-create --name cinder --pass 123456
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://myvip:8776/v1/%\(tenant_id\)s \
  --internalurl http://myvip:8776/v1/%\(tenant_id\)s \
  --adminurl http://myvip: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


在每个控制节点安装软件:
yum install -y openstack-cinder python-cinderclient python-oslo-db


在每个控制节点修改配置文件:
openstack-config --set /etc/cinder/cinder.conf database connection mysql://cinder:123456@myvip/cinder

openstack-config --set /etc/cinder/cinder.conf DEFAULT rabbit_password 123456
openstack-config --set /etc/cinder/cinder.conf DEFAULT rabbit_hosts controller1:5672,controller2:5672,controller3:5672
openstack-config --set /etc/cinder/cinder.conf DEFAULT rabbit_retry_interval 1
openstack-config --set /etc/cinder/cinder.conf DEFAULT rabbit_retry_backoff 2
openstack-config --set /etc/cinder/cinder.conf DEFAULT rabbit_max_retries 0
openstack-config --set /etc/cinder/cinder.conf DEFAULT rabbit_durable_queues true
openstack-config --set /etc/cinder/cinder.conf DEFAULT rabbit_ha_queues true

openstack-config --set /etc/cinder/cinder.conf DEFAULT auth_strategy keystone
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_uri http://myvip:5000/v2.0
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken identity_uri http://myvip:35357
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken admin_user cinder
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken admin_tenant_name service
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken admin_password 123456

openstack-config --set /etc/cinder/cinder.conf DEFAULT my_ip 10.0.0.10

openstack-config --set /etc/cinder/cinder.conf DEFAULT verbose True


在任一控制节点初始化cinder数据库:
su -s /bin/sh -c "cinder-manage db sync" cinder


尝试在拥有VIP资源的节点启动cinder服务:
systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service

openstack controller ha测试环境搭建记录(十三)——配置cinder(控制节点)