ceph mon 迁移

4 篇文章 0 订阅

目的

用于机房迁移
必须确保 mon 可以完成在线迁移或安全迁移

步骤

ceph mon 扩容 (新机房)
ceph mon 缩容 (旧机房)
验证 ceph 可用性

ceph mon 扩容

通过表格,参考主机信息

角色主机名IP 地址
原monns-storage-0201031.1.20.103
原monns-storage-0201041.1.20.104
原monns-storage-0201051.1.20.105
新monns-storage-0220501.1.22.50
新monns-storage-0220571.1.22.57
新monns-storage-0220581.1.22.58

软件安装

yum install -y ceph-common  ceph

mon 扩容步骤

分别在每个新 mon 服务器上获取 mon keyring

ceph auth get mon. -o /etc/ceph/ceph.mon.keyring

分别在每个新 mon 服务器上获取 admin keryring

ceph mon getmap -o /etc/ceph/monmap

修改 ceph.conf 假入新 mon 地址 ( 注意你的 IP 对应 public network )

[global]
fsid = xxxxxx-4439-4447-8bc5-ca021be54520
mon initial members = ns-storage-020103,ns-storage-020104,ns-storage-020105,ns-storage-020050,ns-storage-020057,ns-storage-020058
mon host = 1.1.20.103,1.1.20.104,1.1.20.105,1.1.22.50,1.1.22.57,1.1.20.58

分别在各个新 mon 中创建目录

# mkdir /var/lib/ceph/mon/ceph-ns-storage-020050 -p
# mkdir /var/lib/ceph/mon/ceph-ns-storage-020057 -p
# mkdir /var/lib/ceph/mon/ceph-ns-storage-020058 -p

在各个新 mon 中各自执行 mon 初始化

ceph-mon --mkfs -i ns-storage-020050 --monmap /etc/ceph/monmap --keyring /etc/ceph/ceph.mon.keyring
ceph-mon --mkfs -i ns-storage-020057 --monmap /etc/ceph/monmap --keyring /etc/ceph/ceph.mon.keyring
ceph-mon --mkfs -i ns-storage-020058 --monmap /etc/ceph/monmap --keyring /etc/ceph/ceph.mon.keyring

启动 ceph mon 前准备

touch /var/lib/ceph/mon/ceph-ns-storage-020050/{done,upstart}
touch /var/lib/ceph/mon/ceph-ns-storage-020057/{done,upstart}
touch /var/lib/ceph/mon/ceph-ns-storage-020058/{done,upstart}

cp /usr/lib/systemd/system/ceph-mon@.service   /usr/lib/systemd/system/ceph-mon@ns-storage-020050.service
cp /usr/lib/systemd/system/ceph-mon@.service   /usr/lib/systemd/system/ceph-mon@ns-storage-020057.service
cp /usr/lib/systemd/system/ceph-mon@.service   /usr/lib/systemd/system/ceph-mon@ns-storage-020058.service

启动 ceph mon 验证

chown ceph:ceph /var/lib/ceph/mon/ -R
systemctl start ceph-mon@ns-storage-020050.service
其他 CEPH MON 启动同理

校验 ceph 状态

# ceph -s
  cluster:
    id:     3e34940b-4439-4447-8bc5-ca021be54520
    health: HEALTH_WARN
  services:
    mon: 6 daemons, quorum ns-storage-020103,ns-storage-020104,ns-storage-020105,ns-storage-020050,ns-storage-020057,ns-storage-020058    
    mgr: ns-storage-020103(active), standbys: ns-storage-020104, ns-storage-020105
    osd: 15 osds: 15 up, 15 in

结论

CEPH mon 添加已经成功
旧 ceph mon 不需要重启即可发现并找到新 ceph mon

ceph mon 缩容

对旧 ceph mon 进行删除缩容操作
修改 ceph.conf 配置

[global]
fsid = xxxxxx-4439-4447-8bc5-ca021be54520
mon initial members = ns-storage-020050,ns-storage-020057,ns-storage-020058
mon host = 1.1.22.50,1.1.22.57,1.1.20.58

从 monmap 中删除旧 ceph mon 信息

# monmaptool --rm ns-storage-020103 /etc/ceph/monmap
monmaptool: monmap file /etc/ceph/monmap
monmaptool: removing ns-storage-020103
monmaptool: writing epoch 0 to /etc/ceph/monmap (5 monitors)
# monmaptool --rm ns-storage-020104 /etc/ceph/monmap
monmaptool: monmap file /etc/ceph/monmap
monmaptool: removing ns-storage-020104
monmaptool: writing epoch 0 to /etc/ceph/monmap (4 monitors)
# monmaptool --rm ns-storage-020105 /etc/ceph/monmap
monmaptool: monmap file /etc/ceph/monmap
monmaptool: removing ns-storage-020105
monmaptool: writing epoch 0 to /etc/ceph/monmap (3 monitors)

复制 cephmon 及 ceph.conf 至所有的 ceph osd, ceph mon 中

# scp /etc/ceph/monmap /etc/ceph/ceph.conf 1.1.22.50:/etc/ceph
# scp /etc/ceph/monmap /etc/ceph/ceph.conf 1.1.22.57:/etc/ceph
# scp /etc/ceph/monmap /etc/ceph/ceph.conf 1.1.22.58:/etc/ceph
....
其他过程忽略

安全移除 旧 ceph mon

# ceph mon remove ns-storage-020103
removing mon.ns-storage-020103 at 1.1.20.103:6789/0, there will be 5 monitors
# ceph mon remove ns-storage-020104
removing mon.ns-storage-020104 at 1.1.20.104:6789/0, there will be 4 monitors
# ceph mon remove ns-storage-020105
removing mon.ns-storage-020105 at 1.1.20.105:6789/0, there will be 3 monitors

检测 ceph mon

# ceph -s
  cluster:
    id:     3e34940b-4439-4447-8bc5-ca021be54520
    health: HEALTH_WARN

  services:
    mon: 3 daemons, quorum ns-storage-020050,ns-storage-020057,ns-storage-020058
    mgr: ns-storage-020103(active), standbys: ns-storage-020104, ns-storage-020105
    osd: 15 osds: 15 up, 15 in

安全关闭 ceph mon

systemctl stop ns-storage-020103
systemctl stop ns-storage-020104
systemctl stop ns-storage-020105

以上已完成 ceph mon 迁移工作

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Terry_Tsang

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值