当前位置:网站首页>Es remote cluster configuration and cross cluster search
Es remote cluster configuration and cross cluster search
2022-07-03 05:58:00 【Ashley shot the sun】
ES Remote clusters can be configured in to realize cross cluster search , Greatly improved ES Horizontal scalability of clusters , Cross cluster search is also ES Knowledge points often tested in certification examination . This article briefly summarizes ES Configuration of remote cluster and cross cluster search as a reminder , Also hope to help students in need .
One . Configure remote cluster
In order to realize cross cluster search, you first need to configure the remote cluster in the current cluster , We can configure in the following three ways :
1. Profile Settings
First, you can ElasticSearch Of yml Set... In the configuration file ,ES A link with the remote cluster will be established at startup , The configuration is as follows :
cluster:
remote:
cluster_one:
seeds: 127.0.0.1:9300
transport.ping_schedule: 30s
cluster_two:
seeds: 127.0.0.1:9301
transport.compress: true
skip_unavailable: true
Configuration instructions
cluster_one: Custom cluster nameseeds: The node list of the cluster , You can configure multipletransport.ping_schedule: Set up to send ping Time interval between requests to detect connection statusskip_unavailable: Cross cluster search whether to skip unavailable clusters
2. ES The request is set
In addition to configuration files , You can also use ES Set the remote cluster by request , This is also a recommended way ,API as follows :
1. CURL request
curl -XPUT "http://localhost:9202/_cluster/settings" -H 'Content-Type: application/json' -d'
{
"persistent":{
"cluster":{
"remote":{
"cluster0":{
"seeds":["127.0.0.1:9300"],"transport.ping_schedule":"30s"},"cluster1":{
"seeds":["127.0.0.1:9301"],"transport.compress":true,"skip_unavailable":true},"cluster2":{
"seeds":["127.0.0.1:9302"]}}}}}
2. ES DSL command
PUT _cluster/settings
{
"persistent": {
"cluster": {
"remote": {
"cluster_one": {
"seeds": [
"127.0.0.1:9300"
],
"transport.ping_schedule": "60s"
},
"cluster_two": {
"mode": "sniff",
"seeds": [
"127.0.0.1:9301"
],
"transport.compress": false
},
"cluster_three": {
"mode": "proxy",
"proxy_address": "127.0.0.1:9302",
"transport.compress": true
}
}
}
}
}
3. Kibana Management add to
In addition to the above two ways , We can still do that Kibana Management interface Management -> Remote clusters To configure , The steps are as shown in the figure :
There are already two configurations in the above figure , I am adding a new cluster as follows :
Now three remote clusters are configured , Pictured

After configuration, you can use the following API Inquire about :
GET _remote/info
{
"cluster1" : {
"seeds" : [
"127.0.0.1:9301"
],
"connected" : true,
"num_nodes_connected" : 1,
"max_connections_per_cluster" : 3,
"initial_connect_timeout" : "30s",
"skip_unavailable" : true
},
"cluster0" : {
"seeds" : [
"127.0.0.1:9300"
],
"connected" : true,
"num_nodes_connected" : 1,
"max_connections_per_cluster" : 3,
"initial_connect_timeout" : "30s",
"skip_unavailable" : false
},
"cluster2" : {
"seeds" : [
"127.0.0.1:9301"
],
"connected" : true,
"num_nodes_connected" : 1,
"max_connections_per_cluster" : 3,
"initial_connect_timeout" : "30s",
"skip_unavailable" : true
}
}
4. Delete remote cluster
If a remote cluster is no longer needed , Can pass Kibana Interface or the following command to delete :
PUT _cluster/settings
{
"persistent": {
"cluster": {
"remote": {
"cluster_two": {
"seeds": null,
"skip_unavailable": null,
"transport": {
"compress": null
}
}
}
}
}
}
Two . Cross cluster search
After the remote cluster configuration is completed, cross cluster search can be carried out ,API It's simple , Is in the Search Specify the corresponding cluster and index in the request .
1. Search local clusters
Specify the index name directly, and the default search is local colony .
GET /twitter/_search
{
"query": {
"match": {
"user": "kimchy"
}
}
}
2. Search in a specified single cluster
For remote clusters, we need to adopt Cluster name : Index name The way of specifying .
# stay cluster_one Search in the remote cluster
GET /cluster_one:twitter/_search
{
"query": {
"match": {
"user": "kimchy"
}
}
}
3. Realize cross cluster search in multiple clusters
# stay local、clustr_one、cluster_two Search in three clusters
GET /twitter,cluster_one:twitter,cluster_two:twitter/_search
{
"query": {
"match": {
"user": "kimchy"
}
}
}
3、 ... and . ES Cross cluster search process
ES Cross cluster search modes mainly include Minimize network roundtrips and Don’t minimize network roundtrips Two ways . The main difference between the two is the number of requests sent when performing a search :
Minimize network roundtrips Pattern
Coordinating After the node receives the cross cluster request , A node will be selected in each cluster to be searched , Then send a search request , After receiving the search results, aggregate and return .
The process is as follows :
【1】 Receive client requests

