ES叢集節點介紹
-
master node:整個叢集的管理者,索引管理,分片管理,以及整個叢集的狀态的管理,master節點是從master候選節點中選出的,成為master候選節點的方式:
node.master:true 預設(true)
-
data node:資料節點,存儲主要資料,負責索引的資料的檢索和聚合等操作,成為data node的方式:
node.data:true 預設(true)
-
coordinating node:協調節點,所有節點都可以接受來自用戶端的請求進行轉發,因為每個節點都知道叢集的所有索引分片的分布情況,但是别的節點,都還肩負着别的工作,如果請求壓力過大,可能會拖垮整個叢集的響應速度,是以就專門有了這個協調節點,他什麼都不用做,隻處理請求和請求結果,是以成為coordinating node的方式:
node.data:false
node.master:false
-
ingest node:預處理節點,主要是對資料進行預處理,比如對字段重命名,分解字段内容,增加字段等,類似于Logstash, 就是對資料進行預處理,ingest裡面可以定義pipeline(管道),pipeline可以由很多個processor(官方預定義28個)構成,用來出來預處理資料,使用方式:先定義好預處理pipeline,然後在存儲資料的時候指定pipeline,如:成為ingest node的方式:
node.ingest:true 預設(true)
// 建立pipeline: 名字為replace_content,如果資料的name字段值是swk,就把name字段的值改為孫悟空
http://xxx.xxx.xxx.xxx:9200/_ingest/pipeline/replace_content
{
"processors":[
{
"set":{
"if":"ctx.name == 'swk'",
"field":"name",
"value":"孫悟空"
}
}
]
}
// 使用pipeline:就是在插入資料時指定你的pipeline名字
http://xxx.xxx.xxx.xxx:9200/person/person?pipeline=replace_content
{
"name":"swk",
"country": "中國",
"age":500
}
// 結果:
{
"took": 2,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"max_score": 5.896224,
"hits": [
{
"_index": "person",
"_type": "person",
"_id": "K5qUSXgBLLjdyTtcB4ZQ",
"_score": 5.896224,
"_source": {
"country": "中國",
"name": "孫悟空",
"age": 500
}
}
]
}
}
當然如果一個節點設定:
node.data:true
node.master:true
node.ingest:true
上面這三個設定隻要設定了,就代表目前節點具備該功能。
參考博文: Elasticsearch Pipeline 詳解.
ingest pipeline的使用簡介.