集羣規模: 1個monitor , 2個osd 機器shell
monitor—| _172.16.x.x (ip2,10.1.x.x/24) ceph01
|---- osd1 _172.16.x.x (ip2,10.1.x.x/24) ceph02
|---- osd2 _172.16.x.x (ip2,10.1.x.x/24) ceph03
1、準備工做
全部節點更新系統,安裝ceph-deploy
sudo yum update && sudo yum install ceph-deploy
全部節點安裝ntp,ssh
sudo yum install ntp ntpdate ntp-doc
sudo yum install openssh-servercentos
ceph管理機必須以普通用戶登錄全部權限,因此ceph用戶要擁有無密碼的sudo權限
1>建立ceph普通用戶
ansible all-m shell -a 'useradd ceph && echo "ceph" | passwd --stdin ceph'
2>確保節點擁有sudo權限
echo "ceph ALL = (root) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/ceph
sudo chmod 0440 /etc/sudoers.d/ceph
3>生成Ceph用戶的key,併到各機器免密
ssh-copy-id ceph@ceph01
ssh-copy-id ceph@ceph02
ssh-copy-id ceph@ceph03ssh
4>ceph的 config文件,保證config 權限爲600,保證能夠ssh ceph01 ceph02 ceph03
/home/ceph/.ssh && touch config && chmod 600 ./configide
5>全部防火牆所有關掉
ansible all -m shell -a "systemctl disabled firewalld && systemctl stop firewalld && setenforce 0"
6>centos上安裝yum-plugin
yum install yum-plugin-priorities
二、ceph-cluster安裝
1>建立目錄,進入到實施目錄my-cluster
su ceph && cd && mkdir my-cluster && cd my-cluster
2>建立集羣,執行如下命令會生成三個文件(ceph配置文件、monitor 密鑰、日誌文件)
ceph-deploy new ceph01
3>修改默認複本數量\網卡
osd pool default size = 2
public network = 172.16.x.0/24 對外提供訪問
cluster network = 10.1.x.0/24 內部心跳線
4>安裝ceph
ceph-deploy install ceph01 ceph02 ceph03
5>配置初始 monitor(s)、並收集全部密鑰,並收集
ceph-deploy mon create-initial
ceph-deploy gatherkeys ceph01
6>查看節點磁盤,並初始化全部節點磁盤
ceph-deploy disk list ceph02
ceph-deploy disk zap cehp02:sdb
七、激活osd
ceph-disk activate-all
或者在部署機上執行,全部osd 節點都要執行,保證能夠正常加入集羣日誌
ceph-deploy osd prepare ceph02:/dev/sdb:/dev/sdc
ceph-deploy osd activate ceph02:/dev/sdb1:/dev/sdc1server
八、集羣狀態blog