ceph-ansibel部署ceph v10.2.10 Jewel

环境准备

admin 192.168.99.187
node1 192.168.99.231
node2 192.168.99.224
node3 192.168.99.232

Ansibe 配置免密码登陆三个ceph节点

1 创建ssh秘钥
yum install epel-release -y
yum install sshpass -y
ssh-keygen -t rsa

2 批量复制秘钥并授权
ansible web -m shell -a ‘mkdir ~/.ssh’ -k
ansible web -m copy -a ‘src=~/.ssh/id_rsa.pub dest=~/.ssh/authorized_keys mode=0600’ -k

3 检查pip工具是否安装,如果没有则安装pip工具

yum install python-pip

4 克隆ceph-ansible到admin节点

git clone https://github.com/ceph/go-ceph.git

就用master分支,master支持Jwel 10.2.4.1

cd ceph-ansible
cp site.yaml.sampe site.yaml
cp group_vars/all.yml.sample group_vars/all.yml

修改all.yaml中的内容,注释的全部删除,添加如下内容:

ceph_origin: repository
ceph_repository: community
ceph_mirror: http://mirrors.163.com/ceph
ceph_stable_key: http://mirrors.163.com/ceph/keys/release.asc
ceph_stable_release: jewel
public_network: “192.168.99.0/24”
cluster_network: “192.168.99.0/24”
monitor_interface: enp0s3
devices:

  • ‘/dev/sda’
  • ‘/dev/sda1’
  • ‘/dev/sda2’
    osd_scenario: collocated

public_network, cluster_network 一定要和自己的网卡相匹配的网络

monitor_interface 是你的ceph的node节点的第一张网卡(访问外网的)

devices 一定要是没有使用的盘,如果被使用了,ceph部署会失败,报错 devices xx in use
Devices 可以用 lsblk命令查看

osd_scenario 的详细说明在group_vars/all.yml中有详细介绍 指定为collocated就必须指定对于的deveices

部署ceph集群

ansible-playbook site.yml

节点验证
ceph -s

cluster 5e1bede3-0b64-4649-9566-783954b5bf05
health HEALTH_OK
monmap e1: 3 mons at {node1=192.168.1.231:6789/0,node2=192.168.1.224:6789/0,node2=192.168.1.232:6789/0}
election epoch 6, quorum 0,1,2 slave-6,slave-11,slave-14
osdmap e13: 3 osds: 3 up, 3 in
flags sortbitwise,require_jewel_osds
pgmap v56: 64 pgs, 1 pools, 838 bytes data, 8 objects
101 MB used, 584 GB / 584 GB avail
64 active+clean

你可能感兴趣的:(ceph)