ceph 部署

文档:ceph

ceph-ansible部署方式

版本信息

stable-4.0 Supports Ceph version nautilus. This branch requires Ansible version 2.9

安装环境

192.168.1.105 192.168.1.106 192.168.1.107

配置之间同步

1
2
yum  -y  install ntp
echo "*/10 * * * * /usr/sbin/ntpdate ntp1.aliyun.com" >> /var/spool/cron/root

配置yum源

阿里源

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
[root@homeserver-101 ceph-ansible-4.0.70.20]# cat /etc/yum.repos.d/ceph.repo
[ceph-norch]
name=ceph-norch
baseurl=http://mirrors.aliyun.com/ceph/rpm-nautilus/el7/noarch/
enabled=1
gpgcheck=0
[ceph-x86_64]
name=ceph-x86_64
baseurl=http://mirrors.aliyun.com/ceph/rpm-nautilus/el7/x86_64/
enabled=1

部署配置修改

1.group_vars/all.yml

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
ceph_origin: repository
ceph_repository: community
public_network: "192.168.1.0/24"
cluster_network: "{{ public_network }}"
monitor_interface: eth0
radosgw_interface: eth0
devices:
  - '/dev/sdc'
configure_firewall: False
dashboard_enabled: False

2.roles/ceph-defaults/defaults/main.yml

1
ceph_stable_key: http://download.ceph.com/keys/release.asc

配置hosts

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
[root@homeserver-101 ceph-ansible-4.0.70.20]# cat hosts
[mons]
sp-[1:3]

[mgrs]
sp-[1:3]

[osds]
sp-[1:3]

[rgws]
sp-[2:3]

[clients]
sp-[1:3]

[all:vars]
ansible_ssh_pass=XXXXXX

加载需要的模块

1
pip install -r requirements.txt

集群操作

1
2
3
4
# 安装
ansible-playbook -i hosts site.yml
# 还原集群
ansible-playbook -i hosts infrastructure-playbooks/purge-cluster.yml

查看信息

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
[root@node1 ~]# ceph -s
  cluster:
    id:     f8aa6268-4b99-4f38-90d0-20e9d0a62057
    health: HEALTH_WARN
            mons are allowing insecure global_id reclaim

  services:
    mon: 3 daemons, quorum node1,node2,node3 (age 4h)
    mgr: node1(active, since 4h), standbys: node2, node3
    osd: 3 osds: 3 up (since 7h), 3 in (since 7h)
    rgw: 2 daemons active (node2.rgw0, node3.rgw0)

  task status:

  data:
    pools:   5 pools, 192 pgs
    objects: 308 objects, 100 MiB
    usage:   3.2 GiB used, 147 GiB / 150 GiB avail
    pgs:     192 active+clean