OpenStack---多節點部署Ceph文件系統

前言:

  • Ceph ceph是一個統一的分佈式存儲系統,設計初衷是提供較好的性能、可靠性和擴展性
  • ceph項目最早其源於Sage就讀博士期間的工作(最早的成果於2004年發表),並隨後貢獻給開源社區。在經過了數年的發展之後,目前已得到衆多雲計算廠商的支持並被廣泛應用。RedHat及OpenStack都可與Ceph整合以支持虛擬機鏡像的後端存儲。

一、Ceph特點

  • 高性能

    ① Ceph摒棄了傳統的集中式元數據尋址方案,採用crush算法, 數據分佈均勻,並行度高

    ② 考慮了容災域的隔離,能夠實現哥類負載的副本放置規則,例如跨機房、機架感知等

    ③ 能夠支持上千個存儲節點的規模,支持TB到PB級的數據

  • 高可用性

① 副本數可以靈活控制

② 支持故障域分隔,數據強一致性

③ 多種故障常見自動進行修復自愈

④ 沒有單點故障,自動管理

  • 高可擴展性

① 去中心化

② 擴展靈活

③ 隨着節點增加而線性增長

  • 特性豐富

① 支持三種存儲接口:塊存儲、文件存儲、對象存儲

② 支持自定義接口,支持多種語言驅動

二、Ceph架構介紹

在這裏插入圖片描述

2.1 Ceph生態系統大致分爲四類
  • 客戶端 clients

    數據用戶

  • 元數據服務器 mds metadata server cluster

    緩存和同步分佈式元數據

  • 對象存儲集羣 osd object storage cluster

    將數據和元數據作爲對象存儲,執行其他關鍵職能

  • 集羣監視器 Cluster monitors

    執行監視功能

2.2 Ceph架構

在這裏插入圖片描述

2.2.1 三種接口文件
  • ① Object

    由原生的API,而且兼容Swift的S3和API

  • ② Block

    支持精簡配置、快照、克隆

  • ③ file

    posix接口,支持快照

2.3 Ceph 核心組件簡介
  • Monitor(監控):monitor在集羣中扮演管理者角色,負責響應客戶端請求返回具體數據的進程。一個Ceph集羣一般都有很多個OSD

    當Ceph集羣爲2個副本,至少需要2個OSD才能達到健康狀態

  • MGR:由於Monitor負載過大,採用MGR來輔助Monitor管理

  • OSD(存儲):負責響應客戶端請求返回具體數據的進程,一個ceph集羣有很多OSD

    OSD還能夠存儲數據、處理數據的複製、恢復、回填再均衡、並且通過檢查其他的OSD的守護進程的心跳,向monitor提供給一些監控信息

  • MDS(元數據):CephFS服務依賴的元數據服務,元數據的內存緩存,爲了加快元數據的訪問

  • Object:Ceph最底層的存儲單元是Object對象,每個Object包含元數據和原始數據

  • PG(Placement Groups),PG就是管理Object(對象)的容器

  • RADOS(Reliable Autonomic Distributed Object Store):RADOS在動態變化和異質結構的存儲設備機羣之上提供一種穩定、可擴展、高性能的單一邏輯對象(Object)存儲接口和能夠實現節點的自適應和自管理的存儲系統

  • Libradio

    Librados是Rados提供庫,因爲RADOS是協議很難直接訪問,因此上層的RBD、RGW和CephFS都是通過librados訪問的,目前提供PHP、Ruby、Java、Python、C和C++支持

  • Crush

    CRUSH是Ceph使用的數據分佈算法,類似一致性哈希,讓數據分配到預期的地方。

  • RGW

    RGW全稱RADOS gateway,是Ceph對外提供的對象存儲服務,接口與S3和Swift兼容。

  • CephFS

    CephFS全稱Ceph File System,是Ceph對外提供的文件系統服務

三、Ceph三種存儲類型

