1.5 添加ceph用户(所有节点)
1、在各 Ceph 节点创建新用户
root@ceph0:~# sudo useradd -d /home/ceph -m ceph
2、确保各 Ceph 节点上新创建的用户都有 sudo 权限
root@ceph0:~# echo "ceph ALL = (root) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/ceph
ceph ALL = (root) NOPASSWD:ALL
root@ceph0:~# sudo chmod 0440 /etc/sudoers.d/ceph
1.6 添加ceph安装源(所有节点)
注:建议直接写国内源,安装会比较快,填写初始源的话速度比较慢超过300秒后安装不成功。
国内源
wget -q -O- 'http://mirrors.163.com/ceph/keys/release.asc' > test.asc | sudo apt-key add -
echo deb http://mirrors.163.com/ceph/debian-jewel/ $(lsb_release -sc) main | sudo tee /etc/apt/sources.list.d/ceph.list
初始源
wget -q -O- 'https://download.ceph.com/keys/release.asc'
echo deb https://download.ceph.com/debian-jewel/ $(lsb_release -sc) main | sudo tee /etc/apt/sources.list.d/ceph.list
1.7 安装ceph-deploy部署工具(仅主控节点)
更新仓库,并安装 ceph-deploy:
sudo apt-get update
sudo apt-get install ceph-deploy
1.8 ceph安装
1 创建部署目录
mkdir my-cluster && cd my-cluster/
2 配置新节点
root@ceph0:~/my-cluster# ceph-deploy new ceph0 ceph1 ceph2
root@ceph0:~/my-cluster# ls
ceph.conf ceph-deploy-ceph.log ceph.mon.keyring release.asc
3 安装
root@ceph0:~/my-cluster# ceph-deploy install ceph0 ceph1 ceph2
……
……
[ceph2][INFO ] Running command: ceph --version
[ceph2][DEBUG ] ceph version 10.2.5 (ecc23778eb545d8dd55e2e4735b53cc93f92e65b)
都出现如上输出表示成功安装完成。
1.9 配置并启动ceph-mon
ceph-deploy mon create-initial
至此,ceph集群的安装工作完毕。
运行 ceph -s可以看到当前集群的状态,3个mon,暂时没添加osd,有1个pool,pool的pg数目是64个。
root@ceph0:~/my-cluster# ceph -s
cluster 4d7e1b04-2a4c-45aa-b6fe-a98241db0c2f
health HEALTH_ERR
no osds
monmap e1: 3 mons at {ceph0=172.20.0.196:6789/0,ceph1=172.20.0.197:6789/0,ceph2=172.20.0.198:6789/0}
election epoch 4, quorum 0,1,2 ceph0,ceph1,ceph2
osdmap e1: 0 osds: 0 up, 0 in
flags sortbitwise
pgmap v2: 64 pgs, 1 pools, 0 bytes data, 0 objects
0 kB used, 0 kB / 0 kB avail
64 creating