日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

cinder连接mysql数据库_Openstack入门篇(十六)之Cinder服务的部署与测试

發(fā)布時間:2025/3/15 数据库 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 cinder连接mysql数据库_Openstack入门篇(十六)之Cinder服务的部署与测试 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

1.理解塊存儲服務(wù)

操作系統(tǒng)獲得存儲空間的方式一般有兩種:

通過某種協(xié)議(SAS,SCSI,SAN,iSCSI 等)掛接裸硬盤,然后分區(qū)、格式化、創(chuàng)建文件系統(tǒng);或者直接使用裸硬盤存儲數(shù)據(jù)(數(shù)據(jù)庫)

通過 NFS、CIFS 等 協(xié)議,mount 遠程的文件系統(tǒng)

第一種裸硬盤的方式叫做 Block Storage(塊存儲),每個裸硬盤通常也稱作 Volume(卷)

第二種叫做文件系統(tǒng)存儲。NAS 和 NFS 服務(wù)器,以及各種分布式文件系統(tǒng)提供的都是這種存儲。

OpenStack 提供 Block Storage Service 的是 Cinder,其具體功能是:

①提供 REST API 使用戶能夠查詢和管理 volume、volume snapshot 以及 volume type

②提供 scheduler 調(diào)度 volume 創(chuàng)建請求,合理優(yōu)化存儲資源的分配

③通過 driver 架構(gòu)支持多種 back-end(后端)存儲方式,包括 LVM,NFS,Ceph,GlusterFS

2.Cinder 架構(gòu)以及塊存儲服務(wù)組件介紹

Cinder邏輯架構(gòu)圖:

cinder不是一個存儲軟件,而是屬于管理存儲軟件。塊存儲服務(wù)通常包含下列組件:

cinder-api:接受API請求,調(diào)用 cinder-volume 執(zhí)行操作。

cinder-volume:與塊存儲服務(wù)和例如“cinder scheduler”的進程進行交互

cinder-scheduler守護進程:scheduler 通過調(diào)度算法選擇最合適的存儲節(jié)點創(chuàng)建 volume,和nova-scheduler類似

cinder-backup daemon:備份進程

消息隊列:Cinder 各個子服務(wù)通過消息隊列實現(xiàn)進程間通信和相互協(xié)作。因為有了消息隊列,子服務(wù)之間實現(xiàn)了解耦,這種松散的結(jié)構(gòu)也是分布式系統(tǒng)的重要特征。

Database:Cinder 有一些數(shù)據(jù)需要存放到數(shù)據(jù)庫中,一般使用 MySQL。數(shù)據(jù)庫是安裝在控制節(jié)點上的,比如實驗環(huán)境中,可以訪問名稱為“cinder”的數(shù)據(jù)庫。

3.物理部署方案

Cinder 的服務(wù)會部署在兩類節(jié)點上,控制節(jié)點和存儲節(jié)點。

查看當前計算節(jié)點cinder的相關(guān)服務(wù)

[root@linux-node1 ~]# ps -e |grepcinder1150 ? 01:19:09 cinder-api2025 ? 00:02:15 cinder-api3357 ? 00:17:16 cinder-schedule24069 ? 00:27:01 cinder-volume24089 ? 00:04:19 cinder-volume

cinder-api和cinder-schedule都部署在控制節(jié)點上,這無可厚非,思考:但是cinder-volume是否應(yīng)該部署在存儲節(jié)點上呢?

實際上,OpenStack是一個分布式系統(tǒng),其每個組件的子服務(wù)都可以部署在任何節(jié)點上,只需要網(wǎng)絡(luò)可通,這也表明了OpenStack的靈活性。無論哪個節(jié)點,只要運行了cinder-volume,它就是一個存儲節(jié)點。同時,存儲節(jié)點也可以部署其他組件的子服務(wù)。

4.安裝組件并配置

(1)安裝軟件包

[root@linux-node1 ~]# yum install -y openstack-cinder

(2)修改配置:/etc/cinder/cinder.conf

[root@linux-node1 ~]# vim /etc/cinder/cinder.conf

[database]<==配置數(shù)據(jù)庫訪問

connection= mysql+pymysql://cinder:cinder@192.168.56.11/cinder

