ceph集群osd故障修复实例演示

网友投稿 1123 2022-09-28

ceph集群osd故障修复实例演示

ceph集群osd故障修复实例演示

集群安装方式:1: ceph-deploy 方式安装ceph集群,模拟osd磁盘损坏;

分别采用如下两种方式修复:

1:使用ceph-deploy 方式修复故障osd;

2:手动修复故障osd;#######使用ceph-deploy方式修复过程演示########1:停止osd/etc/init.d/ceph stop osd.3   2:查看osd磁盘挂载情况;[root@node243 ceph]# lsblk NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTsda      8:0    0   50G  0 disk ├─sda1   8:1    0  500M  0 part /boot├─sda2   8:2    0    2G  0 part [SWAP]└─sda3   8:3    0 47.5G  0 part /sdb      8:16   0  100G  0 disk ├─sdb1   8:17   0   95G  0 part /var/lib/ceph/tmp/mnt.x4MbgI└─sdb2   8:18   0    5G  0 part /var/lib/ceph/osd/ceph-3sr0     11:0    1 1024M  0 rom  3:卸载挂载分区umount /var/lib/ceph/osd/ceph-3umount /var/lib/ceph/tmp/mnt.x4MbgI4:格式化磁盘模拟磁盘损坏mkfs.xfs  -f /dev/sdb5:查看集群osd 状态ceph osd tree[root@node243 ceph]# ceph osd treeID WEIGHT  TYPE NAME            UP/DOWN REWEIGHT PRIMARY-AFFINITY -6       0 host node01                                            -1 0.44998 root default                                           -2 0.09000     host ceph-deploy                                    0 0.09000         osd.0             up  1.00000          1.00000 -3 0.09000     host node241                                        1 0.09000         osd.1             up  1.00000          1.00000 -4 0.09000     host node242                                        2 0.09000         osd.2             up  1.00000          1.00000 -5 0.09000     host node243                                        3 0.09000         osd.3           down  1.00000          1.00000       《==发现osd状态down-7 0.09000     host node245                                        5 0.09000         osd.5             up  1.00000          1.00000 6:将osd状态设置为outceph osd out osd.3      7:将osd从集群中删除ceph osd rm osd.3  8:从CRUSH中移除     ceph osd crush rm osd.3  9:删除osd.3 的认证信息ceph auth del osd.3      10:再次查看集群osd状态[root@node243 ceph]# ceph osd treeID WEIGHT  TYPE NAME            UP/DOWN REWEIGHT PRIMARY-AFFINITY -6       0 host node01                                            -1 0.35999 root default                                           -2 0.09000     host ceph-deploy                                    0 0.09000         osd.0             up  1.00000          1.00000 -3 0.09000     host node241                                        1 0.09000         osd.1             up  1.00000          1.00000 -4 0.09000     host node242                                        2 0.09000         osd.2             up  1.00000          1.00000 -5       0     host node243                                          《==osd依被清理出集群-7 0.09000     host node245                                        5 0.09000         osd.5             up  1.00000          1.00000 [root@node243 ceph]# 开始恢复11:登陆安装配置主机(ceph-deploy)cd /etc/ceph/12:初始化磁盘:ceph-deploy osd prepare node243:/dev/sdb13:激活磁盘ceph-deploy osd activate node243:/dev/sdb 14:查看磁盘状态,验证添加是否成功ceph osd treeID WEIGHT  TYPE NAME            UP/DOWN REWEIGHT PRIMARY-AFFINITY -6       0 host node01                                            -1 0.44998 root default                                           -2 0.09000     host ceph-deploy                                    0 0.09000         osd.0             up  1.00000          1.00000 -3 0.09000     host node241                                        1 0.09000         osd.1             up  1.00000          1.00000 -4 0.09000     host node242                                        2 0.09000         osd.2             up  1.00000          1.00000 -5 0.09000     host node243                                        3 0.09000         osd.3             up  1.00000          1.00000     #添加成功-7 0.09000     host node245                                        5 0.09000         osd.5             up  1.00000          1.00000 [root@node243 ceph]# #########手动操作修复osd过程演示:#########1:停止osd/etc/init.d/ceph stop osd.3   2:查看osd磁盘挂载情况;[root@node243 ceph]# lsblk NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTsda      8:0    0   50G  0 disk ├─sda1   8:1    0  500M  0 part /boot├─sda2   8:2    0    2G  0 part [SWAP]└─sda3   8:3    0 47.5G  0 part /sdb      8:16   0  100G  0 disk ├─sdb1   8:17   0   95G  0 part /var/lib/ceph/tmp/mnt.x4MbgI└─sdb2   8:18   0    5G  0 part /var/lib/ceph/osd/ceph-3sr0     11:0    1 1024M  0 rom  3:卸载挂载分区umount /var/lib/ceph/osd/ceph-3umount /var/lib/ceph/tmp/mnt.x4MbgI4:格式化磁盘模拟磁盘损坏mkfs.xfs  -f /dev/sdb5:查看集群osd 状态ceph osd tree[root@node243 ceph]# ceph osd treeID WEIGHT  TYPE NAME            UP/DOWN REWEIGHT PRIMARY-AFFINITY -6       0 host node01                                            -1 0.44998 root default                                           -2 0.09000     host ceph-deploy                                    0 0.09000         osd.0             up  1.00000          1.00000 -3 0.09000     host node241                                        1 0.09000         osd.1             up  1.00000          1.00000 -4 0.09000     host node242                                        2 0.09000         osd.2             up  1.00000          1.00000 -5 0.09000     host node243                                        3 0.09000         osd.3           down  1.00000          1.00000       《==发现osd状态down-7 0.09000     host node245                                        5 0.09000         osd.5             up  1.00000          1.00000 6:将osd状态设置为outceph osd out osd.3      7:将osd从集群中删除ceph osd rm osd.3  8:从CRUSH中移除     ceph osd crush rm osd.3  9:删除osd.3 的认证信息ceph auth del osd.3      10:再次查看集群osd状态[root@node243 ceph]# ceph osd treeID WEIGHT  TYPE NAME            UP/DOWN REWEIGHT PRIMARY-AFFINITY -6       0 host node01                                            -1 0.35999 root default                                           -2 0.09000     host ceph-deploy                                    0 0.09000         osd.0             up  1.00000          1.00000 -3 0.09000     host node241                                        1 0.09000         osd.1             up  1.00000          1.00000 -4 0.09000     host node242                                        2 0.09000         osd.2             up  1.00000          1.00000 -5       0     host node243                                          《==osd依被清理出集群-7 0.09000     host node245                                        5 0.09000         osd.5             up  1.00000          1.00000 11:进入osd挂载目标文件夹[root@node243 ceph]# cd /var/lib/ceph/osd/ceph-312:查看挂载目录,发现文件夹为空,[root@node243 ceph-3]# ls和正常osd挂载目录对比,正常如下:[root@node242 osd]# ll ceph-2/total 56-rw-r--r--   1 root root  193 Aug 26 02:27 activate.monmap-rw-r--r--   1 root root    3 Aug 26 02:27 active-rw-r--r--   1 root root   37 Aug 26 02:27 ceph_fsiddrwxr-xr-x 226 root root 8192 Dec 17 16:53 current-rw-r--r--   1 root root   37 Aug 26 02:27 fsidlrwxrwxrwx   1 root root   58 Aug 26 02:27 journal -> /dev/disk/by-partuuid/6781a828-3baf-4e47-8f41-d12fa8cb0078-rw-r--r--   1 root root   37 Aug 26 02:27 journal_uuid-rw-------   1 root root   56 Aug 26 02:27 keyring-rw-r--r--   1 root root   21 Aug 26 02:27 magic-rw-r--r--   1 root root    6 Aug 26 02:27 ready-rw-r--r--   1 root root    4 Aug 26 02:27 store_version-rw-r--r--   1 root root   53 Aug 26 02:27 superblock-rw-r--r--   1 root root    0 Dec 17 11:37 sysvinit-rw-r--r--   1 root root    2 Aug 26 02:27 whoami13:查看新挂载的盘、然后格式化;[root@node243 ~]# fdisk  -lDisk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytes14:创建osd挂载目录mount /dev/sdb /var/lib/ceph/osd/ceph-3mount -o remount,user_xattr /var/lib/ceph/osd/ceph-3mount -o remount,noatime /var/lib/ceph/osd/ceph-3查看挂载的情况 mount 。。。。。。/dev/sdb on /var/lib/ceph/osd/ceph-3 type xfs (rw,noatime,attr2,inode64,noquota)15:创建一个OSD,生成一个osdnumber[root@node01 ~]# ceph osd create316:初始化osd数据目录[root@node01 ~]# ceph-osd -i 3 --mkfs --mkkey 17:创建key文件cd /var/lib/ceph/osd/ceph-3/[root@node243 ceph-3]# touch keyring[root@node243 ceph-3]# lltotal 0-rw-r--r-- 1 root root 0 Dec 21 20:15 keyring18:注册osd的认证密钥ceph auth add osd.3 osd 'allow *' mon 'allow profile osd' -i /var/lib/ceph/osd/ceph-3/keyring19:验证key文件,如果key文件为空,通过ceph auth list 查看系统值,填入key文件即可;[root@node243 ceph-3]# more keyring [osd.0]        key = AQBk7XdWZQrnFBAAmxYgBuHYxckSX8G3GRWexQ==20:为此osd节点创建一个crushmap(本次仅修复osd,不用修改host相关信息)ceph osd crush add-bucket node243 host防放置 Node243 到根路径ceph osd crush move node243 root=default21:放置osd.3到 bucket node243ceph osd crush add osd.3 1.0 host=node243add item id 3 name'osd.3' weight 1 at location {host=node243} to crush map22:创建一个初始化目录touch /var/lib/ceph/osd/ceph-3/sysvinit23:启动osd服务/etc/init.d/ceph start osd.3 24:查看磁盘状态,验证添加是否成功ceph osd treeID WEIGHT  TYPE NAME            UP/DOWN REWEIGHT PRIMARY-AFFINITY -6       0 host node01                                            -1 0.44998 root default                                           -2 0.09000     host ceph-deploy                                    0 0.09000         osd.0             up  1.00000          1.00000 -3 0.09000     host node241                                        1 0.09000         osd.1             up  1.00000          1.00000 -4 0.09000     host node242                                        2 0.09000         osd.2             up  1.00000          1.00000 -5 0.09000     host node243                                        3 0.09000         osd.3             up  1.00000          1.00000     #添加成功-7 0.09000     host node245                                        5 0.09000         osd.5             up  1.00000          1.00000 [root@node243 ceph]#

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:ceph集群快照、clone相关命令整理v1
下一篇:mesos 集群安装部署mesos-dns(7)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~