You are on page 1of 2

安装块存储服务

配置控制节点:

在计算节点上连接到数据库
# mysql

为块存储服务创建数据库
mysql> CREATE DATABASE cinder;

定义 cinder 数据库访问权限
mysql> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' \
IDENTIFIED BY 'redhat';
mysql> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' \
IDENTIFIED BY 'redhat';
mysql> exit;

加载环境变量文件
# . admin.rc

创建 cinder 用户
# openstack user create --domain default --password redhat cinder

为 cinder 用户赋予 admin 身份角色


# openstack role add --project service --user cinder admin

创建 cinder 和 cinderv2 服务
# openstack service create --name cinder \
--description "OpenStack Block Storage" volume
# openstack service create --name cinderv2 \
--description "OpenStack Block Storage" volumev2

备注:块存储服务需要两个服务入口

创建块存储服务 API 端口

# openstack endpoint create --region RegionOne \


volume public http://10.18.3.160:8776/v1/%\(tenant_id\)s

# openstack endpoint create --region RegionOne \


volume internal http://10.18.3.160:8776/v1/%\(tenant_id\)s

# openstack endpoint create --region RegionOne \


volume admin http://10.18.3.160:8776/v1/%\(tenant_id\)s

# openstack endpoint create --region RegionOne \


volumev2 public http://10.18.3.160:8776/v2/%\(tenant_id\)s

# openstack endpoint create --region RegionOne \


volumev2 internal http://10.18.3.160:8776/v2/%\(tenant_id\)s

# openstack endpoint create --region RegionOne \


volumev2 admin http://10.18.3.160:8776/v2/%\(tenant_id\)s

备注:块存储服务需要每个服务入口的端点

安装软件包
# yum install openstack-cinder
编辑 cinder 配置文件/etc/cinder/cinder.conf
[DEFAULT]
...
transport_url = rabbit://openstack:redhat@<控制节点 IP 地址>
auth_strategy = keystone
my_ip = <控制节点 IP 地址>

[keystone_authtoken]
...
auth_uri = http://<控制节点 IP 地址>:5000
auth_url = http://<控制节点 IP 地址>:35357
memcached_servers = <控制节点 IP 地址>:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = cinder
password = redhat

[oslo_concurrency]
...
lock_path = /var/lib/cinder/tmp

[database]
...
connection = mysql+pymysql://cinder:redhat@<控制节点 IP 地址>/cinder

导入块存储数据库
# su -s /bin/sh -c "cinder-manage db sync" cinder

配置计算服务使用块存储
编辑 Nova 配置文件/etc/nova/nova.conf
[cinder]
os_region_name = RegionOne

重启计算 API 服务
# systemctl restart openstack-nova-api.service

启动块存储服务,并设置其随开机启动
# systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
# systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service

You might also like