tongsiying

阅读|运动|自律

0%

BlockStorage-Master

# 001-常用接口
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
1.查主Master(选主机制优化成和etcd一致,通过版本号进行选主)
[root@host102442549 Speed]# curl "http://127.0.0.1:8787/checkmaster?pretty=y"
{
"isleader:": false,
"leader": "10.238.161.3:9393"
}

和etcd选主方式一致:
1.三个master会生成版本号,那个版本号最小那个就是最小,重启master版本号会重新生成且变大
2.主master down掉,剩下两个master不会生成最新版本号


[root@host102442549 Speed]# ETCDCTL_API=3 etcdctl --endpoints="http://10.238.161.1:2379,http://10.238.161.2:2379,http://10.238.161.3:2379" get /master --prefix
/master/da570f6af67a9a1
10.238.161.3:9393
/master/da570f6b06f5d99
10.238.161.1:9393
/master/da570f6b06f6b40
10.238.161.2:9393

2.切换主master(换版本场景,避免换主的10s中影响业务)
curl "http://127.0.0.1:8787/master/change?pretty=y"
每1s刷一次主master,切换时主master任务完成后才会切换;

3.集群修复情况(实时)
curl "http://127.0.0.1:8787/repairstate?pretty=y"
{
"UnCleanExtentCount": 0,
"RepairingExtentCount": 0,
"CheckingExtentCount": 0,
"MigratingExtentCount": 0,
"MigratedExtentCount": 1024,
"PrepareMigrateExtentCount": 0,
"PrepareCheckExtentCount": 0,
"PrepareRepaireExtentCount": 0
}
UnCleanExtentCount:表示需要检查和修复的总的extent个数(还未开始)
RepairingExtentCount:正在修复的extent个数
CheckingExtentCount:正在检查的extent个数
MigratingExtentCount:正在迁移的extent个数
MigratedExtentCount:已经迁移成功的,数量直到下次执行均衡时清零
PrepareMigrateExtentCount:准备迁移的extent个数(rebalance会置0,下次迁移不会)
PrepareCheckExtentCount :准备检查的extent个数
PrepareRepaireExtentCount:准备修复的extent个数

均衡、迁移加上池查看修复情况
[root@host102442549 peace]# curl "127.1:8787/repairstate?pretty=y&poolname=snpool001"
{
"TotalMigrateExtentCount": 0,
"PrepareMigrateExtentCount": 0,
"MigratingExtentCount": 0,
"MigratedExtentCount": 0,
"MigrateInExtentCount": 0,
"PrepareRepairExtentCount": 2324,
"RepairingExtentCount": 100,
"PrepareCheckExtentCount": 70455,
"CheckingExtentCount": 0,
"RebalanceRound": 0
}
 
4.查询父卷的子卷信息
curl "http://127.0.0.1:8787/volume?pool=pool-tt&volume=m1109t7&pretty=y"

5.打开日志级别
curl "http://127.0.0.1:8787/log?v=0"

6.打开master的io统计
curl "http://127.0.0.1:8787/sys/debug/iodelayon"
curl "http://127.0.0.1:8787/sys/debug/iodelayoff"

