​CentOS 6.5 安裝 CEPH

來源:互聯網
上載者:User

標籤:linux   主機   Distributed File System   ceph   cloudstack   

CentOS 6.5 安裝 CEPH


一、介紹

Ceph是一個 Linux PB 級Distributed File System。

二、實驗環境
節點    IP    主機名稱    系統版本
MON    10.57.1.110    Ceph-mon0    CentOS 6.5 x64
MDS    10.57.1.110    Ceph-mds0    CentOS 6.5 x64
OSD0    10.57.1.111    Ceph-osd0    CentOS 6.5 x64
OSD1    10.57.1.111    Ceph-osd1    CentOS 6.5 x64
CLIENT0    10.57.1.112    Ceph-client0    CentOS 7.0 x64

三、安裝步驟
1、建立實驗機器SSH互信關係
產生密鑰
ssh-keygen -t rsa -P ‘‘
ssh-keygen -t rsa -f .ssh/id_rsa -P ‘‘
向被授權的主機上拷貝
ssh-copy-id -i .ssh/id_rsa.pub [email protected]主機
配置所有主機時間同步(不詳述)
2、每台機器添加hosts解析
echo ‘10.57.1.110 ceph-mon0’ >> /etc/hosts
echo ‘10.57.1.110 ceph-mds0’ >> /etc/hosts
echo ‘10.57.1.111 ceph-osd0’ >> /etc/hosts
echo ‘10.57.1.111 ceph-osd1’ >> /etc/hosts
echo ‘10.57.1.112 ceph-client0’ >> /etc/hosts
3、同步到/etc/中,(適用於mon,mds,osd,client)

4、yum更新,安裝相關依賴包(適用於mon,mds,osd)
rpm --import ‘https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/release.asc‘
rpm -Uvh http://mirrors.yun-idc.com/epel/6/i386/epel-release-6-8.noarch.rpm
yum install snappy leveldb gdisk python-argparse gperftools-libs -y
rpm -Uvh http://ceph.com/rpm-dumpling/el6/noarch/ceph-release-1-0.el6.noarch.rpm
yum install ceph-deploy python-pushy -y
yum install ceph -y
yum install btrfs-progs (適用於所有osd)
5、版本
ceph version 0.67.9
6、配置/etc/ceph/ceph.conf,(適用於mon,mds,osd)
[global]
public network = 10.57.1.0/24
pid file = /var/run/ceph/$name.pid
auth cluster required = none
auth service required = none
auth client required = none
keyring = /etc/ceph/keyring.$name
osd pool default size = 1
osd pool default min size = 1
osd pool default crush rule = 0
osd crush chooseleaf type = 1
[mon]
mon data = /var/lib/ceph/mon/$name
mon clock drift allowed = .15
keyring = /etc/ceph/keyring.$name
[mon.0]
host = ceph-mon0
mon addr = 10.57.1.110:6789
[mds]
keyring = /etc/ceph/keyring.$name
[mds.0]
host = ceph-mds0
[osd]
osd data = /mnt/osd$id
osd recovery max active = 5
osd mkfs type = xfs
osd journal = /mnt/osd$id/journal
osd journal size = 1000
keyring = /etc/ceph/keyring.$name
[osd.0]
host = ceph-osd0
devs = /dev/vdb1
[osd.1]
host = ceph-osd1
devs = /dev/vdb2
7、啟動ceph(在mon上執行)
初始化:mkcephfs -a -c /etc/ceph/ceph.conf
/etc/init.d/ceph -a start
8、執行健全狀態檢查
ceph health #也可以使用ceph -s命令查看狀態
如果返回的是HEALTH_OK,則代表成功!
9、掛載ceph
ceph-fuse -m 10.57.1.110:6789 /mnt/
如以下提示則表示掛載成功:
ceph-fuse[2010]: starting ceph client
ceph-fuse[2010]: starting fuse
10、進階篇
10.1、增加OSD
這裡在10.57.1.110上新增兩塊磁碟/dev/vdb1,/dev/vdb2,
設定檔新增
[osd.2]
host = ceph-osd2
devs = /dev/vdb1
[osd.3]
host = ceph-osd3
devs = /dev/vdb2

手工複製設定檔到另一台機器保持,所有節點配置同步
cd /etc/ceph; scp keyring.client.admin ceph.conf 10.57.1.111:/etc/ceph/

以下操作都在新增OSD節點上操作
初始化新增osd節點,需要在新增的節點機器上運行,這裡在10.2.180.180上運行
ceph-osd -i 2 --mkfs --mkkey; ceph-osd -i 3 --mkfs --mkkey;
加入節點
ceph auth add osd.2 osd ‘allow *‘ mon ‘allow rwx‘ -i /etc/ceph/keyring.osd.2;
ceph auth add osd.3 osd ‘allow *‘ mon ‘allow rwx‘ -i /etc/ceph/keyring.osd.3;
ceph osd create #added key for osd.2
ceph osd create #added key for osd.3
/etc/init.d/ceph -a start osd.2 #啟動osd.2
/etc/init.d/ceph -a start osd.3 #啟動osd.3

ceph -s #查看狀態
ceph auth list #能查看所有認證節點

10.2、增加MDS
增加10.57.1.111 MDS到節點
增加以下hosts記錄,並同步到節點
echo ‘10.57.1.111 ceph-mds1‘ >> /etc/hosts
將以下配置增加到設定檔,並同步到節點
[mds.1]
host = ceph-mds1
以下操作都在新增OSD節點上操作
產生key
ceph-authtool --create-keyring --gen-key -n mds.1 /etc/ceph/keyring.mds.1
加入認證
ceph auth add mds.1 osd ‘allow *‘ mon ‘allow rwx‘ mds ‘allow‘ -i /etc/ceph/keyring.mds.1
啟動新增MDS
/etc/init.d/ceph -a start mds.1

10.3、增加MON
增加10.57.1.111 MDS到節點
增加以下hosts記錄,並同步到節點
echo ‘10.57.1.111 ceph-mon1‘ >> /etc/hosts
將以下配置增加到設定檔,並同步到節點
[mon.1]
host = ceph-mon1
mon addr = 10.57.1.111:6789

匯出key及mon map
mkdir /tmp/ceph
ceph auth get mon. -o /tmp/ceph/keyring.mon
ceph mon getmap -o /tmp/ceph/monmap

初始化新mon
ceph-mon -i 1 --mkfs --monmap /tmp/ceph/monmap --keyring /tmp/ceph/keyring.mon

啟動新mon
ceph-mon -i 1 --public-addr 10.57.1.111:6789

加入quorum votes
ceph mon add 1 10.57.1.111:6789


本文出自 “往事隨風” 部落格,謝絕轉載!

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.