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

openstack T版跟Y版的区别 openstack u版_openstack T版跟Y版的区别

2、创建身份认证

#source admin-openrc 
# openstack user create --domain default --password-prompt cinder
# openstack role add --project service --user cinder admin

openstack T版跟Y版的区别 openstack u版_openstack T版跟Y版的区别_02

创建服务

# openstack service create --name cinderv2   --description "OpenStack Block Storage" volumev2
# openstack service create --name cinderv3   --description "OpenStack Block Storage" volumev3

openstack T版跟Y版的区别 openstack u版_centos_03

创建三类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 T版跟Y版的区别 openstack u版_linux_04

# 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

openstack T版跟Y版的区别 openstack u版_mysql_05

3、安装软件

# yum install openstack-cinder

openstack T版跟Y版的区别 openstack u版_openstack T版跟Y版的区别_06

4、修改配置文件

# vim /etc/cinder/cinder.conf
[database]
connection = mysql+pymysql://cinder:123@controller/cinder

openstack T版跟Y版的区别 openstack u版_运维_07

[DEFAULT]
transport_url = rabbit://openstack:123@controller
auth_strategy = keystone
my_ip = 192.168.144.20

openstack T版跟Y版的区别 openstack u版_运维_08

[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

openstack T版跟Y版的区别 openstack u版_运维_09

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

openstack T版跟Y版的区别 openstack u版_linux_10

5、同步数据库

# su -s /bin/sh -c "cinder-manage db sync" cinder

openstack T版跟Y版的区别 openstack u版_linux_11

# mysql -ucinder -p123
MariaDB [(none)]> show databases;
MariaDB [(none)]> use cinder
MariaDB [cinder]> show tables;

openstack T版跟Y版的区别 openstack u版_openstack T版跟Y版的区别_12

6、配置nova服务以使用块存储

# vim /etc/nova/nova.conf
[cinder]
os_region_name = RegionOne

openstack T版跟Y版的区别 openstack u版_mysql_13

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

openstack T版跟Y版的区别 openstack u版_运维_14

二、compute节点

1、安装LVM软件

# yum install lvm2 device-mapper-persistent-data

openstack T版跟Y版的区别 openstack u版_linux_15

在compute节点上可以查看到我们在基础配置的时候添加的一个5G硬盘

openstack T版跟Y版的区别 openstack u版_mysql_16

创建LVM

# pvcreate /dev/sdb
# vgcreate cinder-volumes /dev/sdb

openstack T版跟Y版的区别 openstack u版_运维_17

# vim /etc/lvm/lvm.conf

注意,如果你操作系统使用的也是LVM的话,那么就需要将sda也写进入,

filter = [ "a/sda/", "a/sdb/", "r/.*/"]

openstack T版跟Y版的区别 openstack u版_linux_18

2、安装cinder软件

# yum install openstack-cinder targetcli python3-keystone

这里注意,软件包有变化从python-keystone——》python3-keystone

openstack T版跟Y版的区别 openstack u版_运维_19

# vim /etc/cinder/cinder.conf
[database]
connection = mysql+pymysql://cinder:123@controller/cinder

openstack T版跟Y版的区别 openstack u版_openstack T版跟Y版的区别_20

[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

openstack T版跟Y版的区别 openstack u版_运维_21

[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

openstack T版跟Y版的区别 openstack u版_linux_22

[lvm]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
target_protocol = iscsi
target_helper = lioadm

openstack T版跟Y版的区别 openstack u版_运维_23

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

openstack T版跟Y版的区别 openstack u版_linux_24

3、启动服务

# systemctl enable openstack-cinder-volume.service target.service
# systemctl start openstack-cinder-volume.service target.service

openstack T版跟Y版的区别 openstack u版_openstack T版跟Y版的区别_25

三、验证:

查cinder的服务状态,都是up的,

# source admin-openrc 
# openstack volume service list

openstack T版跟Y版的区别 openstack u版_mysql_26

创建一个volume卷

# openstack volume create --size 1 test

openstack T版跟Y版的区别 openstack u版_运维_27

查看状态

# openstack volume list

openstack T版跟Y版的区别 openstack u版_openstack T版跟Y版的区别_28