002-参数设置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
设置参数
1.查询master系统参数
curl -X GET "http://127.0.0.1:8787/system/param?pretty=y"
{
"allocationproportion": 2, //超分系数
"capweightcoe": 0.5,//

capweightcoe=-1,Wij=1的时候支持完全随机
1表示只考虑容量Weight=free
0表示只考虑chunk数量Weight=1/chunk
-1表示Weight=1
0.5表示容量和chunk数量都考虑
只能设置0.5、0、1、-1四个值,0.5是默认值;】
"checkbatch": 2000, //单个节点批量检查chunk健康状态的最大数量
"freediff": 53687091200, //池中最大剩余可用容量与当前节点剩余容量的差值"inration": 1, //均衡过程中的迁入节点ratio_in_threshold的阈值
"intertime": 2, //master与etcd之间的心跳间隔时间
"limitmigratenodecount": 2,这个是每次均衡有多少对节点进行均衡(均衡是全局的)
"migratebatch": 100, //单个节点批量迁移chunk的最大数量
"mincapacity": 53687091200, //单个接节点对外服务的最小剩余容量
"outration": 1, //均衡过程中的迁入节点ratio_out_threshold的阈值
"rebalance": 1, //定时均衡的开关0:关闭,1:开启
"rebalancehour": 17, //定时均衡的时间点(小时)
"rebalancemin": 0,//设置定时均衡时间,精确到分钟
"repairbatch": 100, //单个节点批量修复chunk的最大数量
"ttl": 10, //master每次心跳的生命周期(秒),超过该生命周期没有心跳更新,就会重新选主
"useddiff": 107374182400, //池中最大已用容量与最小节点已用容量的差值,如果差值小于该值,系统不会进行均衡操作
"usedratio": 0.9 //单个节点空间使用率阈值,超过该阈值就会停止对外服务
}

2.设置master系统参数:
curl -X PUT http://127.0.0.1:8787/system/param?param=<param> &value=<value>
注:freediff、mincapacity、useddiff单位是G
举例:
 curl -X PUT "http://127.0.0.1:8787/system/param?param=rebalancehour&value=17:15" -v
 curl -X PUT "http://127.0.0.1:8787/system/param?param=allocationproportion&value=1" -v
curl -X PUT "http://127.0.0.1:8787/system/param?param=freediff&value=500" -v   (单位g,默认是500g)

3.设置Gateway、Chunkserver的阀值
curl  -X PUT http://127.0.0.1:8787/service/param?service=chunkserver&ipport=10.37.2.18:9595&param=param1&value=1,2&pretty=y –v
curl -X PUT "http://127.0.0.1:8787/service/param?service=chunkserver&ipport=public&param=RecycleTap&value=2000,1&pretty=y"

