這篇文章主要介紹 分布式存儲(chǔ)Ceph的安裝方法有哪些,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!
南昌ssl適用于網(wǎng)站、小程序/APP、API接口等需要進(jìn)行數(shù)據(jù)傳輸應(yīng)用場(chǎng)景,ssl證書(shū)未來(lái)市場(chǎng)廣闊!成為創(chuàng)新互聯(lián)公司的ssl證書(shū)銷售渠道,可以享受市場(chǎng)價(jià)格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:18982081108(備注:SSL證書(shū)合作)期待與您的合作!
一、源碼安裝
說(shuō)明:源碼安裝可以了解到系統(tǒng)各個(gè)組件, 但是安裝過(guò)程也是很費(fèi)勁的,主要是依賴包太多。 當(dāng)時(shí)嘗試了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 可能遇到錯(cuò)誤
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
資源:
兩臺(tái)機(jī)器:一臺(tái)server,一臺(tái)client,安裝ubuntu12.04
其中,server安裝時(shí),另外分出兩個(gè)區(qū),作為osd0、osd1的存儲(chǔ),沒(méi)有的話,系統(tǒng)安裝好后,使用loop設(shè)備虛擬出兩個(gè)也可以。
1 、服務(wù)端安裝 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信息
如果沒(méi)有顯示,請(qǐng)執(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、啟動(dòng)
service ceph -a start
7、執(zhí)行健康檢查
ceph health
8、磁盤用 ext4 出現(xiàn) mount 5 錯(cuò)誤
后來(lái)用
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
遇錯(cuò)提示沒(méi)有keyring則執(zhí)行:
ceph-deploy forgetkeys
會(huì)生成
{cluster-name}.client.admin.keyring
{cluster-name}.bootstrap-osd.keyring
{cluster-name}.bootstrap-mds.keyring
7、
ceph-deploy osd create ubuntu1:/dev/sdb1 (磁盤路徑)
可能遇到錯(cuò):
1、磁盤已經(jīng)掛載,用umount
2、磁盤格式化問(wèn)題,用fdisk分區(qū), mkfs.xfs -f /dev/sdb1 格式化
8、
ceph -s
可能遇到錯(cuò)誤:
提示沒(méi)有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、多臺(tái)機(jī)器之間要添加ssh 無(wú)密碼認(rèn)證 ssh-keygen
2、最好有單獨(dú)的磁盤分區(qū)做存儲(chǔ),格式化也有幾種不同方式
3、總會(huì)遇到各種錯(cuò)誤。 只能單獨(dú)分析,解決
ceph-deploy forgetkeys
以上是“ 分布式存儲(chǔ)Ceph的安裝方法有哪些”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!