溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

docker中如何安裝ceph rbd客戶端

發(fā)布時(shí)間:2021-11-19 11:44:44 來源:億速云 閱讀:249 作者:小新 欄目:開發(fā)技術(shù)

這篇文章主要介紹docker中如何安裝ceph rbd客戶端,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!

ceph rbd客戶端要求

客戶端系統(tǒng)內(nèi)核 2.6.32以上

另外,我這個(gè)環(huán)境中把k9s-master1當(dāng)做ceph客戶端,而服務(wù)端是k8s-node1。

安裝ceph rbd客戶端

[root@k8s-master1 ~]# yum search ceph
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.aliyun.com
========================================================= N/S matched: ceph =========================================================
centos-release-ceph-hammer.noarch : Ceph Hammer packages from the CentOS Storage SIG repository
centos-release-ceph-jewel.noarch : Ceph Jewel packages from the CentOS Storage SIG repository
centos-release-ceph-luminous.noarch : Ceph Luminous packages from the CentOS Storage SIG repository
ceph-common.x86_64 : Ceph Common
[root@k8s-master1 ~]# yum -y install centos-release-ceph-luminous.noarch
[root@k8s-master1 ~]# yum -y install ceph

將ceph服務(wù)端的秘鑰環(huán)拷貝到ceph的客戶端

    生產(chǎn)中不要拷貝秘鑰環(huán),而是創(chuàng)建一個(gè)用戶,并賦予相應(yīng)的權(quán)限。

    我這里拷貝秘鑰環(huán)是為了方便。

    登錄ceph服務(wù)器集群中的任何一點(diǎn),將其秘鑰環(huán)拷貝到ceph的客戶端。

[root@k8s-node1 ~]# cd /etc/ceph/
[root@k8s-node1 ceph]# scp ceph.conf 172.16.22.197:/etc/ceph/
[root@k8s-node1 ceph]# scp ceph.client.admin.keyring 172.16.22.197:/etc/ceph/

在ceph客戶端查看rbd

[root@k8s-master1 ~]# rbd --image data info
rbd image 'data':
size 1024 MB in 256 objects
order 22 (4096 kB objects)
block_name_prefix: rbd_data.1149238e1f29
format: 2
features: layering, exclusive-lock, object-map, fast-diff, deep-flatten
flags:

    輸出如上信息,表明我們可以使用rbd。

映射rbd到客戶端并且掛載使用 

    映射rbd到客戶端并且掛載使用 rbd map  rbd/data 

[root@k8s-master1 ~]# rbd map rbd/data  ##rbd是pool的名字,data是塊存儲(chǔ)的名字
rbd: sysfs write failed
RBD image feature set mismatch. Try disabling features unsupported by the kernel with "rbd feature disable".
In some cases useful info is found in syslog - try "dmesg | tail".
rbd: map failed: (6) No such device or address

    看到上面報(bào)錯(cuò)了,我們需要執(zhí)行一下如下命令:

[root@k8s-master1 ~]# rbd  feature disable   rbd/data   exclusive-lock object-map fast-diff deep-flatten
[root@k8s-master1 ~]# rbd map rbd/data 
/dev/rbd0
[root@k8s-master1 ~]# fdisk -l
Disk /dev/rbd0: 1073 MB, 1073741824 bytes, 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 4194304 bytes / 4194304 bytes

    看到,我們把ceph的rdb塊設(shè)備掛載到了k9s-master1機(jī)器上了。

    這時(shí)候,/dev/rdb0還是一個(gè)裸設(shè)備,下面我們格式化一下它,給它創(chuàng)建一個(gè)文件系統(tǒng)。

[root@k8s-master1 ~]# mkfs.ext4 /dev/rbd0

    掛載到/mnt下面:

[root@k8s-master1 ~]# mount /dev/rbd0 /mnt/

    這樣,我們就可以使用rbd塊設(shè)備了。

以上是“docker中如何安裝ceph rbd客戶端”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注億速云行業(yè)資訊頻道!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI