Ceph添加/删除Mon(ceph.conf)

本文介绍如何在 Ceph 存储集群中添加和删除监控节点(Mon)。详细步骤包括配置文件修改、密钥获取、数据目录初始化等,并提供了具体的操作命令示例。

操作环境

ceph 0.87.7

Openstack icehouse

Centos 6.5 x86_64

 

当前ceph配置文件如下

[global]
    pid file                   = /var/run/ceph/$name.pid
    auth cluster required      = cephx
    auth service required      = cephx
    auth client required       = cephx
    keyring                  = /etc/ceph/keyring.admin
[mon]
    mon data                   = /mon
    mon clock drift allowed    = .25
[mon.alpha]
    host                       = mon1 
    mon addr                   = 10.10.200.3:6789
[mon.beta]
    host                       = mon2
    mon addr                   = 10.10.200.4:6789
[mds]
[osd]
osd data                     = /osd/$name
osd mkfs type = xfs 
osd journal                  = /osd/$name/journal
keyring = /etc/ceph/keyring.$name
osd crush update on start = false
[osd.0]
    host                         = osd1
    devs                         = /dev/vdb
[osd.1]
    host                         = osd2 
    devs                         = /dev/vdb
[osd.2]
    host                         = osd3 
    devs                         = /dev/vdb
[osd.3]
    host                         = osd4 
    devs                         = /dev/vdb
[osd.4]
    host                         = osd5
    devs                         = /dev/vdb
[osd.5]
    host                         = osd6
    devs                         = /dev/vdb

操作步骤

添加Mon

1.查看当前mon节点

[root@mon1 ~]# ceph mon stat
e3: 2 mons at {alpha=10.10.200.3:6789/0,beta=10.10.200.4:6789/0}, election epoch 88, quorum 0,1 alpha,beta

2.例如添加mon.gamma节点,首先在ceph.conf添加mon.gamma配置

[mon.gamma]
    host                       = mon3 
    mon addr                   = 10.10.200.10:6789

3.获取mon的keyring

[root@mon1 ~]# ceph auth get mon. -o /tmp/keyring
exported keyring for mon.

4.获取mon的map

[root@mon1 ~]# ceph mon getmap -o /tmp/mapfile
got monmap epoch 3

5.初始化mon.gamma节点的数据目录

[root@mon1 ~]# ceph-mon -i gamma --mkfs --monmap /tmp/mapfile --keyring /tmp/keyring 
ceph-mon: created monfs at /mon for mon.gamma

6.添加mon.gamma节点至ceph cluster中

[<a target=_blank href="mailto:root@mon3">root@mon3</a> ~]# ceph mon add gamma 10.10.200.10:6789
added mon.gamma at 10.10.200.10:6789/0

7.启动mon.gamma

root@mon3 ~]# ceph-mon -i gamma --public-addr 10.10.200.10:6789

8.查看当前mon节点

[root@mon1 ~]# ceph mon stat
e4: 3 mons at {alpha=10.10.200.3:6789/0,beta=10.10.200.4:6789/0,gamma=10.10.200.10:6789/0}, election epoch 94, quorum 0,1,2 alpha,beta,gamma

 

删除Mon

1.查看当前mon节点

[root@mon1 ~]# ceph mon stat
e2: 3 mons at {alpha=10.10.200.3:6789/0,beta=10.10.200.4:6789/0,gamma=10.10.200.10:6789/0}, election epoch 84, quorum 0,1,2 alpha,beta,gamma


2.例如删除mon.gamma节点,首先停止mon.gamma节点

[root@mon1 ~]# /etc/init.d/ceph -a stop mon.gamma
=== mon.gamma === 
Stopping Ceph mon.gamma on mon3...kill 1576...done


3.将mon.gamma节点从ceph cluster中删除掉

[root@mon1 ~]# ceph mon remove gamma
removed mon.gamma at 10.10.200.10:6789/0, there are now 2 monitors


4.在ceph.conf配置文件中删除mon.gamma字段

 

5.查看当前mon节点

[root@mon1 ~]# ceph mon stat
e3: 2 mons at {alpha=10.10.200.3:6789/0,beta=10.10.200.4:6789/0}, election epoch 88, quorum 0,1 alpha,beta



 

 

[root@ceph ~]# sudo sed -e 's|https://download.ceph.com|https://mirrors.aliyun.com/ceph|g' \ > -i /etc/yum.repos.d/ceph.repo sed: can't read /etc/yum.repos.d/ceph.repo: No such file or directory [root@ceph ~]# sudo sed -e 's|https://download.ceph.com|https://mirrors.aliyun.com/ceph|g' -i /etc/yum.repos.d/ceph.repo sed: can't read /etc/yum.repos.d/ceph.repo: No such file or directory [root@ceph ~]# sudo tee /etc/yum.repos.d/ceph.repo <<'EOF' > [ceph] > name=Ceph packages for $basearch > baseurl=https://download.ceph.com/rpm-quincy/el8/$basearch > enabled=1 > gpgcheck=1 > gpgkey=https://download.ceph.com/keys/release.asc > > [ceph-noarch] > name=Ceph noarch packages > baseurl=https://download.ceph.com/rpm-quincy/el8/noarch > enabled=1 > gpgcheck=1 > gpgkey=https://download.ceph.com/keys/release.asc > EOF [ceph] name=Ceph packages for $basearch baseurl=https://download.ceph.com/rpm-quincy/el8/$basearch enabled=1 gpgcheck=1 gpgkey=https://download.ceph.com/keys/release.asc [ceph-noarch] name=Ceph noarch packages baseurl=https://download.ceph.com/rpm-quincy/el8/noarch enabled=1 gpgcheck=1 gpgkey=https://download.ceph.com/keys/release.asc [root@ceph ~]# sudo dnf install -y ceph-common ceph-base Ceph packages for x86_64 73 B/s | 146 B 00:02 Errors during downloading metadata for repository 'ceph': - Status code: 404 for https://download.ceph.com/rpm-quincy/el8/x86_64/repodata/repomd.xml (IP: 158.69.68.124) Error: Failed to download metadata for repo 'ceph': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried [root@ceph ~]# sudo dnf install -y ceph-common ceph-base Ceph packages for x86_64 74 B/s | 146 B 00:01 Errors during downloading metadata for repository 'ceph': - Status code: 404 for https://download.ceph.com/rpm-quincy/el8/x86_64/repodata/repomd.xml (IP: 158.69.68.124) Error: Failed to download metadata for repo 'ceph': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
09-16
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值