Ceph 集群 scrub 设置策略(数据一致性校验)

Ceph 集群 scrub 设置策略(数据一致性校验),第1张

基本概念

1、什么是 Scrub

Scrub是 Ceph 集群副本进行数据扫描的 *** 作,用于检测副本间数据的一致性,包括 scrub 和 deep-scrub。其中scrub 只对元数据信息进行扫描,相对比较快;而deep-scrub 不仅对元数据进行扫描,还会对存储的数据进行扫描,相对比较慢。

2、Scrub默认执行周期

OSD 的scrub 默认策略是每天到每周(如果集群负载大周期就是一周,如果集群负载小周期就是一天)进行一次,时间区域默认为全体(0时-24时),deep-scrub默认策略是每周一次。

配置scrub策略

为了避开客户业务高峰时段,建议在晚上0点到第二天早上5点之间,执行scrub *** 作。

1、设置标识位

在任一monitor节点进行如下 *** 作:

2、临时配置

先通过tell 方式,让scrub 时间区间配置立即生效,在任一monitor节点进行如下 *** 作:

3、修改配置文件

为了保证集群服务重启或者节点重启依然有效,需要修改Ceph集群所有节点的配置文件 /etc/ceph/ceph.conf

添加以下区段配置:

注意: 该时间设置需要参考物理节点的时区设置

4、取消标识位

5、向 OSD {osd-num} 下达一个scrub命令. (用通配符 * 把命令下达到所有 OSD 。实测ceph 12.2.x版本不能加*)

6、设置 light scrub 周期

将osd_scrub_min_interval 和 osd_scrub_max_interval都设为4分钟,这里的单位是秒

7、通过命令手动启动scrub :

8、尝试 pg repair

9、(Deep)Scrub的相关配置选项

同前端IO和Recovery一样,Ceph通过控制PGScrub来间接控制Scrub的所有IO优先级。

如果nand flash大小没问题,建议这样试试:

nand scrub -y 0xc000000 0x4000000

详情请查看u-boot中的cmd_nand.c文件中相关部分:

/*

* Syntax is:

* 01 2 34

* nand erase [clean] [off size]

*/

if (strncmp(cmd, "erase", 5) == 0 || strncmp(cmd, "scrub", 5) == 0) {

nand_erase_options_t opts

/* "clean" at index 2 means request to write cleanmarker */

int clean = argc >2 &&!strcmp("clean", argv[2])

int scrub_yes = argc >2 &&!strcmp("-y", argv[2])

int o = (clean || scrub_yes) ? 3 : 2

int scrub = !strncmp(cmd, "scrub", 5)

int spread = 0

int args = 2

const char *scrub_warn =

"Warning: "

"scrub option will erase all factory set bad blocks!\n"

" "

"There is no reliable way to recover them.\n"

" "

"Use this command only for testing purposes if you\n"

" "

"are sure of what you are doing!\n"

"\nReally scrub this NAND flash? <y/N>\n"

if (cmd[5] != 0) {

if (!strcmp(&cmd[5], ".spread")) {

spread = 1

} else if (!strcmp(&cmd[5], ".part")) {

args = 1

} else if (!strcmp(&cmd[5], ".chip")) {

args = 0

} else {

goto usage

}

}

/*

* Don't allow missing arguments to cause full chip/partition

* erases -- easy to do accidentally, e.g. with a misspelled

* variable name.

*/

if (argc != o + args)

goto usage

printf("\nNAND %s: ", cmd)

/* skip first two or three arguments, look for offset and size */

if (arg_off_size(argc - o, argv + o, &dev, &off, &size) != 0)

return 1

nand = &nand_info[dev]

memset(&opts, 0, sizeof(opts))

opts.offset = off

opts.length = size

opts.jffs2 = clean

opts.quiet = quiet

opts.spread = spread

if (scrub) {

if (!scrub_yes)

puts(scrub_warn)

if (scrub_yes)

opts.scrub = 1

else if (getc() == 'y') {

puts("y")

if (getc() == '\r')

opts.scrub = 1

else {

puts("scrub aborted\n")

return -1

}

} else {

puts("scrub aborted\n")

return -1

}

}

ret = nand_erase_opts(nand, &opts)

printf("%s\n", ret ? "ERROR" : "OK")

return ret == 0 ? 0 : 1

}


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/tougao/12065903.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-20
下一篇 2023-05-20

发表评论

登录后才能评论

评论列表(0条)

保存