块存储服务 — 安装并配置控制节点:
在控制节点上操作:
先决条件:
1、数据库相关操作。
# mysql -u root -p*** > CREATE DATABASE cinder; > GRANT ALL PRIVILEGES ON cinder.* TO ‘cinder‘@‘localhost‘ IDENTIFIED BY ‘CINDER_DBPASS‘; > GRANT ALL PRIVILEGES ON cinder.* TO ‘cinder‘@‘%‘ IDENTIFIED BY ‘CINDER_DBPASS‘; > exit;
2、用户相关操作。
# . admin-openrc # openstack user create --domain default --password-prompt cinder # openstack role add --project service --user cinder admin # openstack service create --name cinder --description "OpenStack Block Storage" volume # openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2 # openstack endpoint create --region RegionOne volume public http://controller:8776/v1/%\(tenant_id\)s # openstack endpoint create --region RegionOne volume internal http://controller:8776/v1/%\(tenant_id\)s # openstack endpoint create --region RegionOne volume admin http://controller:8776/v1/%\(tenant_id\)s # 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
安装并配置组件:
1、安装包。
# yum install -y openstack-cinder
2、编辑 /etc/cinder/cinder.conf 文件。添加或修改内容。CINDER_DBPASS、RABBIT_PASS、CINDER_PASS替换。
[database] connection = mysql+pymysql://cinder:[email protected]/cinder [DEFAULT] rpc_backend = rabbit auth_strategy = keystone my_ip = 192.168.226.151 [oslo_messaging_rabbit] rabbit_host = controller rabbit_userid = openstack rabbit_password = RABBIT_PASS [keystone_authtoken] auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = cinder password = CINDER_PASS [oslo_concurrency] lock_path = /var/lib/cinder/tmp
3、初始化块设备服务的数据库。
# su -s /bin/sh -c "cinder-manage db sync" cinder
配置计算节点以使用块设备存储:
1、编辑文件 /etc/nova/nova.conf 并添加内容。
[cinder]
os_region_name = RegionOne
完成安装:
1、重启计算API 服务。
# systemctl restart openstack-nova-api
2、启动块设备存储服务,并配置为随系统启动。
# systemctl enable openstack-cinder-api openstack-cinder-scheduler # systemctl start openstack-cinder-api openstack-cinder-scheduler