[root@lab8106 ceph]# ceph --cluster local mon stat e1: 1 mons at {lab8106=192.168.8.106:6789/0}, election epoch 3, quorum 0 lab8106 [root@lab8106 ceph]# ceph --cluster remote mon stat e1: 1 mons at {lab8107=192.168.8.107:6789/0}, election epoch 3, quorum 0 lab8107
在lab8107执行
1 2 3 4
root@lab8107:~/ceph# ceph --cluster local mon stat e1: 1 mons at {lab8106=192.168.8.106:6789/0}, election epoch 3, quorum 0 lab8106 root@lab8107:~/ceph# ceph --cluster remote mon stat e1: 1 mons at {lab8107=192.168.8.107:6789/0}, election epoch 3, quorum 0 lab8107
到这里就是两个集群可以通过local和remote进行通信了
增加peer
我们这里是做单个集群的备份,为了方便我们这里都用admin的keyring 语法
1
rbd mirror pool peer add <pool-name> <client-name>@<cluster-name>
这个是为了让rbd-mirror进程找到它peer的集群的存储池 在lab8106上执行
1 2
[root@lab8106 ceph]# rbd --cluster local mirror pool peer add rbd client.admin@remote [root@lab8106 ceph]# rbd --cluster remote mirror pool peer add rbd client.admin@local
查询peer状态
1 2 3 4 5 6 7 8 9 10
[root@lab8106 ceph]# rbd mirror pool info rbd --cluster local Mode: image Peers: UUID NAME CLIENT a050a0f5-9448-43f2-872f-87c394083871 remote client.admin [root@lab8106 ceph]# rbd mirror pool info rbd --cluster remote Mode: image Peers: UUID NAME CLIENT 8d7b3fa4-be44-4e25-b0b7-cf4bdb62bf10 local client.admin
如果需要删除peer 语法:
1
rbd mirror pool peer remove <pool-name> <peer-uuid>
查询存储池状态
1 2 3
[root@lab8106 ceph]# rbd mirror pool status rbd health: OK images: 0 total
开启image的mirror
在lab8106执行
1
rbd mirror image enable rbd/image-1
查询镜像的状态
1 2 3 4 5 6 7 8 9 10 11 12
[root@lab8106 ceph]# rbd info rbd/image-1 rbd image 'image-1': size 1024 MB in 256 objects order 22 (4096 kB objects) block_name_prefix: rbd_data.102c2ae8944a format: 2 features: exclusive-lock, journaling flags: journal: 102c2ae8944a mirroring state: enabled mirroring global id: dabdbbed-7c06-4e1d-b860-8dd104509565 mirroring primary: true
开启rbd-mirror的同步进程
先用调试模式启动进程看看情况 在lab8107的机器上执行
1 2 3
[root@lab8107 ceph]# rbd-mirror -d --setuser ceph --setgroup ceph --cluster remote -i admin 2017-01-22 17:43:53.688820 7fc926dc6c40 0 set uid:gid to 167:167 (ceph:ceph) 2017-01-22 17:43:53.688840 7fc926dc6c40 0 ceph version 10.2.5 (c461ee19ecbc0c5c330aca20f7392c9a00730367), process rbd-mirror, pid 32080
如果确认没问题就用服务来控制启动
1
vim /usr/lib/systemd/system/ceph-rbd-mirror@.service