cinder服务
- 前言
- 一、controller节点
- 1、数据库
- 2、创建身份认证
- 3、安装软件
- 4、修改配置文件
- 5、同步数据库
- 6、配置nova服务以使用块存储
- 7、启动服务
- 二、compute节点
- 1、安装LVM软件
- 2、安装cinder软件
- 3、启动服务
- 三、验证:
前言
cinder服务在OpenStack中不是必须的,cinder就是提供一个volume存储卷的功能,创建一个卷然后绑定到启动的实例上面去,没他我们照旧可以使用实例没啥影响。但是既然官方文档中写了那就部署上吧。
一、controller节点
1、数据库
# mysql -uroot -pXylong_000
MariaDB [(none)]> CREATE DATABASE cinder;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY '123';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY '123';Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> exit
2、创建身份认证
#source admin-openrc
# openstack user create --domain default --password-prompt cinder
# openstack role add --project service --user cinder admin
创建服务
# 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/%\(project_id\)s
# openstack endpoint create --region RegionOne volumev2 internal http://controller:8776/v2/%\(project_id\)s
# openstack endpoint create --region RegionOne volumev2 admin http://controller:8776/v2/%\(project_id\)s
# openstack endpoint create --region RegionOne volumev3 public http://controller:8776/v3/%\(project_id\)s
# openstack endpoint create --region RegionOne volumev3 internal http://controller:8776/v3/%\(project_id\)s
# openstack endpoint create --region RegionOne volumev3 admin http://controller:8776/v3/%\(project_id\)s
3、安装软件
# yum install openstack-cinder
4、修改配置文件
# vim /etc/cinder/cinder.conf
[database]
connection = mysql+pymysql://cinder:123@controller/cinder
[DEFAULT]
transport_url = rabbit://openstack:123@controller
auth_strategy = keystone
my_ip = 192.168.144.20
[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 = 123
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp
5、同步数据库
# su -s /bin/sh -c "cinder-manage db sync" cinder
# mysql -ucinder -p123
MariaDB [(none)]> show databases;
MariaDB [(none)]> use cinder
MariaDB [cinder]> show tables;
6、配置nova服务以使用块存储
# vim /etc/nova/nova.conf
[cinder]
os_region_name = RegionOne
7、启动服务
# 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
二、compute节点
1、安装LVM软件
# yum install lvm2 device-mapper-persistent-data
在compute节点上可以查看到我们在基础配置的时候添加的一个5G硬盘
创建LVM
# pvcreate /dev/sdb
# vgcreate cinder-volumes /dev/sdb
# vim /etc/lvm/lvm.conf
注意,如果你操作系统使用的也是LVM的话,那么就需要将sda也写进入,
filter = [ "a/sda/", "a/sdb/", "r/.*/"]
2、安装cinder软件
# yum install openstack-cinder targetcli python3-keystone
这里注意,软件包有变化从python-keystone——》python3-keystone
# vim /etc/cinder/cinder.conf
[database]
connection = mysql+pymysql://cinder:123@controller/cinder
[DEFAULT]
transport_url = rabbit://openstack:123@controller
auth_strategy = keystone
my_ip = 192.168.144.21
enabled_backends = lvm
glance_api_servers = http://controller:9292
[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 = 123
[lvm]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
target_protocol = iscsi
target_helper = lioadm
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp
3、启动服务
# systemctl enable openstack-cinder-volume.service target.service
# systemctl start openstack-cinder-volume.service target.service
三、验证:
查cinder的服务状态,都是up的,
# source admin-openrc
# openstack volume service list
创建一个volume卷
# openstack volume create --size 1 test
查看状态
# openstack volume list