3.1 文件存儲
  • 典型設備

    FTP NFS服務器

  • 主要功能

    爲了克服塊存儲文件無法共享的問題,所以有了文件存儲,在服務器上架設FTP和NFS服務,就是文件存儲

  • 優缺點

    • 優點

      造價低、隨便一臺機器就可以

      方便文件共享

    • 缺點

      讀寫速率低

      傳輸速率慢

  • 使用場景

    日誌存儲、有目錄結構的文件存儲等等

3.2 塊存儲
  • 典型設備

    磁盤陣列、硬盤

  • 主要功能

    主要功能是將裸磁盤空間映射給主機使用

  • 優缺點

    • 優點

      通過RAID與LVM等手段,對數據提供了保護

      多塊廉價的硬盤組合起來,提高容量

      多塊磁盤組合出來的邏輯盤,提升讀寫效率

    • 缺點

      採用SAN架構組網時,光纖交換機造價成本高

      主機之間無法共享數據

  • 使用場景

    docker容器、虛擬機磁盤存儲分配

    日誌存儲、文件存儲等等

3.3 對象存儲
  • 典型設備

    內置大容量硬盤的分佈式服務器(Swift,s3)

  • 功能

    多臺服務器內置大容量硬盤,安裝上對象存儲管理軟件,對外提供讀寫訪問功能

  • 優點

    具備塊存儲的讀寫高速

    具備文件存儲的共享等特性

  • 使用場景(適合更新變動較少的數據)

    圖片存儲

    視頻存儲

3.4 分佈式文件系統比較

在這裏插入圖片描述

四、Ceph搭建

4.1 實驗環境
  • 此項實驗基於之前的OpenStack多節點部署的環境,OpenStack多節點部署可查看我之前的博客:

OpenStack多節點部署

  • 注意,在部署Ceph之前,必須把和存儲有關的數據清理乾淨(可在控制檯刪除),包括:

    安裝的實例

    上傳的鏡像

    cinder塊

4.2 ceph環境部署
  • 關閉所有節點的防火牆
[root@ct ~]# systemctl stop iptables
  • 在三個節點上部署本地源

    上傳openstack_rock2.tar.gz 到/opt目錄中

  • 解壓上傳的包

[root@ct ~]# tar zxvf openstack_rocky2.tar.gz -C /opt
  • 因爲此處上傳的文件和之前部署openstack的yum源的文件一致,所以直接清除緩存並重新創建緩存即可
[root@ct yum.repos.d]# yum clean all
[root@ct yum.repos.d]# yum makecache
4.3 Ceph集羣搭建
  • ① 在所有節點服務器上安裝Python-setuptools工具和ceph軟件
[root@ct ~]# yum install python-setuptools -y
[root@ct ~]# yum -y install ceph
  • ② 在控制節創建ceph配置文件目錄並安裝ceph-deploy
[root@ct ~]# mkdir -p /etc/ceph
[root@ct ~]# yum -y install ceph-deploy
  • ③ 在控制節點創建三個mon
[root@ct ~]# cd /etc/ceph/
[root@ct ceph]# ceph-deploy new ct c1 c2
......省略部分內容
[root@ct ceph]# more /etc/ceph/ceph.conf 
[global]
fsid = b65b3c32-7d1e-4e5f-b2f6-24072373c333
mon_initial_members = ct, c1, c2
mon_host = 192.168.100.10,192.168.100.11,192.168.100.12
auth_cluster_required = cephx
auth_service_required = cephx
auth_client_required = cephx
  • ④ 在控制節點初始化mon,同時收集三個節點的密鑰
[root@ct ceph]# ceph-deploy mon create-initial
......省略部分內容
[root@ct ceph]# ls
ceph.bootstrap-mds.keyring  ceph.conf
ceph.bootstrap-mgr.keyring  ceph-deploy-ceph.log
ceph.bootstrap-osd.keyring  ceph.mon.keyring
ceph.bootstrap-rgw.keyring  rbdmap
ceph.client.admin.keyring
  • ⑤ 在控制節點創建OSD
