OpenStack-Queens详细安装部署(九)Cinder集群

  • A+
所属分类:OpenStack

1. 创建cinder数据库 (任意controller节点操作)

[root@DT_Node-172_17_7_1 ~]# mysql -uroot -pYTI1MTg4NGZiMGEzZTZmYTEw -hcontroller
MariaDB [(none)]> CREATE DATABASE cinder;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY 'NzgxYTdjZWYyMDA4MDlkNDhi';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY 'NzgxYTdjZWYyMDA4MDlkNDhi';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> \q
[root@DT_Node-172_17_7_1 ~]#

2. 创建cinder-api (任意controller节点操作)

# 调用cinder服务需要认证信息,加载环境变量脚本即可
[root@DT_Node-172_17_7_1 ~]# . keystone_admin 
1)创建cinder用户
# service项目已在glance章节创建;
# neutron用户在”default” domain中
[openstack-admin]-[root@DT_Node-172_17_7_1 ~]# openstack user create --domain default --password=YWNkNzVhMzM2MTE0NTFkNWZk cinder

OpenStack-Queens详细安装部署(九)Cinder集群

2)cinder赋权

# 为cinder用户赋予admin权限
[openstack-admin]-[root@DT_Node-172_17_7_1 ~]# openstack role add --project service --user cinder admin

3)创建cinder服务实体

# cinder服务实体类型”volume”;
# 创建v2/v3两个服务实体
[root@controller01 ~]# openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2
[root@controller01 ~]# openstack service create --name cinderv3 --description "OpenStack Block Storage" volumev3

OpenStack-Queens详细安装部署(九)Cinder集群

4)创建cinder-api

# 注意--region与初始化admin用户时生成的region一致;
# api地址统一采用vip,如果public/internal/admin分别使用不同的vip,请注意区分;
# cinder-api 服务类型为volume;
# cinder-api后缀为用户project-id,可通过”openstack project list”查看
# v2 public api
[openstack-admin]-[root@DT_Node-172_17_7_1 ~]# openstack endpoint create --region RegionTest volumev2 public http://controller:8776/v2/%\(project_id\)s

OpenStack-Queens详细安装部署(九)Cinder集群

# v2 internal api
[openstack-admin]-[root@DT_Node-172_17_7_1 ~]# openstack endpoint create --region RegionTest volumev2 internal http://controller:8776/v2/%\(project_id\)s

OpenStack-Queens详细安装部署(九)Cinder集群

# v2 admin api
[openstack-admin]-[root@DT_Node-172_17_7_1 ~]# openstack endpoint create --region RegionTest volumev2 admin http://controller:8776/v2/%\(project_id\)s

OpenStack-Queens详细安装部署(九)Cinder集群

# v3 public api
[openstack-admin]-[root@DT_Node-172_17_7_1 ~]# openstack endpoint create --region RegionTest volumev3 public http://controller:8776/v3/%\(project_id\)s

OpenStack-Queens详细安装部署(九)Cinder集群

# v3 internal api
[openstack-admin]-[root@DT_Node-172_17_7_1 ~]# openstack endpoint create --region RegionTest volumev3 internal http://controller:8776/v3/%\(project_id\)s

OpenStack-Queens详细安装部署(九)Cinder集群

# v3 admin api
[openstack-admin]-[root@DT_Node-172_17_7_1 ~]# openstack endpoint create --region RegionTest volumev3 admin http://controller:8776/v3/%\(project_id\)s

OpenStack-Queens详细安装部署(九)Cinder集群

3. 安装cinder (所有controller节点操作)

[root@DT_Node-172_17_7_1 ~]# yum install openstack-cinder -y

4. 配置cinder.conf (所有controller节点操作)

# 注意”my_ip”参数,根据节点修改;
# 注意cinder.conf文件的权限:root:cinder
[root@DT_Node-172_17_7_1 ~]# cp /etc/cinder/cinder.conf{,_original}
[root@DT_Node-172_17_7_1 ~]# egrep -v "^$|^#" /etc/cinder/cinder.conf
[DEFAULT]
my_ip = 172.17.7.1
state_path = /var/lib/cinder
glance_api_servers = http://controller:9292
auth_strategy = keystone
osapi_volume_listen = $my_ip
osapi_volume_listen_port = 8776
log_dir = /var/log/cinder
transport_url=rabbit://openstack:MWY1NTA5NGYzYmM1MWQ2MTFk@controller1:5672,openstack:MWY1NTA5NGYzYmM1MWQ2MTFk@controller2:5672,openstack:MWY1NTA5NGYzYmM1MWQ2MTFk@controller3:5672
enabled_backends = ceph
[backend]
[backend_defaults]
[barbican]
[brcd_fabric_example]
[cisco_fabric_example]
[coordination]
[cors]
[database]
connection = mysql+pymysql://cinder:NzgxYTdjZWYyMDA4MDlkNDhi@controller/cinder
[fc-zone-manager]
[healthcheck]
[key_manager]
[keystone_authtoken]
www_authenticate_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller1:11211,controller2:11211,controller3:11211
auth_type = password
project_domain_id = default
user_domain_id = default
project_name = service
username = cinder
password = YWNkNzVhMzM2MTE0NTFkNWZk
[matchmaker_redis]
[nova]
[oslo_concurrency]
lock_path = $state_path/tmp
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_messaging_zmq]
[oslo_middleware]
[oslo_policy]
[oslo_reports]
[oslo_versionedobjects]
[profiler]
[service_user]
[ssl]
[vault]
[root@DT_Node-172_17_7_1 ~]#

