iis服务器助手广告广告
返回顶部
首页 > 资讯 > 数据库 >ceph mon无法启动-rocksdb数据损坏
  • 811
分享到

ceph mon无法启动-rocksdb数据损坏

摘要

一、问题描述 rocksdb数据库发生异常导致mon进程无法拉起。 二、问题现象: mon异常第一次call trace信息如下: Jul 31, 2020 @ 19:36:31.000 node-3 ceph ceph-mon


	ceph mon无法启动-rocksdb数据损坏
[数据库教程]

一、问题描述

rocksdb数据库发生异常导致mon进程无法拉起。

二、问题现象:

mon异常第一次call trace信息如下:

  Jul 31, 2020 @ 19:36:31.000 node-3  ceph  ceph-mon  228,237 2020-07-31 19:36:31.926040 7fdc0142d700 -1 /root/rpmbuild/BUILD/ceph-12.2.12-1/src/mon/Monitor.cc: In function ‘bool Monitor::_scrub(ScrubResult*, std::pair, std::basic_string >*, int*)‘ thread 7fdc0142d700 time 2020-07-31 19:36:31.895145
  Jul 31, 2020 @ 19:36:31.000 node-3  ceph  ceph-mon  228,238 /root/rpmbuild/BUILD/ceph-12.2.12-1/src/mon/Monitor.cc: 5374: FAILED assert(err == 0)
  Jul 31, 2020 @ 19:36:31.000 node-3  ceph  ceph-mon  228,239  ceph version 12.2.12-30-ged2e5c3 (ed2e5c3c26215c395ed024dabce34321e1f650b3) luminous (stable)
  Jul 31, 2020 @ 19:36:31.000 node-3  ceph  ceph-mon  228,240  1: (ceph::__ceph_assert_fail(char const*, char const*, int, char const*)+0x110) [0x5583990f8b10]
  Jul 31, 2020 @ 19:36:31.000 node-3  ceph  ceph-mon  228,241  2: (Monitor::_scrub(ScrubResult*, std::pair*, int*)+0xc11) [0x558398e7db61]
  Jul 31, 2020 @ 19:36:31.000 node-3  ceph  ceph-mon  228,242  3: (Monitor::handle_scrub(boost::intrusive_ptr)+0x22f) [0x558398e8adbf]
  Jul 31, 2020 @ 19:36:31.000 node-3  ceph  ceph-mon  228,243  4: (Monitor::dispatch_op(boost::intrusive_ptr)+0xc08) [0x558398ea6ab8]
  Jul 31, 2020 @ 19:36:31.000 node-3  ceph  ceph-mon  228,244  5: (Monitor::_ms_dispatch(Message*)+0x7eb) [0x558398ea7a4b]
  Jul 31, 2020 @ 19:36:31.000 node-3  ceph  ceph-mon  228,245  6: (Monitor::ms_dispatch(Message*)+0x23) [0x558398ed4323]
  Jul 31, 2020 @ 19:36:31.000 node-3  ceph  ceph-mon  228,246  7: (DispatchQueue::entry()+0x792) [0x5583993c2ef2]
  Jul 31, 2020 @ 19:36:31.000 node-3  ceph  ceph-mon  228,247  8: (DispatchQueue::DispatchThread::entry()+0xd) [0x5583991a120d]
  Jul 31, 2020 @ 19:36:31.000 node-3  ceph  ceph-mon  228,248  9: (()+0x7e25) [0x7fdc0a21ae25]
  Jul 31, 2020 @ 19:36:31.000 node-3  ceph  ceph-mon  228,249  10: (clone()+0x6d) [0x7fdc077b534d]

另外一种call trace信息:
技术图片

三、问题分析

经过调查,是ceph mon处理scrub消息时,调用读取racksdb出现错误,可能数据库发生损坏。