[DEFAULT]

transport_url= rabbit://openstack:openstack@192.168.56.11 <==配置RabbitMQ消息隊列訪問權(quán)限

auth_strategy = keystone <==啟動用keystoen認證

[keystone_authtoken]<==配置認證服務(wù)訪問

auth_uri= http://192.168.56.11:5000

auth_url = http://192.168.56.11:35357

memcached_servers = 192.168.56.11:11211auth_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

查看配置:

[root@linux-node1 ~]# grep "^[a-z]" /etc/cinder/cinder.conf

auth_strategy=keystone

transport_url= rabbit://openstack:openstack@192.168.56.11

connection = mysql+pymysql://cinder:cinder@192.168.56.11/cinder

auth_uri = http://192.168.56.11:5000

auth_url = http://192.168.56.11:35357

memcached_servers = 192.168.56.11:11211auth_type=password

project_domain_name=default

user_domain_name=default

project_name=service

username=cinder

password=cinder

lock_path= /var/lib/cinder/tmp

5.初始化塊存儲服務(wù)的數(shù)據(jù)庫,并驗證

[root@linux-node1 ~]# su -s /bin/sh -c "cinder-manage db sync"cinder

[root@linux-node1 ~]# mysql -h 192.168.56.11 -ucinder -pcinder -e "use cinder;show tables;"

6.配置計算服務(wù)以使用塊設(shè)備存儲

[root@linux-node1 ~]# vim /etc/nova/nova.conf

[cinder]

os_region_name=RegionOne

7.完成安裝

[root@linux-node1 ~]# systemctl restart openstack-nova-api.service

[root@linux-node1 ~]# systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service

[root@linux-node1 ~]# systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service

8.創(chuàng)建cinder和cinderv2服務(wù)實體

[root@linux-node1 ~]# openstack service create --name cinder \> --description "OpenStack Block Storage"volume+-------------+----------------------------------+

| Field | Value |

+-------------+----------------------------------+

| description | OpenStack Block Storage |

| enabled | True |

| id | c63c93beff014724b036a811e2b0d591 |

| name | cinder |

| type | volume |

+-------------+----------------------------------+[root@linux-node1 ~]# openstack service create --name cinderv2 \> --description "OpenStack Block Storage"volumev2+-------------+----------------------------------+

| Field | Value |

+-------------+----------------------------------+

| description | OpenStack Block Storage |

| enabled | True |

| id | 6829915c1f9745409ca9bda364fe26c4 |

| name | cinderv2 |

| type | volumev2 |

+-------------+----------------------------------+

9.創(chuàng)建塊設(shè)備存儲服務(wù)的API入口點

[root@linux-node1 ~]# openstack endpoint create --region RegionOne \

volume public http://192.168.56.11:8776/v1/%\(tenant_id\)s

[root@linux-node1 ~]# openstack endpoint create --region RegionOne \

volume internal http://192.168.56.11:8776/v1/%\(tenant_id\)s

[root@linux-node1 ~]# openstack endpoint create --region RegionOne \

volume admin http://192.168.56.11:8776/v1/%\(tenant_id\)s

[root@linux-node1 ~]# openstack endpoint create --region RegionOne \

volumev2 public http://192.168.56.11:8776/v2/%\(tenant_id\)s

[root@linux-node1 ~]# openstack endpoint create --region RegionOne \

volumev2 internal http://192.168.56.11:8776/v2/%\(tenant_id\)s

[root@linux-node1 ~]# openstack endpoint create --region RegionOne \

volumev2 admin http://192.168.56.11:8776/v2/%\(tenant_id\)s

[root@linux-node1 ~]# openstack service list+----------------------------------+----------+----------+

| ID | Name | Type |

+----------------------------------+----------+----------+

| 18b41a6647e84ef68c5df6058c2f4eab | glance | image |

| 436e446b475a46fa978349211d6c64eb | keystone | identity |

| 613a3d7e61574fdbb7c330f6892a1b50 | neutron | network |

| 6829915c1f9745409ca9bda364fe26c4 | cinderv2 | volumev2 |

| 7347593df9034e369d27caf8f0240470 | nova | compute |

| c63c93beff014724b036a811e2b0d591 | cinder | volume |