[root@ct ceph]# ceph-deploy osd create --data /dev/sdb ct
......省略部分內容
[root@ct ceph]# ceph-deploy osd create --data /dev/sdb c1
......省略部分內容
[root@ct ceph]# ceph-deploy osd create --data /dev/sdb c2
......省略部分內容
  • ⑥ 使用ceph-deploy下發配置文件和admin密鑰下發到三個節點
[root@ct ceph]# ceph-deploy admin ct c1 c2
[c2][DEBUG ] connected to host: c2 
[c2][DEBUG ] detect platform information from remote host
[c2][DEBUG ] detect machine type
[c2][DEBUG ] write cluster configuration to /etc/ceph/{cluster}.conf
...........省略部分內容
  • ⑦ 在所有節點上給keyring添加執行權限
[root@ct ceph]# chmod +x ceph.client.admin.keyring 
[root@c1 ceph]# chmod +x ceph.client.admin.keyring 
[root@c2 ceph]# chmod +x ceph.client.admin.keyring 
  • ⑧ 創建mgr管理服務
[root@ct ceph]# ceph-deploy mgr create ct c1 c2
[c2][INFO  ] Running command: ceph --cluster ceph --name client.bootstrap-mgr --keyring /var/lib/ceph/bootstrap-mgr/ceph.keyring auth get-or-create mgr.c2 mon allow profile mgr osd allow * mds allow * -o /var/lib/ceph/mgr/ceph-c2/keyring
[c2][INFO  ] Running command: systemctl enable ceph-mgr@c2
[c2][WARNIN] Created symlink from /etc/systemd/system/ceph-mgr.target.wants/[email protected] to /usr/lib/systemd/system/[email protected].
[c2][INFO  ] Running command: systemctl start ceph-mgr@c2
[c2][INFO  ] Running command: systemctl enable ceph.target
......省略部分內容
  • ⑨ 檢查ceph集羣狀態
[root@ct ceph]# ceph -s
  cluster:
    id:     b65b3c32-7d1e-4e5f-b2f6-24072373c333
    health: HEALTH_OK
 
  services:
    mon: 3 daemons, quorum ct,c1,c2
    mgr: ct(active), standbys: c2, c1
    osd: 3 osds: 3 up, 3 in
 
  data:
    pools:   0 pools, 0 pgs
    objects: 0  objects, 0 B
    usage:   3.0 GiB used, 3.0 TiB / 3.0 TiB avail
    pgs:   
  • ⑩ 創建三個與openstack對接的pools(volumes、vms、images)64(PG)
[root@ct ceph]# ceph osd pool create volumes 64
pool 'volumes' created
[root@ct ceph]# ceph osd pool create vms 64
pool 'vms' created
[root@ct ceph]# ceph osd pool create images 64
pool 'images' created
  • 最後查看ceph狀態
[root@ct ceph]# ceph mon stat
e1: 3 mons at {c1=192.168.100.11:6789/0,c2=192.168.100.12:6789/0,ct=192.168.100.10:6789/0}, election epoch 6, leader 0 ct, quorum 0,1,2 ct,c1,c2
[root@ct ceph]# ceph osd status
+----+------+-------+-------+--------+---------+--------+---------+-----------+
| id | host |  used | avail | wr ops | wr data | rd ops | rd data |   state   |
+----+------+-------+-------+--------+---------+--------+---------+-----------+
| 0  |  ct  | 1026M | 1022G |    0   |     0   |    0   |     0   | exists,up |
| 1  |  c1  | 1026M | 1022G |    0   |     0   |    0   |     0   | exists,up |
| 2  |  c2  | 1026M | 1022G |    0   |     0   |    0   |     0   | exists,up |
+----+------+-------+-------+--------+---------+--------+---------+-----------+
[root@ct ceph]# 
4.4 Ceph集羣管理頁面安裝
  • 前提:查詢Ceph狀態,不能出現error
  • 啓動dashboard模塊
