|NO.Z.00023|——————————|^^^^ 部署 ^^^^|——|OpenStack&组件.V01|——|OpenStack-Cinder块存储|配置block.V01|

一、Cinder块存储组件说明:
### --- Cinder块存储组件说明:

~~~     OpenStack块存储服务为云主机提供块存储设备。支持不同后端(针对于操作系统区分,可以是Windows,也可以是linux)
~~~     The Block Storage API和scheduler服务运行在controller节点(接口和调度服务)
~~~     The volume service运行在一个或多个存储节点;存储节点可以通过本地磁盘,SAN/NAS等后端设备为云主机提供卷存储。
~~~     cinder-api允许API请求,并路由他们到cinder-volume
~~~     cinder-volume直接与快存储服务交互,处理想cinder-scheduler这样的服务,通过消息队列相互通信,支持多种存储类型:iscsi协议执行的。
~~~     cinder-scheduler daemon选择最右的存储节点创建卷,类似于novascheduler
~~~     Messaging queue在块存储进程中传递信息。
二、Cinder块存储代码构建
### --- Cinder块存储代码构建

~~~     OpenStack Block Storage(cinder)
~~~     安装并配置controller节点
~~~     配置先决条件
~~~     安装并配置块存储控制组件
~~~     完成安装

一、配置先决条件
### --- 创建数据库,并完成下列步骤:
### --- 以数据库管理员root的身份连接数据库;

[root@controller ~]# mysql -uroot -p
Enter password:
### --- 创建cinder数据库

MariaDB [(none)]> CREATE DATABASE cinder;
Query OK, 1 row affected (0.03 sec)
### --- 创建数据库用户cinder,并授予cinder用户cinder数据库的完全控制权限:管理员权限,本地的权限
### --- 退出数据库连接

MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY 'CINDER_DBPASS';
Query OK, 0 rows affected (0.06 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY 'CINDER_DBPASS';
Query OK, 0 rows affected (0.00 sec)
### --- 执行admin环境变量脚本

[root@controller ~]# source  admin-openrc.sh 
### --- 在认证服务中心创建块存储服务认证信息,完成下列步骤:
### --- 创建cinder用户

[root@controller ~]# keystone user-create --name cinder --pass CINDER_PASS
+----------+----------------------------------+
| Property |              Value               |
+----------+----------------------------------+
|  email   |                                  |
| enabled  |               True               |
|    id    | add9828bcca8499faabdda3e5f0c92d1 |
|   name   |              cinder              |
| username |              cinder              |
+----------+----------------------------------+
### --- 链接cinder用户到service租户和admin角色

[root@controller ~]# keystone user-role-add --user cinder --tenant service --role admin
### --- 创建cinder服务(有两种类型,volume、volume2版本,都创建一下)

[root@controller ~]# keystone service-create --name cinder --type volume --description "OpenStack Block Storage"
+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |     OpenStack Block Storage      |
|   enabled   |               True               |
|      id     | 5a5c18c3eb724b5dba7efc7f0c7bffac |
|     name    |              cinder              |
|     type    |              volume              |
+-------------+----------------------------------+
[root@controller ~]# keystone service-create --name cinderv2 --type volumev2 --description "OpenStack Block Storage"
+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |     OpenStack Block Storage      |
|   enabled   |               True               |
|      id     | 53fba8bd2c2d4680868105a39b557e57 |
|     name    |             cinderv2             |
|     type    |             volumev2             |
+-------------+----------------------------------+
### --- 创建块存储服务端点

[root@controller ~]# keystone endpoint-create \
> --service-id $(keystone service-list | awk '/ volume / {print $2}') \
> --publicurl http://controller.nice.com:8776/v1/%\(tenant_id\)s \
> --internalurl http://controller.nice.com:8776/v1/%\(tenant_id\)s \
> --adminurl http://controller.nice.com:8776/v1/%\(tenant_id\)s \
> --region regionOne
+-------------+--------------------------------------------------+
|   Property  |                      Value                       |
+-------------+--------------------------------------------------+
|   adminurl  | http://controller.nice.com:8776/v1/%(tenant_id)s |
|      id     |         a77a7e2616944e68976bed7d632e8c6e         |
| internalurl | http://controller.nice.com:8776/v1/%(tenant_id)s |
|  publicurl  | http://controller.nice.com:8776/v1/%(tenant_id)s |
|    region   |                    regionOne                     |
|  service_id |         5a5c18c3eb724b5dba7efc7f0c7bffac         |
+-------------+--------------------------------------------------+
[root@controller ~]# keystone endpoint-create \
> --service-id $(keystone service-list | awk '/ volumev2 / {print $2}') \
> --publicurl http://controller.nice.com:8776/v2/%\(tenant_id\)s \
> --internalurl http://controller.nice.com:8776/v2/%\(tenant_id\)s \
> --adminurl http://controller.nice.com:8776/v2/%\(tenant_id\)s \
> --region regionOne
+-------------+--------------------------------------------------+
|   Property  |                      Value                       |
+-------------+--------------------------------------------------+
|   adminurl  | http://controller.nice.com:8776/v2/%(tenant_id)s |
|      id     |         9dddadd5c94a4ec79703bc11c1c455cf         |
| internalurl | http://controller.nice.com:8776/v2/%(tenant_id)s |
|  publicurl  | http://controller.nice.com:8776/v2/%(tenant_id)s |
|    region   |                    regionOne                     |
|  service_id |         53fba8bd2c2d4680868105a39b557e57         |
+-------------+--------------------------------------------------+
二、安装并配置块存储控制组件
### --- 安装软件包
~~~     openstack-cinder 
~~~     python-cinderclient: 客户端工具
~~~     python-oslo-db:连接库函数

[root@controller ~]# yum install openstack-cinder  python-cinderclient python-oslo-db
Install  1 Package (+26 Dependent packages)
Total download size: 30 M
Installed size: 108 M
Is this ok [y/d/N]: y
Installed:
  openstack-cinder.noarch 0:2014.2-1.el7.centos                                                                                                                                        
Dependency Installed:
  atlas.x86_64 0:3.10.1-7.el7                               blas.x86_64 0:3.4.2-4.el7                                glusterfs-api.x86_64 0:3.4.0.59rhs-1.el7.centos                  
  glusterfs-libs.x86_64 0:3.4.0.59rhs-1.el7.centos          iscsi-initiator-utils.x86_64 0:6.2.0.873-21.el7          iscsi-initiator-utils-iscsiuio.x86_64 0:6.2.0.873-21.el7         
  lapack.x86_64 0:3.4.2-4.el7                               libgfortran.x86_64 0:4.8.2-16.2.el7_0                    libiscsi.x86_64 0:1.9.0-6.el7                                    
  libquadmath.x86_64 0:4.8.2-16.2.el7_0                     numpy.x86_64 1:1.7.1-10.el7                              numpy-f2py.x86_64 1:1.7.1-10.el7                                 
  python-amqplib.noarch 0:1.0.2-7.el7                       python-cinder.noarch 0:2014.2-1.el7.centos               python-devel.x86_64 0:2.7.5-16.el7                               
  python-kmod.x86_64 0:0.9-4.el7                            python-networkx-core.noarch 0:1.8.1-12.el7               python-nose.noarch 0:1.3.0-2.el7                                 
  python-rtslib.noarch 0:2.1.fb46-1.el7                     python-taskflow.noarch 0:0.3.21-1.el7                    qemu-img.x86_64 10:1.5.3-60.el7_0.10                             
  rsyslog-mmjsonparse.x86_64 0:7.4.7-7.el7_0                scipy.x86_64 0:0.12.1-3.el7                              suitesparse.x86_64 0:4.0.2-10.el7                                
  sysfsutils.x86_64 0:2.1.0-16.el7                          tbb.x86_64 0:4.1-5.20130314.el7                         
Complete!
~~~     1个程序,27个包
### --- 编辑/etc/cinder/cinder.conf文件并完成下列操作:

[root@controller ~]# vim /etc/cinder/cinder.conf
# 编辑[database]小节,配置数据库连接:
[database]
......
connection=mysql://cinder:CINDER_DBPASS@controller.nice.com/cinder
# 编辑[DEFAULT]小节,配置RabbitMQ消息代理访问:
[DEFAULT]
......
rpc_backend=rabbit
rabbit_host=controller.nice.com
rabbit_password=guest
# 编辑[DEFAULT]和[keystone_authtoken]小节,配置认证服务访问:
[DEFAULT]
......
auth_strategy=keystone
[keystone_authtoken]
......
auth_uri=http://controller.nice.com:5000/v2.0               # 公共访问端点
identity_uri=http://controller.nice.com:35357               # 管理员访问端点。这里的端点都是指向keystone服务的
admin_tenant_name=service                                   # 租户为service
admin_user=cinder                                           # 管理员用户为cinder用户
admin_password=CINDER_PASS                                  # 管理员用户的密码为CINDER_PASS
# 编辑[DEFAULT]小节,配置my_ip选项使用controller节点的控制端口ip:
[DEFAULT]
......
my_ip=192.168.222.5
# (可选)在[DEFAULT]小节中配置详细日志输出,方便排错。
[DEFAULT]
......
verbose=True
### --- 初始化块存储服务数据库

[root@controller ~]# su -s /bin/sh -c "cinder-manage db sync" cinder
2021-01-12 02:38:09.036 35720 INFO 004_volume_type_to_uuid [-] Created foreign key volume_type_extra_specs_ibfk_1
2021-01-12 02:38:09.511 35720 INFO 021_add_default_quota_class [-] Added default quota class data into the DB.
2021-01-12 02:38:09.714 35720 INFO 026_add_consistencygroup_quota_class [-] Added default consistencygroups quota class data into the DB.
三、完成安装
### --- 启动块存储并设置开机自动启动:

[root@controller ~]# systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
ln -s '/usr/lib/systemd/system/openstack-cinder-api.service' '/etc/systemd/system/multi-user.target.wants/openstack-cinder-api.service'
ln -s '/usr/lib/systemd/system/openstack-cinder-scheduler.service' '/etc/systemd/system/multi-user.target.wants/openstack-cinder-scheduler.service'
[root@controller ~]# systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service
[root@controller ~]# systemctl status openstack-cinder-api.service openstack-cinder-scheduler.service

 
 
 
 
 
 
 
 
 

Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
                                                                                                                                                   ——W.S.Landor

 

 

posted on   yanqi_vip  阅读(59)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· DeepSeek 开源周回顾「GitHub 热点速览」
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示