Предварительные условия
Перед выполнением этого руководства необходимо настроить репликацию между кластерами для подключения двух кластеров и настройки индекса-фолловера.
В этом практическом руководстве kibana_sample_data_ecommerce реплицируется из clusterA в clusterB.
resp = client.cluster.put_settings(
persistent={
"cluster": {
"remote": {
"clusterA": {
"mode": "proxy",
"skip_unavailable": "true",
"server_name": "clustera.es.region-a.gcp.elastic-cloud.com",
"proxy_socket_connections": "18",
"proxy_address": "clustera.es.region-a.gcp.elastic-cloud.com:9400"
}
}
}
},
)
print(resp) response = client.cluster.put_settings(
body: {
persistent: {
cluster: {
remote: {
"clusterA": {
mode: 'proxy',
skip_unavailable: 'true',
server_name: 'clustera.es.region-a.gcp.elastic-cloud.com',
proxy_socket_connections: '18',
proxy_address: 'clustera.es.region-a.gcp.elastic-cloud.com:9400'
}
}
}
}
}
)
puts response const response = await client.cluster.putSettings({
persistent: {
cluster: {
remote: {
clusterA: {
mode: "proxy",
skip_unavailable: "true",
server_name: "clustera.es.region-a.gcp.elastic-cloud.com",
proxy_socket_connections: "18",
proxy_address: "clustera.es.region-a.gcp.elastic-cloud.com:9400",
},
},
},
},
});
console.log(response); ### On clusterB ###
PUT _cluster/settings
{
"persistent": {
"cluster": {
"remote": {
"clusterA": {
"mode": "proxy",
"skip_unavailable": "true",
"server_name": "clustera.es.region-a.gcp.elastic-cloud.com",
"proxy_socket_connections": "18",
"proxy_address": "clustera.es.region-a.gcp.elastic-cloud.com:9400"
}
}
}
}
} resp = client.ccr.follow(
index="kibana_sample_data_ecommerce2",
wait_for_active_shards="1",
remote_cluster="clusterA",
leader_index="kibana_sample_data_ecommerce",
)
print(resp) const response = await client.ccr.follow({
index: "kibana_sample_data_ecommerce2",
wait_for_active_shards: 1,
remote_cluster: "clusterA",
leader_index: "kibana_sample_data_ecommerce",
});
console.log(response); ### On clusterB ###
PUT /kibana_sample_data_ecommerce2/_ccr/follow?wait_for_active_shards=1
{
"remote_cluster": "clusterA",
"leader_index": "kibana_sample_data_ecommerce"
} Записи (такие как загрузка или обновления) должны выполняться только в индексе-лидере. Индексы-фолловеры — только для чтения и не будут принимать записи.
© 2023-2025 Elasticsearch
As of September 2024, Elasticsearch is available under a choice of three licenses: the Server Side Public License (SSPL), the Elastic License, or the AGPLv3 (OSI approved).
Elasticsearch and the Elasticsearch logo are trademarks of Elasticsearch B.V., registered in the U.S. and in other countries.
https://www.elastic.co/guide/en/elasticsearch/reference/8.17/_prerequisites_14.html