[root@ct ceph]# ceph mgr module enable dashboard
  • 創建https證書
[root@ct ceph]# ceph dashboard create-self-signed-cert
Self-signed certificate created
  • 查看mgr服務
[root@ct ceph]# ceph mgr services
{
    "dashboard": "https://ct:8443/"
}
  • 設置密碼和賬號
#123密碼可以修改
[root@ct ceph]# ceph dashboard set-login-credentials admin 123
Username and password updated
  • 使用web頁面登錄查看

    訪問https://192.168.100.10:8443
    在這裏插入圖片描述

在這裏插入圖片描述

五、配置Ceph與OpenStack對接

5.1 Ceph與OpenStack對接環境部署
  • ① 在控制節點創建client.cinder並設置權限
[root@ct ceph]# ceph auth get-or-create client.cinder mon 'allow r' osd 'allow class-read object_prefix rbd_children,allow rwx pool=volumes,allow rwx pool=vms,allow rx pool=images'
[client.cinder]
        key = AQCawnRevBYQIBAAYySbtyd8+2NLnRhMlpdaCQ==
  • ② 在控制節點創建client.glance並設置權限
[root@ct ceph]# ceph auth get-or-create client.glance mon 'allow r' osd 'allow class-read object_prefix rbd_children,allow rwx pool=images'
[client.glance]
        key = AQDGwnRetqs2ABAAvsCsf7ys93L82emAqjzVRQ==
  • ③ 推送密鑰到對接的節點,因爲本實驗中glance是裝在控制節點的,所以不需要發送到其他的節點
[root@ct ~]# ceph auth get-or-create client.glance |tee /etc/ceph/ceph.client.glance.keyring 
[client.glance]
        key = AQDGwnRetqs2ABAAvsCsf7ys93L82emAqjzVRQ==
[root@ct ~]# chown  glance.glance /etc/ceph/ceph.client.glance.keyring
  • ④ 將client.cinder節點 因爲這個默認也是安裝在controller上 ,所以不需要傳遞到其他節點,如果在其他節點就執行第一條語
[root@ct ~]# ceph auth get-or-create client.cinder | tee /etc/ceph/ceph.client.cinder.keyring
[client.cinder]
        key = AQCawnRevBYQIBAAYySbtyd8+2NLnRhMlpdaCQ==
[root@ct ~]# chown  cinder.cinder /etc/ceph/ceph.client.cinder.keyring
  • ⑤ 同時將client.cinder 傳遞到計算節點
#由於計算節點需要將用戶的client.cinder用戶的密鑰文件存儲在libvirt中,所以需要執行如下操作
[root@ct ~]# ceph auth get-key client.cinder |ssh c1 tee client.cinder.key 
AQCawnRevBYQIBAAYySbtyd8+2NLnRhMlpdaCQ==
[root@ct ~]# ceph auth get-key client.cinder |ssh c2 tee client.cinder.key 
AQCawnRevBYQIBAAYySbtyd8+2NLnRhMlpdaCQ==
    
#在c1 和 c2兩個節點查看是否收到
[root@c1 ceph]# ls
ceph.client.admin.keyring  ceph.conf  rbdmap  tmpShIV0Z

[root@c2 ceph]# ls
ceph.client.admin.keyring  ceph.conf  rbdmap  tmpOYNw82
5.2 添加臨時密鑰到libvirt中
  • 在運行nova-compute的計算節點將臨時密鑰文件添加到libvirt 中然後刪除
  • 配置libvirt secret
  • KVM虛擬機需要使用librbd纔可以訪問ceph集羣
  • Librbd訪問ceph又需要賬戶認證
  • 因此在這裏,需要給libvirt設置賬戶信息
5.2.1 在C1節點配置
  • ① 生成UUID
[root@c1 ceph]# uuidgen
4a7e1428-c0ef-429a-8055-5ceb8baa1fbd
  • ② 創建密鑰文件(使用上一步生成的UUID)
[root@c1 ceph]# cd /root
[root@c1 ~]# vi secret.xml
[root@c1 ~]# cat secret.xml 
<secret ephemeral='no' private='no'>
<uuid>4a7e1428-c0ef-429a-8055-5ceb8baa1fbd</uuid>
<usage type='ceph'>
<name>client.cinder secret</name>
</usage>
</secret>
----》wq
  • ③ 定義密鑰,將其保存。在之後會使用這個密鑰
[root@c1 ~]# virsh secret-define --file secret.xml
Secret 4a7e1428-c0ef-429a-8055-5ceb8baa1fbd created
  • ④ 設置密鑰並刪除臨時文件,刪除文件的步驟是可選的,目的是保持系統的純淨
[root@c1 ~]# virsh secret-set-value --secret 4a7e1428-c0ef-429a-8055-5ceb8baa1fbd --base64 $(cat client.cinder.key) && rm -rf client.cinder.key secret.xml
Secret value set
5.2.2 在C2節點上配置
  • ① 創建密鑰文件
[root@c2 ceph]# cd /root
[root@c2 ~]# vi secret.xml
[root@c2 ~]# cat secret.xml 
<secret ephemeral='no' private='no'>
<uuid>4a7e1428-c0ef-429a-8055-5ceb8baa1fbd</uuid>
<usage type='ceph'>
<name>client.cinder secret</name>
</usage>
</secret>
------》wq
  • ② 定義祕鑰,並將其保存
[root@c2 ~]# virsh secret-define --file secret.xml
Secret 4a7e1428-c0ef-429a-8055-5ceb8baa1fbd created
  • ③ 設置祕鑰並刪除臨時文件
[root@c2 ~]# virsh secret-set-value --secret 4a7e1428-c0ef-429a-8055-5ceb8baa1fbd --base64 $(cat client.cinder.key) && rm -rf client.cinder.key secret.xml
Secret value set
  • ④ 在控制節點ct上開啓ceph監控
[root@ct ~]# ceph osd pool application enable vms mon
enabled application 'mon' on pool 'vms'
[root@ct ~]# ceph osd pool application enable images mon
enabled application 'mon' on pool 'images'
[root@ct ~]# ceph osd pool application enable volumes mon
enabled application 'mon' on pool 'volumes'
5.3 Ceph對接Glance
  • 登錄到glance所在的ct節點進行修改
  • ① 備份配置文件
[root@ct ~]# cp /etc/glance/glance-api.conf /etc/glance/glance-api.conf.bak
  • ② 修改對接配置文件
[root@ct ceph]# vi /etc/glance/glance-api.conf
#2054行,修改rbd格式(存儲類型)
原:stores=file,http,swift
修改:stores=rbd

#2108行 修改默認存儲格式
原:default_store=file
修改:default_store=rbd

#2442行 註釋鏡像本地存儲
#filesystem_store_datadir=/var/lib/glance/images/

#2605 取消註釋
rbd_store_chunk_size = 8

#2626 取消註釋
rbd_store_pool = images

#2645 取消註釋,指定用戶
原:rbd_store_user = <None>
修改:rbd_store_user = glance

#2664 取消註釋 ,確定Ceph路徑如下
rbd_store_ceph_conf = /etc/ceph/ceph.conf
-----》wq
  • ③ 查找glance用戶,對接上面
[root@ct ~]# source /root/keystonerc_admin
[root@ct ~(keystone_admin)]# openstack user list | grep glance
| 6122b6bddb9f41cebb9c69d6581f3513 | glance     |
  • ④ 重啓OpenStack-glance-api服務
