elasticsearch文件句柄,段合并操作

1.查看elasticsearch当前占用的文件句柄以及最大支持多少命令

执行下面命令

1
curl -XGET 'http://localhost:9200/_nodes/stats/process?pretty'

 

 

得到结果

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
{
"cluster_name" : "bigdata",
"nodes" : {
"vI_Wjf8lTampVLyfxjfD_w" : {
"timestamp" : 1498373752227,
"name" : "Mister Jip",
"transport_address" : "192.168.1.26:9300",
"host" : "192.168.1.26",
"ip" : [ "192.168.1.26:9300", "NONE" ],
"attributes" : {
"master" : "true"
},
"process" : {
"timestamp" : 1498373752227,
"open_file_descriptors" : 22025,
"max_file_descriptors" : 65535,
"cpu" : {
"percent" : 2,
"total_in_millis" : 73784210
},
"mem" : {
"total_virtual_in_bytes" : 87965753344
}
}
}
}
}

其中 cluster_name代表集群名称; process代表es当前节点的process信息;open_file_descriptors代表当前占用的文件句柄数量;max_file_descriptors代表最大的文件句柄个数

查看索引段信息

执行以下命令

1
curl -XGET 'http://localhost:9200/las-e-2017-06-23/_segments'

 

意思为查看las-e-2017-06-23索引信息的段信息情况,得到结果为

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
"indices" : {
"las-e-2017-06-04" : {
"shards" : {
"0" : [ {
"routing" : {
"state" : "STARTED",
"primary" : true,
"node" : "vI_Wjf8lTampVLyfxjfD_w"
},
"num_committed_segments" : 1,
"num_search_segments" : 1,
"segments" : {
"_kn1" : {
"generation" : 26749,
"num_docs" : 248501,
"deleted_docs" : 0,
"size_in_bytes" : 62363970,
"memory_in_bytes" : 419388,
"committed" : true,
"search" : true,
"version" : "5.5.0",
"compound" : false
}
}
} ],
"1" : [ {
"routing" : {
"state" : "STARTED",
"primary" : true,
"node" : "vI_Wjf8lTampVLyfxjfD_w"
},
"num_committed_segments" : 1,
"num_search_segments" : 1,
"segments" : {
"_kbz" : {
"generation" : 26351,
"num_docs" : 248426,
"deleted_docs" : 0,
"size_in_bytes" : 62322932,
"memory_in_bytes" : 417771,
"committed" : true,
"search" : true,
"version" : "5.5.0",
"compound" : false
}
}
} ]
}
}
}

如图以上所示可以看到有0,1两个段信息。

强制执行段合并操作

假如我们需要强制执行段合并操作,且将索引信息合并为一个shards一个段,则要加入参数max_num_segments=1,此操作执行过程中会消耗设备的IO,内存以及cpu等情况。如果要合并多个索引,则执行时间较长。执行命令为:

1
curl -XPOST 'http://localhost:9200/las-e-2017-02-11/ _forcemerge?max_num_segments=1'

以上命令意思为,强制对索引las-e-2017-02-11进行段合并操作,合并完成会返回数据格式类似与:

1
{"_shards":{"total":5,"successful":5,"failed":0}}

你可能感兴趣的:(大数据)