一、创建数据库
创建数据库以及用户:
# mysql -uroot -p12345678
MariaDB [(none)]> CREATE DATABASE cinder;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY 'cinder123';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY 'cinder123';
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit;
二、创建cinder-api
导入环境变量:
# source admin-openrc
创建cinder用户
# openstack user create --domain default --password-prompt cinder # 输入密码cinder
绑定角色和租户:
# openstack role add --project service --user cinder admin
cinder服务实体类型”volume”,创建v2/v3两个服务实体
# openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2
# openstack service create --name cinderv3 --description "OpenStack Block Storage" volumev3
创建块存储服务API v2端点:
# openstack endpoint create --region RegionOne
volumev2 public http://10.10.11.11:8776/v2/%(project_id)s
# openstack endpoint create --region RegionOne
volumev2 internal http://10.10.11.11:8776/v2/%(project_id)s
# openstack endpoint create --region RegionOne
volumev2 admin http://10.10.11.11:8776/v2/%(project_id)s
创建块存储服务API v3端点:
# openstack endpoint create --region RegionOne
volumev3 public http://10.10.11.11:8776/v3/%(project_id)s
# openstack endpoint create --region RegionOne
volumev3 internal http://10.10.11.11:8776/v3/%(project_id)s
# openstack endpoint create --region RegionOne
volumev3 admin http://10.10.11.11:8776/v3/%(project_id)s
三、安装配置组件
3.1 安装包
# yum install -y openstack-cinder
3.2 编辑 /etc/cinder/cinder.conf文件
# vim /etc/cinder/cinder.conf
[database]
connection = mysql+pymysql://cinder:cinder123@localhost/cinder
[DEFAULT]
transport_url = rabbit://openstack:openstack123@10.10.11.11
auth_strategy = keystone
my_ip = 10.10.11.11
[keystone_authtoken]
auth_uri = http://10.10.11.11:5000
auth_url = http://10.10.11.11:35357
memcached_servers = 10.10.11.11: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
3.3 同步块存储数据
# su -s /bin//sh -c "cinder-manage db sync" cinder
3.4 配置计算服务以使用块存储
# vim /etc/nova/nova.conf
[cinder]
os_region_name = RegionOne
3.5 重启服务
重启nova-api服务:
# systemctl restart openstack-nova-api.service
启动cinder服务,并设置开机启动:
# systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
# systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service
当你的才华配不上你的野心的时候,就静下来学习吧。