5. 配置nova.conf (所有controller节点操作)

# 配置只涉及nova.conf的”[cinder]”字段;
# 加入对应regiong
[root@DT_Node-172_17_7_1 ~]# sed -i '/^\[cinder]/a os_region_name=RegionTest' /etc/nova/nova.conf

6. 同步cinder数据库 (任意controller节点操作)

# 忽略部分”deprecation”信息
[root@DT_Node-172_17_7_1 ~]# su -s /bin/sh -c "cinder-manage db sync" cinder
[root@DT_Node-172_17_7_1 ~]# mysql -ucinder -pNzgxYTdjZWYyMDA4MDlkNDhi -hcontroller cinder -e "show tables;"

7. 启动服务 (所有controller节点操作)

# 变更nova配置文件,首先需要重启nova服务
[root@DT_Node-172_17_7_1 ~]# systemctl restart openstack-nova-api.service && systemctl status openstack-nova-api.service

OpenStack-Queens详细安装部署(九)Cinder集群

# 开机启动
[root@DT_Node-172_17_7_1 ~]# systemctl enable openstack-cinder-api.service \
openstack-cinder-scheduler.service \
openstack-cinder-volume.service \
target.service
# 启动
[root@DT_Node-172_17_7_1 ~]# systemctl restart openstack-cinder-api.service \
openstack-cinder-scheduler.service \
openstack-cinder-volume.service \
target.service
#检查启动状态
[root@DT_Node-172_17_7_1 ~]# systemctl status openstack-cinder-api.service \
openstack-cinder-scheduler.service \
openstack-cinder-volume.service \
target.service

OpenStack-Queens详细安装部署(九)Cinder集群

8.配置HAproxy (所有controller节点操作)

a. HAproxy配置文件加入下面内容

 listen cinder_api_cluster
  bind 172.17.7.100:8776
  balance  source
  option  tcpka
  option  httpchk
  option  tcplog
  server controller1 172.17.7.1:8776 check inter 2000 rise 2 fall 5
  server controller2 172.17.7.2:8776 check inter 2000 rise 2 fall 5
  server controller3 172.17.7.3:8776 check inter 2000 rise 2 fall 5

b. 重启HAproxy

[root@DT_Node-172_17_7_1 ~]# systemctl restart haproxy.service
[root@DT_Node-172_17_7_1 ~]# systemctl status haproxy.service
[root@DT_Node-172_17_7_1 ~]# ss -tnl| grep 8776          
LISTEN     0      4000   172.17.7.100:8776                     *:*                  
LISTEN     0      128    172.17.7.2:8776                     *:*                  
[root@DT_Node-172_17_7_1 ~]# 

OpenStack-Queens详细安装部署(九)Cinder集群

9. 验证 (任意controller节点操作)

[root@DT_Node-172_17_7_1 ~]# . keystone_admin
# 查看agent服务;
# 或:cinder service-list
[openstack-admin]-[root@DT_Node-172_17_7_1 ~]# openstack volume service list
# 此时后端存储服务为ceph,但ceph相关服务尚未启用并集成到cinder-volume,导致cinder-volume服务的状态也是”down”

OpenStack-Queens详细安装部署(九)Cinder集群

10. 设置pcs资源 (任意controller节点操作)

# 添加资源cinder-api与cinder-scheduler
[root@DT_Node-172_17_7_1 ~]# pcs resource create openstack-cinder-api systemd:openstack-cinder-api --clone interleave=true
[root@DT_Node-172_17_7_1 ~]# pcs resource create openstack-cinder-scheduler systemd:openstack-cinder-scheduler --clone interleave=true
# cinder-api与cinder-scheduler以active/active模式运行;
# openstack-nova-volume以active/passive模式运行
# 查看资源
[root@DT_Node-172_17_7_1 ~]# pcs resource

OpenStack-Queens详细安装部署(九)Cinder集群

lookback

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: