手工安装https://www.jianshu.com/p/b8f085ca0307
在ceph所有节点上执行
1.配置hosts
cat << EOF >> /etc/hosts
172.31.240.49 ceph-mon01
EOF
2.配置ceph安装源
cat << EOF > /etc/yum.repos.d/ceph.repo
[ceph]
name=ceph
baseurl=http://mirrors.aliyun.com/ceph/rpm-nautilus/el7/x86_64/
gpgcheck=0
priority=1
[ceph-noarch]
name=cephnoarch
baseurl=http://mirrors.aliyun.com/ceph/rpm-nautilus/el7/noarch/
gpgcheck=0
priority=1
[ceph-source]
name=Ceph source packages
baseurl=http://mirrors.aliyun.com/ceph/rpm-nautilus/el7/SRPMS/
enabled=0
gpgcheck=1
type=rpm-md
gpgkey=http://mirrors.aliyun.com/ceph/keys/release.asc
priority=1
EOF
3.创建cephd用户并赋予sudo权限
useradd cephd
echo 'CephIl#i42' | passwd --stdin cephd
echo "cephd ALL = (root) NOPASSWD:ALL" | tee /etc/sudoers.d/cephd
chmod 0440 /etc/sudoers.d/cephd
4.准备OSD的存储空间(必须是一块未使用的磁盘或分区)
在ceph-mon01上:
mkfs.xfs /dev/sdb
在ceph-deploy节点上执行
5.在ceph-deploy节点上设置免密钥ssh到其它节点。
yum -y install expect
su - cephd
expect << EOF
spawn ssh-keygen -t rsa
expect {
"Enter file in which to save the key (/home/cephd/.ssh/id_rsa):" { send "\r"; exp_continue}
"Enter passphrase (empty for no passphrase):" { send "\r"; exp_continue}
"Enter same passphrase again:" { send "\r"; exp_continue}
}
EOF
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 400 ~/.ssh/authorized_keys
for i in {"ceph-mon01",} ;do ssh-copy-id -i ~/.ssh/id_rsa.pub cephd@$i;done
6.配置执行ceph-deploy时免指定username参数
su - cephd
cat << EOF > ~/.ssh/config
Host ceph-mon01
Hostname ceph-mon01
User cephd
EOF
chmod 600 ~/.ssh/config
7.安装ceph-deploy
sudo yum -y install ceph-deploy
ceph-deploy --version
8.创建部署临时目录
mkdir ~/ceph-cluster
9.给所有ceph节点安装ceph
cd ~/ceph-cluster
ceph-deploy install --no-adjust-repos ceph-mon01
ceph --version
10.创建Monitor监视器集群并指定ceph节点物理上相互通信的网络
cd ~/ceph-cluster
ceph-deploy new --public-network 172.31.240.0/24 ceph-mon01
11.定制ceph.conf配置(我没做定制)
12.初始化Monitor监视器集群并收集密钥
cd ~/ceph-cluster
ceph-deploy --overwrite-conf mon create-initial
若有报错:[ERROR ] Some monitors have still not reached quorum
报错原因:Monitor监视器节点的hostname与/etc/hosts不符
解决办法:修改主机名后,用下面的方法清理环境,然后重装即可。
su - cephd
ceph-deploy purge ceph-mon01
ceph-deploy purgedata ceph-mon01
ceph-deploy forgetkeys
rm -rf ~/ceph-cluster/*
13.将配置文件和密钥分发到所有ceph节点(包括MON节点和OSD节点)
cd ~/ceph-cluster
ceph-deploy --overwrite-conf admin ceph-mon01
14.部署OSD节点(这里将监视器主机同时作为OSD节点)
cd ~/ceph-cluster
ceph-deploy osd create ceph-mon01 --data /dev/sdb
15.为每个运行Monitor的机器添加一个mgr
cd ~/ceph-cluster
ceph-deploy mgr create ceph-mon01:ceph-mon01_mgr
systemctl status ceph-mgr@ceph-mon01_mgr
16.查看
ceph -s
ceph daemon osd.0 config get mon_max_pg_per_osd
ceph osd tree