CentOS 7 x64 安裝 Ceph

來源:互聯網
上載者:User

標籤:ceph

CentOS 7  x64 安裝 Ceph



二, 實驗環境


節點            IP                 主機名稱                  系統


MON         172.24.0.13           ceph-mon0             CentOS 7 X64

MDS         172.24.0.13           ceph-mds0             CentOS 7 X64

OSD0        172.24.0.14           ceph-osd0             CentOS 7 X64  

OSD1        172.24.0.14           ceph-osd1             CentOS 7 X64



client      



三、安裝步驟


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]主機


--------------------------------------------------------

ssh-copy-id -i .ssh/id_rsa.pub [email protected] 

ssh-copy-id -i .ssh/id_rsa.pub [email protected]

--------------------------------------------------------



配置所有主機時間同步


安裝ntpdate

yum -y install ntpdate


開始同步時間

ntpdate time.windows.com 



修改每台機器的主機名稱 (hostname)  ( mon,mds,osd,client 都必須設定 )

------------------------------------------------------------------------------------

echo 172.24.0.13 ceph-mon0 >> /etc/hosts

echo 172.24.0.13 ceph-mds0 >> /etc/hosts

echo 172.24.0.14 ceph-osd0 >> /etc/hosts

echo 172.24.0.14 ceph-osd1 >> /etc/hosts

------------------------------------------------------------------------------------



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/7/x86_64/e/epel-release-7-5.noarch.rpm

yum install snappy leveldb gdisk python-argparse gperftools-libs -y

rpm -Uvh http://ceph.com/rpm-dumpling/el7/noarch/ceph-release-1-0.el7.centos.noarch.rpm

yum install ceph-deploy -y

yum install ceph -y


yum install btrfs-progs           (適用於所有osd)

-------------------------------------------------------------------------------------



配置/etc/ceph/ceph.conf,  (適用於mon,mds,osd)


vi /etc/ceph/ceph.conf


------------------------------------------------------------------------------------------------

[global]

public network = 172.24.0.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 = 172.24.0.13: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/mapper/centos-osd0

[osd.1]

host = ceph-osd1

devs = /dev/mapper/centos-osd1

----------------------------------------------------------------------------------------------------


建立目錄 ( osd )


mkdir /mnt/osd0 

mkdir /mnt/osd1




啟動ceph(在mon上執行)


初始化:

mkcephfs -a -c /etc/ceph/ceph.conf 

/etc/init.d/ceph -a start



( #遇到 Error ENOENT: osd.0 does not exist.  create it before updating the crush map ) 執行如下代碼:


ceph osd create


然後在執行   /etc/init.d/ceph -a start       既可完成





執行健全狀態檢查

ceph health      #也可以使用ceph -s命令查看狀態  (如果返回的是HEALTH_OK,則代表成功!)



掛載ceph  (172.24.0.15 為用戶端)


mon推薦有至少3個,假如掛掉一個、服務也能正常使用


client0的CentOS7預設沒有開啟ceph_fs的核心,需要更改核心,這裡直接用yum更新(可以手工編譯)


使用elrepo提供的, 已經編譯好的核心


rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm

yum install -y yum-plugin-fastestmirror

yum --enablerepo=elrepo-kernel install kernel-ml kernel-ml-devel

grub2-set-default 0

reboot 重啟伺服器


mkdir /opt/ceph 

1.  ceph-fuse -m 172.24.0.13:6789 /opt/ceph 


2.  mount -t ceph 172.24.0.13:6789/ /opt/ceph


#這裡的密鑰,是mon /etc/ceph/ keyring.client.admin 中的內容。


多個 mon 可使用,號分開 如:ceph-fuse -m 172.24.0.13:6789,172.24.0.14:6789,172.24.0.15:6789 /opt/ceph


CentOS 7 x64 安裝 Ceph

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.