我在2个不同的kubernetes VMS上有2个弹性集群,我试图与跨集群连接。但是它不起作用,我在下面添加了详细信息,有人能帮助并告诉我我做错了什么或错过了什么吗?我试着从一个橡皮筋连接到另一个橡皮筋,如下所示:
得到_cluster/设置{
"persistent" : {
"cluster" : {
"remote" : {
"cluster_three" : {
"mode" : "proxy",
"proxy_address" : "122.22.111.222:30005"
},
"cluster_two" : {
"mode" : "sniff",
"skip_unavailable" : "false",
"transport" : {
"compress" : "true"
},
"seeds" : [
"122.22.222.182:30005"
]
},
"cluster_one" : {
"seeds" : [
"127.0.0.1:9200"
],
"transport" : {
"ping_schedule" : "30s"
}
}
}
}
},
"transient" : { }
}
}
我试图搜索集群2,我得到以下错误:
{"statusCode":502,"error":"Bad Gateway","message":"Client request timeout"}
,但当我做curl on elastic to cluster_two,我得到这个:旋度122.22.222.182:30005
{
"name" : "elasticsearch-client-7dcc49ddsdsd4-ljwasdpl",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "bOkaIrcFTgetsadaaY114N4a1EQ",
"version" : {
"number" : "7.10.2",
"build_flavor" : "oss",
"build_type" : "docker",
"build_hash" : "747e1cc71def077253878a59143c1f785asdasafa92b9",
"build_date" : "2021-01-13T00:42:12.435326Z",
"build_snapshot" : false,
"lucene_version" : "8.7.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
这是我在kubernetes上为cluster_two配置的SVC:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
elasticsearch-client NodePort 10.111.11.28 <none> 9200:30005/TCP 27m
elasticsearch-discovery ClusterIP 10.111.11.11 <none> 9300/TCP 27m
Elasticsearch发现工作在端口9300而不是9200,当你运行curl时,它作为客户端请求通过端口30005。
请检查9300是否打开以连接跨集群。作为clusterIP运行的elasticsearch-discovery服务您可能必须使用NodePort更改它的类型以从K8s中公开。的loadbalance按要求。
例如
# From cluster 1, we’ll define how the cluster-2 can be accessed
PUT /_cluster/settings
{
"persistent" : {
"cluster" : {
"remote" : {
"us-cluster" : {
"seeds" : [
"127.0.0.1:9300"
]
}
}
}
}
}
您也可以查看:https://www.elastic.co/blog/cross-datacenter-replication-with-elasticsearch-cross-cluster-replication