三台环境为centos7.9,以下配置需要在每台机器上执行
配置hosts解析
- cat >> /etc/hosts <<EOF
- 192.168.2.16 node1
- 192.168.2.19 node2
- 192.168.2.18 node3
- EOF
关闭防火墙和selinux
- systemctl stop firewalld && systemctl disable firewalld
- setenforce 0 && sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
分别在三个节点设置主机名
- hostnamectl set-hostname node1
- hostnamectl set-hostname node2
- hostnamectl set-hostname node3
配置主机时间同步
- systemctl restart chronyd.service && systemctl enable chronyd.service
使用yum安装
安装yum-plugin-priorities
- yum install yum-plugin-priorities
安装依赖包
- yum install snappy leveldb gdisk python-argparse gperftools-libs epel-release
添加ceph仓库
建议使用阿里的源,国外的太慢了
- vim /etc/yum.repos.d/ceph.repo
- [ceph]
- name=ceph
- baseurl=http://mirrors.aliyun.com/ceph/rpm-15.2.8/el7/x86_64/
- gpgcheck=0
- [ceph-noarch]
- name=cephnoarch
- baseurl=http://mirrors.aliyun.com/ceph/rpm-15.2.8/el7/noarch/
- gpgcheck=0
安装ceph
- yum install ceph -y
部署monitor节点
所有 Ceph 群集至少需要一个monitor,并且至少需要与存储在群集上的对象副本一样多的 OSD。引导初始mon是部署 Ceph 存储群集的第一步,这里我直接在node1、node2、node3创建三个mon。
在node1添加monitor
为集群生成唯一的fsid,fsid是群集的唯一标识符,代表 Ceph 存储群集主要用于 Ceph 文件系统的文件系统 ID
- uuidgen
创建ceph配置文件,将生成的fsid添加到配置文件中
- vim /etc/ceph/ceph.repo
- [global]
- fsid=9c079a1f-6fc2-4c59-bd4d-e8bc232d33a4
为群集创建keyring并生成monitor keyring。monitor通过密钥相互通信。必须生成具有monitor密钥的keyring,并在引导初始monitor时提供keyring。
- ceph-authtool –create-keyring /tmp/ceph.mon.keyring –gen-key -n mon. –cap mon 'allow *'
生成管理员keyring,生成用户并将用户添加到client.admin keyring中。要使用 CLI 工具,必须有一个用户,并且还必须将用户添加到monitor keyring。