分布式存儲Ceph的安裝方法有哪些

這篇文章主要介紹 分布式存儲Ceph的安裝方法有哪些,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!

南昌ssl適用于網(wǎng)站、小程序/APP、API接口等需要進行數(shù)據(jù)傳輸應用場景,ssl證書未來市場廣闊!成為創(chuàng)新互聯(lián)公司的ssl證書銷售渠道,可以享受市場價格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:18982081108(備注:SSL證書合作)期待與您的合作!

一、源碼安裝

說明:源碼安裝可以了解到系統(tǒng)各個組件, 但是安裝過程也是很費勁的,主要是依賴包太多。 當時嘗試了centos 和 ubuntu 上安裝,都是可以安裝好的。

1下載ceph    http://ceph.com/download/

wget http://ceph.com/download/ceph-0.72.tar.gz


 


 

2 安裝編譯工具apt-get install automake autoconf automake libtool make


 

3 解壓

#tar zxvf   ceph-0.72.tar.gz 
#cd   ceph-0.72.tar.gz 
#./autogen.sh

4、

先安裝依賴包

#apt-get install autotools-dev autoconf automake cdbs g++ gcc git libatomic-ops-dev libboost-dev \
libcrypto++-dev libcrypto++ libedit-dev libexpat1-dev libfcgi-dev libfuse-dev \
libgoogle-perftools-dev libgtkmm-2.4-dev libtool pkg-config uuid-dev libkeyutils-dev \
uuid-dev libkeyutils-dev  btrfs-tools

4 可能遇到錯誤


 

4.1 fuse:

apt-get install fuse-devel


 

4.2 tcmalloc:

wget   https://gperftools.googlecode.com/files/gperftools-2.1.zip

安裝google-perftools


4.3 libedit:

   apt-get   install   libedit  -devel


 

4.4 no libatomic-ops found

apt-get   install libatomic_ops-devel


 

4.5 snappy:

https://snappy.googlecode.com/files/snappy-1.1.1.tar.gz


 

4.6 libleveldb not found:

https://leveldb.googlecode.com/files/leveldb-1.14.0.tar.gz

make

 cp libleveldb.* /usr/lib

cp -r include/leveldb   /usr/local/include


 

4.7 libaio

apt-get install libaio-dev


 

4.8 boost

apt-get install libboost-dev

apt-get install libboost-thread-dev

apt-get install   libboost-program-options-dev


 

4.9 g++

apt-get install g++

5 編譯安裝

#./configure –prefix=/opt/ceph/
#make
#make install


 


 


二、使用ubuntn 12.04自帶的ceph 版本可能是ceph version 0.41

資源:

兩臺機器:一臺server,一臺client,安裝ubuntu12.04

其中,server安裝時,另外分出兩個區(qū),作為osd0、osd1的存儲,沒有的話,系統(tǒng)安裝好后,使用loop設備虛擬出兩個也可以。

1 、服務端安裝 CEPH  (MON 、 MDS 、 OSD)

apt-cache search ceph

apt-get install ceph

apt-get install ceph-common

2、添加key到APT中,更新sources.list,安裝ceph

wget -q -O- 'https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/release.asc' | sudo apt-key add -

echo deb http://ceph.com/debian/ $(lsb_release -sc) main | sudo tee /etc/apt/sources.list.d/ceph.list

apt-get update && sudo apt-get install ceph

3、查看版本

# ceph-v  //將顯示ceph的版本和key信息

如果沒有顯示,請執(zhí)行如下命令

# sudo apt-get update && apt-get upgrade

4、配置文件

# vim /etc/ceph/ceph.conf


 

[global] 

    # For version 0.55 and beyond, you must explicitly enable  

    # or disable authentication with "auth" entries in [global]. 

    auth cluster required = none 

    auth service required = none 

    auth client required = none 

[osd] 

    osd journal size = 1000 

    #The following assumes ext4 filesystem. 

    filestore xattr use omap = true 

    # For Bobtail (v 0.56) and subsequent versions, you may  

    # add settings for mkcephfs so that it will create and mount 

    # the file system on a particular OSD for you. Remove the comment `#`  

    # character for the following settings and replace the values  

    # in braces with appropriate values, or leave the following settings  

    # commented out to accept the default values. You must specify the  

    # --mkfs option with mkcephfs in order for the deployment script to  

    # utilize the following settings, and you must define the 'devs' 

    # option for each osd instance; see below. 

    osd mkfs type = xfs 

    osd mkfs options xfs = -f   # default for xfs is "-f"    

    osd mount options xfs = rw,noatime # default mount option is "rw,noatime" 

    # For example, for ext4, the mount option might look like this: 

    #osd mkfs options ext4 = user_xattr,rw,noatime 

    # Execute $ hostname to retrieve the name of your host, 

    # and replace {hostname} with the name of your host. 

    # For the monitor, replace {ip-address} with the IP 

    # address of your host. 