[root@ct ~(keystone_admin)]# systemctl restart openstack-glance-api
  • ⑤ 上傳鏡像測試

在這裏插入圖片描述
在這裏插入圖片描述

#查看鏡像大小
[root@ct ~(keystone_admin)]# ceph df
GLOBAL:
    SIZE        AVAIL       RAW USED     %RAW USED 
    3.0 TiB     3.0 TiB      3.0 GiB          0.10 
POOLS:
    NAME        ID     USED       %USED     MAX AVAIL     OBJECTS 
    volumes     1         0 B         0       972 GiB           0 
    vms         2         0 B         0       972 GiB           0 
    images      3      13 MiB         0       972 GiB           8 
#13mib的鏡像上傳成功    

#查看鏡像
[root@ct ~(keystone_admin)]# rbd ls images
1e37a9ad-9eab-4e45-9bdc-a225ffb7c5c3
  • 確認本地是否還有其他鏡像
[root@ct ~(keystone_admin)]# ls /var/lib/glance/images
[root@ct ~(keystone_admin)]# 
#爲空是正常的
5.4 Ceph與cinder對接
  • ① 備份cinder.conf 配置文件並修改
[root@ct ceph(keystone_admin)]# cp /etc/cinder/cinder.conf /etc/cinder/cinder.conf.bak
[root@ct ceph(keystone_admin)]# vi /etc/cinder/cinder.conf
#409 修改
原:enabled_backends=lvm
修改:enabled_backends=ceph

#5261~5267 註釋掉
#[lvm]
#volume_backend_name=lvm
#volume_driver=cinder.volume.drivers.lvm.LVMVolumeDriver
#iscsi_ip_address=192.168.100.10
#iscsi_helper=lioadm
#volume_group=cinder-volumes
#volumes_dir=/var/lib/cinder/volumes
    
#在文末添加ceph段
default_volume_type= ceph
glance_api_version = 2
volume_driver = cinder.volume.drivers.rbd.RBDDriver
volume_backend_name = ceph
rbd_pool = volumes 
rbd_ceph_conf = /etc/ceph/ceph.conf
rbd_flatten_volume_from_snapshot = false 
rbd_max_clone_depth = 5
rbd_store_chunk_size = 4
rados_connect_timeout = -1
rbd_user = cinder
rbd_secret_uuid = 4a7e1428-c0ef-429a-8055-5ceb8baa1fbd
#以上UUID使用的是之前的
  • ② 重啓cinder服務
[root@ct ~(keystone_admin)]# systemctl restart openstack-cinder-volume
[root@ct ~(keystone_admin)]# 
  • ③ 查看cinder卷的類型有幾個
root@ct ~(keystone_admin)]# cinder type-list
+--------------------------------------+-------+-------------+-----------+
| ID                                   | Name  | Description | Is_Public |
+--------------------------------------+-------+-------------+-----------+
| e518fc11-56c6-4b44-bed6-a1b7933063eb | iscsi | -           | True      |
+--------------------------------------+-------+-------------+-----------+
[root@ct ~(keystone_admin)]# 
  • ④ 命令行創建cinder的ceph存儲後端相應的type
[root@ct ~(keystone_admin)]# cinder type-list
+--------------------------------------+-------+-------------+-----------+
| ID                                   | Name  | Description | Is_Public |
+--------------------------------------+-------+-------------+-----------+
| e518fc11-56c6-4b44-bed6-a1b7933063eb | iscsi | -           | True      |
+--------------------------------------+-------+-------------+-----------+
[root@ct ~(keystone_admin)]# cinder type-create  ceph
+--------------------------------------+------+-------------+-----------+
| ID                                   | Name | Description | Is_Public |
+--------------------------------------+------+-------------+-----------+
| 6c9242f1-5c57-4d37-b7b9-b7f9d9ab5ddd | ceph | -           | True      |
+--------------------------------------+------+-------------+-----------+
  • ⑤ 創建卷