【2】 Request cluster

【3】 Receive the query structure of each cluster

【4】 Return query results after aggregation

Don’t minimize network roundtrips
In this mode ,Coordinating After the node receives the cross cluster request , First, a message will be sent to each cluster Query fragmentation Request , Query the fragment information available for data query in each cluster , Then send a search request to each partition , Finally, aggregate the query results and return .
The specific process is as follows :
【1】 The client receives the request

【2】 Query each cluster partition

Receive fragment query results 
【3】 Send query request to each partition

【4】 Receive the request results of each partition

【5】 Aggregate the results and return

Lao tie saw this and gave a wave of praise 、 Comment on 、 How about paying attention to Sanlian
I am a AhriJ Zou classmate , Front and rear ends 、 Applet 、DevOps Are engaged in the explosion of stack engineers . The blog is constantly updated , If you think it's good , Welcome to the old tiesanlian , If it's not good, you're welcome to correct , learn from each other , Common progress .
边栏推荐
- 今天很多 CTO 都是被幹掉的,因為他沒有成就業務
- Understand one-way hash function
- 期末复习DAY8
- 70 shell script interview questions and answers
- Apache+php+mysql environment construction is super detailed!!!
- Redis cannot connect remotely.
- Troubleshooting of 32GB Jetson Orin SOM failure to brush
- Using the ethtool command by example
- BeanDefinitionRegistryPostProcessor
- Redhat7系统root用户密码破解
猜你喜欢

Pytorch builds the simplest version of neural network

Method of finding prime number

pytorch 多分类中的损失函数
![[trivia of two-dimensional array application] | [simple version] [detailed steps + code]](/img/84/98c1220d0f7bc3a948125ead6ff3d9.jpg)
[trivia of two-dimensional array application] | [simple version] [detailed steps + code]

【一起上水硕系列】Day 10
![[escape character] [full of dry goods] super detailed explanation + code illustration!](/img/33/ec5a5e11bfd43f53f2767a9a0f0cc9.jpg)
[escape character] [full of dry goods] super detailed explanation + code illustration!

卷积神经网络CNN中的卷积操作详解

Mapbox tasting value cloud animation

Convolution operation in convolution neural network CNN

Linux登录MySQL出现ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)
随机推荐
Detailed explanation of iptables (1): iptables concept
MySQL startup error: several solutions to the server quit without updating PID file
[teacher Zhao Yuqiang] use the catalog database of Oracle
[written examination question analysis] | | get [sizeof and strlen] [pointer and array] graphic explanation + code analysis
Clickhouse learning notes (2): execution plan, table creation optimization, syntax optimization rules, query optimization, data consistency
Life is a process of continuous learning
Final review (Day2)
Why should there be a firewall? This time xiaowai has something to say!!!
pytorch 多分类中的损失函数
2022.7.2day594
88. 合并两个有序数组
88. Merge two ordered arrays
[set theory] relational closure (reflexive closure | symmetric closure | transitive closure)
一起上水碩系列】Day 9
Bernoulli distribution, binomial distribution and Poisson distribution, and the relationship between maximum likelihood (incomplete)
Bio, NiO, AIO details
2022.7.2 simulation match
JS implements the problem of closing the current child window and refreshing the parent window
Final review (Day5)
Exception when introducing redistemplate: noclassdeffounderror: com/fasterxml/jackson/core/jsonprocessingexception