[mon.a] 

    host = ceph2 

    mon addr = 192.168.1.1:6789 

[osd.0] 

    host = ceph2 

    # For Bobtail (v 0.56) and subsequent versions, you may  

    # add settings for mkcephfs so that it will create and mount 

    # the file system on a particular OSD for you. Remove the comment `#`  

    # character for the following setting for each OSD and specify  

    # a path to the device if you use mkcephfs with the --mkfs option. 

    devs = /dev/sdb1 

[mds.a] 

    host = ceph2 

5、執(zhí)行初始化

sudo mkcephfs -a -c /etc/ceph/ceph.conf -k /etc/ceph/ceph.keyring

注意每次初始化 需要 刪除原有 數(shù)據(jù) 目錄 

rm –rf /var/lib/ceph/osd/ceph-0/*

rm –rf /var/lib/ceph/osd/ceph-1/*

rm –rf /var/lib/ceph/mon/ceph-a/*

rm –rf /var/lib/ceph/mds/ceph-a/*


 

mkdir -p /var/lib/ceph/osd/ceph-0

mkdir -p /var/lib/ceph/osd/ceph-1

mkdir -p /var/lib/ceph/mon/ceph-a

mkdir -p /var/lib/ceph/mds/ceph-a

6、啟動 

service ceph -a start

7、執(zhí)行健康檢查

 ceph health

8、磁盤用 ext4 出現(xiàn) mount 5 錯誤

后來用

mkfs.xfs  -f /dev/sda7

就 好了。 


 

9、在客戶端上操作:

sudo mkdir /mnt/mycephfs

sudo mount -t ceph {ip-address-of-monitor}:6789:/ /mnt/mycephfs


 

三、ceph-deploy安裝

1、下載


 

https://github.com/ceph/ceph-deploy/archive/master.zip


 

2、

apt-get install python-virtualenv

 ./bootstrap 

3、

ceph-deploy install ubuntu1

4、

ceph-deploy new ubuntu1

5、

ceph-deploy mon create ubuntu1

6、

ceph-deploy gatherkeys

遇錯提示沒有keyring則執(zhí)行:

ceph-deploy forgetkeys

會生成

{cluster-name}.client.admin.keyring

{cluster-name}.bootstrap-osd.keyring

{cluster-name}.bootstrap-mds.keyring

7、

ceph-deploy osd create ubuntu1:/dev/sdb1 (磁盤路徑)

可能遇到錯:

1、磁盤已經(jīng)掛載,用umount

2、磁盤格式化問題,用fdisk分區(qū),  mkfs.xfs -f /dev/sdb1 格式化

8、

ceph -s

可能遇到錯誤:

提示沒有osd

 health HEALTH_ERR 192 pgs stuck inactive; 192 pgs stuck unclean; no osds

則執(zhí)行ceph osd create


 

9、

    cluster faf5e4ae-65ff-4c95-ad86-f1b7cbff8c9a

     health HEALTH_WARN 192 pgs degraded; 192 pgs stuck unclean

     monmap e1: 1 mons at {ubuntu1=12.0.0.115:6789/0}, election epoch 1, quorum 0 ubuntu1

     osdmap e10: 3 osds: 1 up, 1 in

      pgmap v17: 192 pgs, 3 pools, 0 bytes data, 0 objects

            1058 MB used, 7122 MB / 8181 MB avail

                 192 active+degraded


 

10、客戶端掛摘

注意:需要用用戶名及密碼掛載

10.1查看密碼

cat /etc/ceph/ceph.client.admin.keyring 

ceph-authtool --print-key ceph.client.admin.keyring

AQDNE4xSyN1WIRAApD1H/glMB5VSLwmmnt7UDw==

10.2掛載 


 

其他:

1、多臺機器之間要添加ssh 無密碼認證 ssh-keygen

2、最好有單獨的磁盤分區(qū)做存儲,格式化也有幾種不同方式

3、總會遇到各種錯誤。 只能單獨分析,解決

ceph-deploy forgetkeys

以上是“ 分布式存儲Ceph的安裝方法有哪些”這篇文章的所有內容,感謝各位的閱讀!希望分享的內容對大家有幫助,更多相關知識,歡迎關注創(chuàng)新互聯(lián)行業(yè)資訊頻道!

新聞標題:分布式存儲Ceph的安裝方法有哪些
本文來源:http://bm7419.com/article44/pscdhe.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供電子商務、標簽優(yōu)化、網(wǎng)站策劃、服務器托管、網(wǎng)站維護全網(wǎng)營銷推廣

廣告

聲明:本網(wǎng)站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

小程序開發(fā)