修改主机名
#修改主机名
root@lk02--test:~# hostnamectl set-hostname lk02--test01
#修改hosts
root@lk02--test:~# vi /etc/hosts
#修改ceph.conf
root@lk02--test:~# vi /etc/ceph/ceph.conf
root@lk02--test:~# cat /etc/ceph/ceph.conf |grep mon
mon host = [v2:192.168.3.11:3300,v1:192.168.3.11:6789],[v2:192.168.3.12:3300,v1:192.168.3.12:6789],[v2:192.168.3.13:3300,v1:192.168.3.13:6789]
mon initial members = lk01--test01,lk02--test01,lk03--test01
删除mon节点
root@lk03--test01:~# ceph mon stat
e21: 3 mons at {lk01--test01=[v2:192.168.3.11:3300/0,v1:192.168.3.11:6789/0],lk02--test=[v2:192.168.3.12:3300/0,v1:192.168.3.12:6789/0],lk03--test01=v1:192.168.3.13:6789/0} removed_ranks: {2}, election epoch 150, leader 0 lk02--test, quorum 0,1,2 lk02--test,lk03--test01,lk01--test01
root@lk03--test01:~# ceph mon remove lk03--test01
确认删除
root@lk03--test01:~# ceph mon stat
e22: 2 mons at {lk01--test01=[v2:192.168.3.11:3300/0,v1:192.168.3.11:6789/0],lk02--test=[v2:192.168.3.12:3300/0,v1:192.168.3.12:6789/0]} removed_ranks: {1}, election epoch 156, leader 0 lk02--test, quorum 0,1 lk02--test,lk01--test01
root@lk03--test01:~#
添加mon
root@lk03--test01:~# rm -rf /var/lib/ceph/mon/ceph-lk03--test01
root@lk03--test01:~# ceph auth get mon. -o /tmp/ceph.mon.keyring
exported keyring for mon.
root@lk03--test01:~# ceph mon getmap -o /tmp/monmap
got monmap epoch 22
root@lk03--test01:~# ceph-mon -i lk02--test01 --mkfs --monmap /tmp/monmap --keyring /tmp/ceph.mon.keyring
root@lk03--test01:~# chown -R ceph.ceph /var/lib/ceph/mon/
root@lk03--test01:~#
增加mon的map
root@lk03--test01:~# ceph-mon -i lk02--test01 --public-addr 192.168.3.12:3300
root@lk03--test01:~# netstat -tunlp |grep ceph-mon
tcp 0 0 192.168.3.13:3300 0.0.0.0:* LISTEN 3598838/ceph-mon
root@lk03--test01:~# ceph mon set-addrs lk02--test01 [v2:192.168.3.12:3300,v1:192.168.3.12:6789]
root@lk03--test01:~# netstat -tunlp |grep ceph-mon
tcp 0 0 192.168.3.13:3300 0.0.0.0:* LISTEN 3601649/ceph-mon
tcp 0 0 192.168.3.13:6789 0.0.0.0:* LISTEN 3601649/ceph-mon#增加mon的maproot@lk03--test01:~# monmaptool --addv lk02--test01 [v2:192.168.3.12:3300/0,v1:192.168.3.12:6789/0] /tmp/monmap
monmaptool: monmap file /tmp/monmap
monmaptool: map already contains [v2:192.168.3.13:3300/0,v1:192.168.3.13:6789/0]
monmaptool -h for usage#挺mon服务 确认端口down kill掉
root@lk03--test01:~# systemctl stop ceph-mon@$HOSTNAME
root@lk03--test01:~# systemctl stop ceph-mon.target
root@lk03--test01:~# netstat -tunlp |grep ceph-mon
tcp 0 0 192.168.3.13:3300 0.0.0.0:* LISTEN 3601649/ceph-mon
tcp 0 0 192.168.3.13:6789 0.0.0.0:* LISTEN 3601649/ceph-monroot@lk03--test01:~# ps -ef|grep ceph-mon
root 3601649 1 1 12:50 ? 00:00:02 ceph-mon -i lk03--test01 --public-addr 192.168.3.13:3300
root 3610179 3563938 0 12:52 pts/0 00:00:00 grep --color=auto ceph-mon
root@lk03--test01:~# kill -9 3601649#导入mon的map
root@lk03--test01:~# ceph-mon -i lk02--test01 --inject-monmap /tmp/monmap
启动服务
root@lk02--test:~# systemctl start ceph-mon.target
root@lk02--test:~# systemctl status ceph-mon@$HOSTNAME
修改mgr
ceph auth get-or-create mgr.lk03--test01 mon 'allow *' osd 'allow *'
mkdir /var/lib/ceph/mgr/ceph-lk03--test01/
ceph auth get mgr.lk03--test01 -o /var/lib/ceph/mgr/ceph-lk03--test01/keyring
ceph-mgr -i lk03--test01
systemctl enable ceph-mgr@$HOSTNAME && systemctl enable ceph-mgr@$HOSTNAME
Messenger v2 — Ceph Documentation