在這裏插入圖片描述

在這裏插入圖片描述

  • ⑥ 查看創建的卷
[root@ct ~(keystone_admin)]# ceph osd lspools
1 volumes
2 vms
3 images
[root@ct ~(keystone_admin)]# rbd ls volumes
volume-6f366040-a1e2-4933-85d4-c4271cede498
  • ⑦ 開啓cinder服務
[root@ct ~(keystone_admin)]# systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
[root@ct ~(keystone_admin)]# systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service
5.5 Ceph與Nova對接
  • ① 備份配置文件(C1 、C2節點)
[root@c1 ~]# cp /etc/nova/nova.conf /etc/nova/nova.conf.bak
[root@c1 ~]# cp /etc/nova/nova.conf /etc/nova/nova.conf.bak
  • ② 修改配置文件(C1、C2節點)

    僅展示C1節點

[root@c1 ~]# vi /etc/nova/nova.conf
#6932行 取消註釋,添加硬盤緩存模式
原:#disk_cachemodes =
修改:disk_cachemodes ="network=writeback"

#7072行 取消註釋,修改爲rbd格式
原:#images_type=default
修改:images_type=rbd

#7096行 取消註釋,修改爲vms
原:#images_rbd_pool=rbd
修改:images_rbd_pool=vms

#7099行 取消註釋、添加ceph的配置文件路徑
原:#images_rbd_ceph_conf =
修改:images_rbd_ceph_conf = /etc/ceph/ceph.conf

#7256行 取消註釋、添加cinder
原:#rbd_user=<None>
修改:rbd_user=cinder

#7261行 取消註釋、添加UUID
原:#rbd_secret_uuid=<None>
修改:rbd_secret_uuid=4a7e1428-c0ef-429a-8055-5ceb8baa1fbd

#搜索live_migration(593行),在此行附近添加以下內容(是否啓用熱遷移)
live_migration_flag="VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_PERSIST_DEST,VIR_MIGRATE_TUNNELLED"

#7114 取消註釋、添加unmap
:#hw_disk_discard=<None>
修改:hw_disk_discard=unmap
  • ③ 在倆個計算節點安裝Libvirt
[root@c1 ~]# yum -y install libvirt
[root@c2 ~]# yum -y install libvirt
  • ④ 編輯兩個計算節點
[root@c1 ~]# vi /etc/ceph/ceph.conf 
#在行尾添加以下內容
[client]
rbd cache=true
rbd cache writethrough until flush=true
admin socket = /var/run/ceph/guests/$cluster-$type.$id.$pid.$cctid.asok
log file = /var/log/qemu/qemu-guest-$pid.log
rbd concurrent management ops = 20
---->wq
  • ⑤ 創建配置文件目錄和權限
[root@c1 ~]# mkdir -p /var/run/ceph/guests/ /var/log/qemu/
[root@c1 ~]# chown 777 -R /var/run/ceph/guests/ /var/log/qemu/
  • ⑥ 將控制節點的/ect/ceph/下的密鑰複製到兩個計算節點
[root@ct ~(keystone_admin)]# cd /etc/ceph/
[root@ct ceph(keystone_admin)]# scp ceph.client.cinder.keyring root@c1:/etc/ceph
ceph.client.cinder.keyring            100%   64    24.2KB/s   00:00    
[root@ct ceph(keystone_admin)]# scp ceph.client.cinder.keyring root@c2:/etc/ceph
ceph.client.cinder.keyring            100%   64    27.1KB/s   00:00    
  • ⑦ 兩個計算節點重啓服務
[root@c1 ~]# systemctl restart libvirtd
[root@c1 ~]# systemctl enable libvirtd
[root@c1 ~]# systemctl restart openstack-nova-compute

以上,OpenStack----多節點部署Ceph文件系統實驗完成~,之後可以根據需求創建實例進行測試

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章