环境
角色 | 操作系统 | 主机名 | 公用地址 | 集群地址 | 数据裸盘 | ceph 版本 |
---|---|---|---|---|---|---|
部署机 | CentOS7.4 | deploy | 192.168.1.220 | 无 | 无 | jewel |
节点 | CentOS7.4 | ceph221 | 192.168.1.221 | 10.10.10.221 | /dev/vdb | jewel |
节点 | CentOS7.4 | ceph222 | 192.168.1.222 | 10.10.10.222 | /dev/vdb | jewel |
节点 | CentOS7.4 | ceph223 | 192.168.1.223 | 10.10.10.223 | /dev/vdb | jewel |
准备
- 在部署机上准备 yum 源
yum install epel-release cat > /etc/yum.repos.d/ceph.repo <<-END [ceph-noarch] name=Ceph noarch packages baseurl=http://download.ceph.com/rpm-jewel/el7/noarch enabled=1 gpgcheck=1 type=rpm-md gpgkey=https://download.ceph.com/keys/release.asc END
- 在全部服务器上关闭 firewalld、NetworkManager 和 SELinux
systemctl stop firewalld systemctl disable firewalld systemctl stop NetworkManager systemctl disable NetworkManager sed -i '/^SELINUX=/cSELINUX=disabled' /etc/selinux/config # 重启操作系统生效
- 为全部服务器配置相同的时间同步服务器
# 修改 /etc/chrony.conf,重启 chronyd 服务
- 在全部服务器上创建 cephdeploy 用户,并配置免密 sudo
useradd -m cephdeploy passwd cephdeploy echo "cephdeploy ALL = (root) NOPASSWD:ALL" | tee /etc/sudoers.d/cephdeploy chmod 0440 /etc/sudoers.d/cephdeploy
- 在部署机上配置各节点主机名解析
echo "192.168.1.221 ceph221" >> /etc/hosts echo "192.168.1.222 ceph222" >> /etc/hosts echo "192.168.1.223 ceph223" >> /etc/hosts
- 在部署机上配置 cephdeploy 用户免密 ssh 到各节点的 cephdeploy 用户
su - cephdeploy ssh-keygen for host in $(seq -f 'ceph%g' 221 223); do ssh-copy-id $host done
安装集群
- 在部署机上执行以下命令,安装集群基本组件
su - cephdeploy mkdir $HOME/my-cluster cd $HOME/my-cluster ceph-deploy new ceph221 ceph-deploy install ceph221 ceph-deploy install ceph222 ceph-deploy install ceph223 ceph-deploy mon create-initial ceph-deploy admin ceph221 ceph222 ceph223 ceph-deploy osd create ceph221:vdb ceph222:vdb ceph223:vdb ceph-deploy mon add ceph222 ceph-deploy mon add ceph223
- 在集群中任一节点上执行以下命令,查看集群状态
ceph -s
创建对象存储网关
- 在部署机上执行以下命令,安装对象存储网关服务
su - cephdeploy ceph-deploy rgw create ceph221 ceph-deploy rgw create ceph222 ceph-deploy rgw create ceph223
- 在集群中的任一节点上执行以下命令,创建 swift 用户
radosgw-admin user create --subuser="admin:swift_user" --uid="swift_id" --display-name="swift_name" --key-type=swift --secret="swift_password" --access=full # admin:swift_user: swift接口使用的"用户名:子用户名" # swift_id: swfit用户id # swift_name: swift用户名 # swift_password: swift密码
- 在部署机上执行以下命令,安装 swift 客户端
yum install python2-pip pip install python-swiftclient
- 在 ceph 集群中创建 swift 容器
swift -A http://192.168.1.221/auth/v1 -Uadmin:swift_user -Kswift_password post container_name # container_name: 容器名