bool Monitor::_scrub(ScrubResult *r,
                     pair *start,
                     int *num_keys)
{
  MonitorDBStore::Synchronizer it = store->get_synchronizer(*start, prefixes);
  while (it->has_next_chunk()) {
    pair k = it->get_next_key();  
    bufferlist bl;
    int err = store->get(k.first, k.second, bl);// 调用racksdb出现错误,可能数据库发生损坏
    assert(err == 0);    
    }
}

经过调查,该问题之前有人在rocksdb仓库中进行了bug submit,我查看了相关的comments信息,以及rocksdb社区对该问题的修复。

issues 提交: https://GitHub.com/facebook/rocksdb/issues/5558

rocksdb修复: Https://github.com/facebook/rocksdb/pull/5744

rocksdb修复中提到:

Open-source users recently reported two occurrences of LSM-tree corruption (#5558 is one), which would be caught by options.force_consistency_checks = true. options.force_consistency_checks has a usability limitation because it crashes the service once inconsistency is detected. This makes the feature hard to use. Most users serve from multiple RocksDB shards per server and the impacts of crashing the service is higher than it should be.

Instead, we just pass the error back to users without killing the service, and ask them to deal with the problem accordingly.

When user uses options.force_consistency_check in RocksDb, instead of crashing the process, we now pass the error back to the users without killing the process.
  1. 通过打开force_consistency_checks选项,在rocksdb Apply操作时候,调用CheckConsistency or CheckConsistencyForDeletes进行相关的一致性检查,在5.4.0版本中,force_consistency_checks 默认是false,其实根本没有进行相关的检测验证。
void CheckConsistency(VersionStorageInfo* vstorage) {
#ifdef NDEBUG
    if (!vstorage->force_consistency_checks()) {
      // Dont run consistency checks in release mode except if
      // explicitly asked to
      return;
    }
#endif
...
}

void CheckConsistencyForDeletes(VersionEdit* edit, uint64_t number,
                                  int level) {
#ifdef NDEBUG
    if (!base_vstorage_->force_consistency_checks()) {
      // Dont run consistency checks in release mode except if
      // explicitly asked to
      return;
    }
#endif    
...
}
  1. 可以在配置中,把force_consistency_checks 置位true,期望进行rocksdb的相关检测。
mon_rocksdb_options = write_buffer_size=33554432,compression=kNoCompression,level_compaction_dynamic_level_bytes=true,force_consistency_checks=true

通过步骤步骤4,确实会进行rocksdb的相关检测,但是当检测到rocksdb异常(比如,sst文件排序错误、重叠、要删除文件找不到)等情况,在5.4.0版本中进行的操作是abort(),此时直接kill掉进程退出,在https://github.com/facebook/rocksdb/pull/5744 中进行了相关优化。即当出现这些异常时候,输出相关信息到前端,而不是直接把相关的进程kill掉。以下为部分代码优化:

//rocksdb 5.4.0

131   void CheckConsistency(VersionStorageInfo* vstorage) {
...
139     // make sure the files are sorted correctly
140     for (int level = 0; level < vstorage->num_levels(); level++) {
141       auto& level_files = vstorage->LevelFiles(level);
142       for (size_t i = 1; i < level_files.size(); i++) {
143         auto f1 = level_files[i - 1];
144         auto f2 = level_files[i];
145         if (level == 0) {
146           if (!level_zero_cmp_(f1, f2)) {
147             fprintf(stderr, "L0 files are not sorted properly");
148             abort();// 进程直接退出
149           }
150        
151           if (f2->smallest_seqno == f2->largest_seqno) {
152             // This is an external file that we ingested
153             SequenceNumber external_file_seqno = f2->smallest_seqno;
154             if (!(external_file_seqno < f1->largest_seqno ||
155                   external_file_seqno == 0)) {
156               fprintf(stderr, "L0 file with seqno %" PRIu64 " %" PRIu64
157                               " vs. file with global_seqno %" PRIu64 "
",
158                       f1->smallest_seqno, f1->largest_seqno,
159                       external_file_seqno);
160               abort();// 进程直接退出
161             }
162           } else if (f1->smallest_seqno <= f2->smallest_seqno) {
163             fprintf(stderr, "L0 files seqno %" PRIu64 " %" PRIu64
164                             " vs. %" PRIu64 " %" PRIu64 "
",
165                     f1->smallest_seqno, f1->largest_seqno, f2->smallest_seqno,
166                     f2->largest_seqno);
167             abort();// 进程直接退出
168           }
169         } else {
170           if (!level_nonzero_cmp_(f1, f2)) {
171             fprintf(stderr, "L%d files are not sorted properly", level);
172             abort();// 进程直接退出
173           }
}

//rocksdb v6.10.2

204   Status CheckConsistency(VersionStorageInfo* vstorage) {
243         if (level == 0) {
244           if (!level_zero_cmp_(f1, f2)) {
245             fprintf(stderr, "L0 files are not sorted properly");
246             return Status::Corruption("L0 files are not sorted properly");//不退出,给出提示信息
247           }       
248                   
249           if (f2->fd.smallest_seqno == f2->fd.largest_seqno) {
250             // This is an external file that we ingested
251             SequenceNumber external_file_seqno = f2->fd.smallest_seqno;
252             if (!(external_file_seqno < f1->fd.largest_seqno ||
253                   external_file_seqno == 0)) {
254               fprintf(stderr,
255                       "L0 file with seqno %" PRIu64 " %" PRIu64
256                       " vs. file with global_seqno %" PRIu64 "
",
257                       f1->fd.smallest_seqno, f1->fd.largest_seqno,
258                       external_file_seqno);
259               return Status::Corruption(
260                   "L0 file with seqno " +
261                   NumberToString(f1->fd.smallest_seqno) + " " +
262                   NumberToString(f1->fd.largest_seqno) +
263                   " vs. file with global_seqno" +
264                   NumberToString(external_file_seqno) + " with fileNumber " +
265                   NumberToString(f1->fd.GetNumber()));//不退出,给出提示信息
266             }     
267           } else if (f1->fd.smallest_seqno <= f2->fd.smallest_seqno) {
268             fprintf(stderr,
269                     "L0 files seqno %" PRIu64 " %" PRIu64 " vs. %" PRIu64                                                                                                               
270                     " %" PRIu64 "
",
271                     f1->fd.smallest_seqno, f1->fd.largest_seqno,
272                     f2->fd.smallest_seqno, f2->fd.largest_seqno);
273             return Status::Corruption(
274                 "L0 files seqno " + NumberToString(f1->fd.smallest_seqno) +
275                 " " + NumberToString(f1->fd.largest_seqno) + " " +
276                 NumberToString(f1->fd.GetNumber()) + " vs. " +
277                 NumberToString(f2->fd.smallest_seqno) + " " +
278                 NumberToString(f2->fd.largest_seqno) + " " +
279                 NumberToString(f2->fd.GetNumber()));
280           } //不退出,给出提示信息        
281         } else {    
282           if (!level_nonzero_cmp_(f1, f2)) {
283             fprintf(stderr, "L%d files are not sorted properly", level);
284             return Status::Corruption("L" + NumberToString(level) +
285                                       " files are not sorted properly");
286           }         
287       
288           // Make sure there is no overlap in levels > 0
289           if (vstorage->InternalComparator()->Compare(f1->largest,
290                                                       f2->smallest) >= 0) {
291             fprintf(stderr, "L%d have overlapping ranges %s vs. %s
", level,
292                     (f1->largest).DebugString(true).c_str(),
293                     (f2->smallest).DebugString(true).c_str());
294             return Status::Corruption(
295                 "L" + NumberToString(level) + " have overlapping ranges " +
296                 (f1->largest).DebugString(true) + " vs. " +
297                 (f2->smallest).DebugString(true));//不退出,给出提示信息
298           }
299         }

以下版本进行了该分支代码修复。

 v6.11.4  v6.10.2 v6.10.1 v6.8.1 v6.7.3 v6.6.4 v6.6.3 v6.5.3 v6.5.2

L版本中,当前默认rocksdb版本。

OSD重启过程中,可以看到rocksdb的版本。
2020-08-10 16:08:22.350071 7f57988afd00  4 rocksdb: RocksDB version: 5.4.0

四、问题总结

建议升级高版本的rocksdb进行相关问题的修复。

五、workaround方法:

  1. ssh到node-3节点,备份当前节点的mon数据库文件
cd /var/lib/ark/ceph/ceph/mon/mon/
mv ceph-node-3 bak.ceph-node-3

ssh到主mon节点,拷贝文件到node-3节点

scp -rp /var/lib/ceph//mon/ceph-node-1 node-3:/var/lib/ceph//mon/ceph-node-3

k8s的 mon本地目录可能在/var/lib/ark/ceph/ceph/mon/mon/

重启mon服务。

ceph mon无法启动-rocksdb数据损坏

原文地址:https://blog.51cto.com/wendashuai/2518835

您可能感兴趣的文档:

--结束END--

本文标题: ceph mon无法启动-rocksdb数据损坏

本文链接: https://www.lsjlt.com/news/7824.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
  • win7注册表损坏无法启动如何修复
    如果你的Windows 7注册表损坏无法启动,可以尝试以下方法进行修复: 使用Windows 7安装光盘:插入Windows 7...
    99+
    2024-02-29
    win7
  • win7注册表损坏无法启动如何解决
    如果您的Windows 7注册表损坏无法启动,可以尝试以下解决方法:1. 使用系统恢复功能:重启计算机,按住F8键进入高级启动选项菜...
    99+
    2023-09-17
    win7
  • 关于mysql数据文件损坏导致的mysql无法启动的问题
    环境 rocky linux 9 (跟centos几乎一模一样) myqsl 8.0, 存储引擎使用innodb 问题描述 服务器异常关机,重启启动后发现mysql无法连接,使用命令查看mysql状态: systemctl status ...
    99+
    2023-10-21
    mysql 数据库
  • Win7无法启动提示pci.sys文件损坏或丢失
    Win7无法启动提示pci.sys文件损坏或丢失怎么办?最近一位Win7用户启动后,出现了提示由于以下文件的损坏或丢失,Windows无法启动:system32\drivers\pci.sys,面对这个故障该如何解决?下面请听小编的分解。P...
    99+
    2023-07-12
  • win7系统注册表损坏无法启动怎么修复
    电脑中的许多操作都要根据注册表来开展,可是部分win7客户遇到了系统注册表损坏无法启动的状况,这种情况要怎么修复呢?你先进到BIOS页面,随后先后选择AdvancedBIOSFeatures、HardDiskBootPriority,以后将...
    99+
    2023-07-17
  • 解决Windows无法启动提示hal.dll损坏或丢失的方法
      出现Windows无法启动提示hal.dll损坏或丢的原因有:   1、GHOST系统引起,GHOST原封装的系统文件与   2、偶然的系统非正常关机后,开机就无法启动,使用系统修复盘修复提示system32\\ha...
    99+
    2023-06-09
    hal.dll丢失怎么办 hal.dll文件下载 Windows hal.dll 方法
  • win10注册表丢失或损坏无法启动如何解决
    当Windows 10的注册表丢失或损坏时,可以尝试以下方法解决:1. 使用Windows 10安装盘修复系统:将Windows 1...
    99+
    2023-09-01
    win10
  • 最终解决win7系统注册表损坏无法启动图文教程
    如果您的计算机因为选择重新安装系统或对计算机系统而由于系统注册表文件丢失或损坏,windows无法加载,这主要是由系统损坏引起的。您可以尝试使用以下方法来解决这个问题。如果您在启动计算机时发现您的信息丢失或系统出现损坏,一般来说这是由于系统...
    99+
    2023-07-13
  • Win8文件损坏无法自动修复的尝试解决方法
    一、检查映像是否可修复 1.扫描映像来检查损坏。在管理员命令提示符下键入以下命令: Dism /Online /Cleanup-Image /ScanHealth 这条命令将扫描全部系统文件并和官方系统文件对比,扫描计算...
    99+
    2023-06-04
    Win8 文件损坏 自动修复 解决 尝试 文件 方法
  • win7 explorer无法启动已破坏怎么解决
    今天小编给大家分享一下win7 explorer无法启动已破坏怎么解决的相关知识点,内容详细,逻辑清晰,相信大部分人都还太了解这方面的知识,所以分享这篇文章给大家参考一下,希望大家阅读完这篇文章后有所收获,下面我们一起来了解一下吧。win7...
    99+
    2023-07-01
  • 记一次数据崩溃无法启动
    场景:远程拷贝的/var/lib/mysql/*的所有文件打包后拖到本地后无法启动。(导表因为数据库太大导表相当漫长,偷懒了....启动时一同报错....), 版本:sys:Linux console 3....
    99+
    2024-04-02
  • Linux系统下的/boot目录破损无法启动怎么办
    本篇内容主要讲解“Linux系统下的/boot目录破损无法启动怎么办”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“Linux系统下的/boot目录破损无法启动怎么办”吧!linux系统中的/bo...
    99+
    2023-06-16
  • phpstudy数据库无法启动在如何解决
    如果phpstudy数据库无法启动,您可以尝试以下几种解决方法: 检查端口是否被占用:打开cmd命令窗口,输入命令netstat...
    99+
    2023-10-24
    phpstudy
  • 电脑移动硬盘文件或目录损坏且无法读取如何解决
    本文小编为大家详细介绍“电脑移动硬盘文件或目录损坏且无法读取如何解决”,内容详细,步骤清晰,细节处理妥当,希望这篇“电脑移动硬盘文件或目录损坏且无法读取如何解决”文章能帮助大家解决疑惑,下面跟着小编的思路慢慢深入,一起来学习新知识吧。移动硬...
    99+
    2023-07-01
  • Mysql无法启动情况下怎么恢复数据
    如果MySQL无法启动,但数据文件仍然存在,您可以尝试以下方法来恢复数据: 检查错误日志:首先查看MySQL的错误日志文件,通常...
    99+
    2024-04-09
    Mysql
  • SQLSERVER2008 errorlog过大导致数据库无法启动怎么办
    这篇文章主要介绍了SQLSERVER2008 errorlog过大导致数据库无法启动怎么办,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。早上...
    99+
    2024-04-02
  • MySQL数据库安装后服务无法启动的解决办法
    目录背景:1.配置环境变量2、修改my-default.ini(如果没有就新增.ini文件)3、以管理员身份运行cmd4、输入net start mysql,启动服务5、输入mysq...
    99+
    2024-04-02
  • 记一次ORA-01102导致数据库实例无法启动案例
    1.现象 由于之前启动过一次报错,首先关闭数据库,然后重启 $ sqlplus / as sysdba SQL*Plus: Release 11.2.0.2.0 Production on ...
    99+
    2024-04-02
  • 怎么解决Oracle RAC数据库个别资源无法自动启动问题
    本篇内容主要讲解“怎么解决Oracle RAC数据库个别资源无法自动启动问题”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“怎么解决Oracle RAC数据库个别...
    99+
    2024-04-02
  • MySQL磁盘空间满导致表空间相关数据文件损坏的处理方法
    这篇文章主要讲解了“MySQL磁盘空间满导致表空间相关数据文件损坏的处理方法”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“MySQL磁盘空间满导致表空间相关...
    99+
    2024-04-02
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作