+----------------------------------+----------+----------+[root@linux-node1 ~]# openstack endpoint list+----------------------------------+-----------+--------------+--------------+---------+-----------+----------------------------------------------+

| ID | Region | Service Name | Service Type | Enabled | Interface | URL |

+----------------------------------+-----------+--------------+--------------+---------+-----------+----------------------------------------------+

| 0ae3e6275b4c4c20a7e8619909726bd4 | RegionOne | cinder | volume | True | internal | http://192.168.56.11:8776/v1/%(tenant_id)s |

| 1fba971a2dc6424eaa06ef61c910e739 | RegionOne | cinder | volume | True | admin | http://192.168.56.11:8776/v1/%(tenant_id)s |

| 20222ecb6eeb4f378035e79c47810b08 | RegionOne | keystone | identity | True | public | http://192.168.56.11:5000/v3/ |

| 45fd632b46684fdca9782a1e23b91f8c | RegionOne | glance | image | True | admin | http://192.168.56.11:9292 |

| 64f9ee02b5d0489598f31e164d40e6df | RegionOne | nova | compute | True | public | http://192.168.56.11:8774/v2.1/%(tenant_id)s |

| 6cc75ee06e5245059e106e89e1643a92 | RegionOne | keystone | identity | True | internal | http://192.168.56.11:35357/v3/ |

| 77f141dede894dea877d505b60e60de7 | RegionOne | nova | compute | True | internal | http://192.168.56.11:8774/v2.1/%(tenant_id)s |

| 7883d0f227a54ac5a0db3ad3a02606df | RegionOne | nova | compute | True | admin | http://192.168.56.11:8774/v2.1/%(tenant_id)s |

| 7c7b33e8c2ac431aa7380ceeac80fb37 | RegionOne | keystone | identity | True | admin | http://192.168.56.11:35357/v3/ |

| 84e4273b741148e2a2d9c71d2c62da1e | RegionOne | cinder | volume | True | public | http://192.168.56.11:8776/v1/%(tenant_id)s |

| abd82401a31d453ca2e28fc17816fd6c | RegionOne | neutron | network | True | public | http://192.168.56.11:9696 |

| af72b7e0d3824c1e82663d06c1bd0205 | RegionOne | glance | image | True | internal | http://192.168.56.11:9292 |

| cb6a870ba8a543ee882afe4b07d3c087 | RegionOne | neutron | network | True | admin | http://192.168.56.11:9696 |

| e27bccfa73984db889f9373f288b4c67 | RegionOne | cinderv2 | volumev2 | True | internal | http://192.168.56.11:8776/v2/%(tenant_id)s |

| e3a7e437be8a4cf1968c82ceca932d57 | RegionOne | glance | image | True | public | http://192.168.56.11:9292 |

| e54250bd44384b15b5bbf1bb6eb34337 | RegionOne | cinderv2 | volumev2 | True | admin | http://192.168.56.11:8776/v2/%(tenant_id)s |

| eba3e70ff0a44ab28898169f4807145f | RegionOne | cinderv2 | volumev2 | True | public | http://192.168.56.11:8776/v2/%(tenant_id)s |

| f5c7dad4452840d788ed59c905efb3e7 | RegionOne | neutron | network | True | internal | http://192.168.56.11:9696 |

+----------------------------------+-----------+--------------+--------------+---------+-----------+----------------

10.cinder-scheduler的調(diào)度

創(chuàng)建 Volume 時,cinder-scheduler 會基于容量、Volume Type 等條件選擇出最合適的存儲節(jié)點,然后讓其創(chuàng)建 Volume。

Filter scheduler 是 cinder-scheduler 默認的調(diào)度器。

scheduler_driver = cinder.scheduler.filter_scheduler.FilterScheduler

scheduler 調(diào)度過程如下:

通過過濾器(filter)選擇滿足條件的存儲節(jié)點(運行 cinder-volume)

通過權(quán)重計算(weighting)選擇最優(yōu)(權(quán)重值最大)的存儲節(jié)點。

總結(jié)

以上是生活随笔為你收集整理的cinder连接mysql数据库_Openstack入门篇(十六)之Cinder服务的部署与测试的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。