ipport=public(改所有设备)
param=参数名(excel0
value=值,2 (2表示权重,值越大优先级越高可以100,数字随意;没有权重就是0)

4.查询Gateway、Chunkserver的阀值
curl -X GET http://127.0.0.1:8787/service/param?service=chunkserver&ipport=10.37.2.18:9595&param=param1  #对单个Chunkserver生效
curl -X GET "http://127.0.0.1:8787/service/param?service=chunkserver&ipport=public&param=DefragMaxAliveObjSum&pretty=y"   #对集群内所有Chunkserver生效
举例:
查Gateway、Chunkserver的参数的权重
curl -X GET "http://10.242.180.207:8787/service/param?service=chunkserver&ipport=public&param=SysOpUploadMaxTps"
要是没有就是0

5.关掉磁盘回收、碎片整理(1是开)
curl -X PUT "http://10.242.180.207:8787/service/param?service=chunkserver& ipport=10.242.208.65:9595&param=DefragSwitch&value=0,0" -v
curl -X PUT "http://10.242.180.207:8787/service/param?service=chunkserver&ipport=10.242.208.65:9595&param=VacuumSwitch&value=0,0" -v

curl -X PUT "http://10.242.180.207:8787/service/param?service=chunkserver&ipport=public&param=VacuumSwitch&value=0,0" -v

curl -X GET "http://10.242.180.207:8787/service/param?service=chunkserver&ipport=public&param=VacuumSwitch&value=0,0" -v

6.特殊的链接克隆支持动态改变最大数量
curl -X  PUT  "http://10.37.2.18:8787/system/param?param=speciallinkcount&value=10&pretty=y"


6.checkbatch
 curl -X PUT "http://127.0.0.1:8787/system/param?param=checkbatch=2000" -v

003-extentid分布

1
2
3
4
5
6
7
8
9
1.list节点上所有chunk的ExtentID信息
curl "http://127.0.0.1:8787/dev/list?ipport=127.0.0.1:9595&pretty=y"
curl "http://127.0.0.1:8787/dev/list?ipport=10.242.180.212:9595&pretty=y"|grep ExtentID|wc -l

2.查看卷在node上的分布(以及他的extent个数)
curl "http://127.0.0.1:8787/volume-distribution?pool=snpool001&volume=v4v001&pretty=y"

3.查看chunkid信息
curl "http://127.0.0.1:8787/chunk?chunkid=000000000081b32100000017&pretty=y"

004-均衡迁移

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
【修复和均衡、迁移都会触发卷降级,降级的卷为正在修复、均衡、迁移】

1.手动均衡命令
curl  "http://127.0.0.1:8787/rebalance"
curl "http://127.0.0.1:8787/rebalance?poolname=snbspool001"
指定池均衡
均衡也需要均衡多轮,是自动的多轮
可以设置每轮均衡数master参数里面设置:migratebatch
均衡是全局的,可以设置每次均衡几个节点

2.取消迁移
curl "http://127.0.0.1:8787/cancelmigrate?poolname=pool-tt&pretty=y" -v

3.设置定时均衡
curl -X PUT "http://10.242.180.208:8787/system/param?param=rebalancehour&value=14:55" -v
value=14:551455分,支持小时、分钟
确保之前的均衡任务已经全部做完了才会启动新的均衡,不然会被取消

4.指定extent个数迁移【随机选extent往外迁移,也支持zone外chunkserver迁移,zone外可能导致多个副本chunk会出现在同一个节点上,慎用】
cur "http://10.242.180.208:8787/migrate?source=10.238.161.6:9595&target=10.238.161.5:9595&count=100"

5、支持设置节点的权重系数:【权重越大 就优先往某个节点创建extent】
curl-X POST "http://127.0.0.1:8787/region/zone/dev?regionid=region1&zoneid=zone2&ipport=10.37.2.19:9595&wij=1"
注:wij为节点的权重系数值为>=0
这个值为最终节点的权重:Wij*Weight
"capweightcoe": 0.5,//只能设置0.5、0、1三个值,0.5是默认值;这个值如果是0.5就表示Weight=free/chunk=489882529.2748143

查看节点具体信息
[root@host102442549 Gateway]# curl "http://127.0.0.1:8787/dev/info?pretty=y&ipport=10.238.161.1:9595"
{
"ExtentCount": 38506,
"Free": 18863416672256,
"Online": true,
"RegionID": "region1",
"Total": 32002304638976,
"Used": 13138887966720,
"Weight": 489882529.2748143,
"Wij": 1,
"ZoneID": "zone1",
"ipport": "10.238.161.1:9595"
}

2、增加支持完全随机(不考虑chunk数量和容量)
curl -X PUT "http://127.0.0.1:8787/system/param?param=capweightcoe&value=-1"
此时各个节点的Weight应该都是1
测试范围:
1.删除节点:包括删除节点前的数据迁移,中途取消等操作。
数据迁移过程中 "Wij"值应该是0(迁移会自动设置为0),如果非0说明异常
取消删除后"Wij"值应该是1,如果非1说明有异常

3.测试设置权重之后,看zone内节点的分布式是否是按照权重的比例分布
权重计算W=Wij*Weight

005-Qos

1
2
3
4
5
6
7
8
9
10
11
1.均衡的iops
curl "http://10.242.180.207:8787/service/param?service=chunkserver&ipport=10.242.180.207:9595&param=MigrateUploadMaxTps"

2.均衡的带宽
curl "http://10.242.180.207:8787/service/param?service=chunkserver&ipport=10.242.180.207:9595&param=MigrateUploadMaxRate"

3.修复的iops
curl "http://10.242.180.207:8787/service/param?service=chunkserver&ipport=10.242.180.207:9595&param=SysOpUploadMaxTps"

4.修复的带宽
curl "http://10.242.180.207:8787/service/param?service=chunkserver&ipport=10.242.180.207:9595&param=SysOpUploadMaxRate"
赞赏一下吧~