remote-clusters.asciidoc 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. [[modules-remote-clusters]]
  2. == Remote clusters
  3. ifndef::include-xpack[]
  4. The _remote clusters_ module allows establishing uni-directional connections to
  5. a remote cluster. This functionality is used in
  6. <<modules-cross-cluster-search,cross-cluster search>>.
  7. endif::[]
  8. ifdef::include-xpack[]
  9. The _remote clusters_ module allows establishing uni-directional connections to
  10. a remote cluster. This functionality is used in cross-cluster replication, and
  11. <<modules-cross-cluster-search,cross-cluster search>>.
  12. endif::[]
  13. Remote cluster connections work by configuring a remote cluster and connecting
  14. only to a limited number of nodes in the remote cluster. Each remote cluster is
  15. referenced by a name and a list of seed nodes. When a remote cluster is
  16. registered, its cluster state is retrieved from one of the seed nodes so that by
  17. default up to three _gateway nodes_ are selected to be connected to as part of
  18. remote cluster requests. Remote cluster connections consist of uni-directional
  19. connections from the coordinating node to the previously selected remote nodes
  20. only. It is possible to tag which nodes should be selected through node
  21. attributes (see <<remote-cluster-settings>>).
  22. Each node in a cluster that has remote clusters configured connects to one or
  23. more _gateway nodes_ and uses them to federate requests to the remote cluster.
  24. [float]
  25. [[configuring-remote-clusters]]
  26. === Configuring Remote Clusters
  27. Remote clusters can be specified globally using
  28. <<cluster-update-settings,cluster settings>> (which can be updated dynamically),
  29. or local to individual nodes using the `elasticsearch.yml` file.
  30. If a remote cluster is configured via `elasticsearch.yml` only the nodes with
  31. that configuration will be able to connect to the remote cluster. In other
  32. words, functionality that relies on remote cluster requests will have to be
  33. driven specifically from those nodes. Remote clusters set via the
  34. <<cluster-update-settings,cluster settings API>> will be available on every node
  35. in the cluster.
  36. The `elasticsearch.yml` config file for a node that connects to remote clusters
  37. needs to list the remote clusters that should be connected to, for instance:
  38. [source,yaml]
  39. --------------------------------
  40. cluster:
  41. remote:
  42. cluster_one: <1>
  43. seeds: 127.0.0.1:9300
  44. cluster_two: <1>
  45. seeds: 127.0.0.1:9301
  46. --------------------------------
  47. <1> `cluster_one` and `cluster_two` are arbitrary _cluster aliases_ representing
  48. the connection to each cluster. These names are subsequently used to distinguish
  49. between local and remote indices.
  50. The equivalent example using the <<cluster-update-settings,cluster settings
  51. API>> to add remote clusters to all nodes in the cluster would look like the
  52. following:
  53. [source,js]
  54. --------------------------------
  55. PUT _cluster/settings
  56. {
  57. "persistent": {
  58. "cluster": {
  59. "remote": {
  60. "cluster_one": {
  61. "seeds": [
  62. "127.0.0.1:9300"
  63. ]
  64. },
  65. "cluster_two": {
  66. "seeds": [
  67. "127.0.0.1:9301"
  68. ]
  69. },
  70. "cluster_three": {
  71. "seeds": [
  72. "127.0.0.1:9302"
  73. ]
  74. }
  75. }
  76. }
  77. }
  78. }
  79. --------------------------------
  80. // CONSOLE
  81. // TEST[setup:host]
  82. // TEST[s/127.0.0.1:9300/\${transport_host}/]
  83. A remote cluster can be deleted from the cluster settings by setting its seeds
  84. to `null`:
  85. [source,js]
  86. --------------------------------
  87. PUT _cluster/settings
  88. {
  89. "persistent": {
  90. "cluster": {
  91. "remote": {
  92. "cluster_three": {
  93. "seeds": null <1>
  94. }
  95. }
  96. }
  97. }
  98. }
  99. --------------------------------
  100. // CONSOLE
  101. // TEST[continued]
  102. <1> `cluster_three` would be removed from the cluster settings, leaving
  103. `cluster_one` and `cluster_two` intact.
  104. [float]
  105. [[remote-cluster-settings]]
  106. === Remote cluster settings
  107. `cluster.remote.connections_per_cluster`::
  108. The number of gateway nodes to connect to per remote cluster. The default is
  109. `3`.
  110. `cluster.remote.initial_connect_timeout`::
  111. The time to wait for remote connections to be established when the node
  112. starts. The default is `30s`.
  113. `cluster.remote.node.attr`::
  114. A node attribute to filter out nodes that are eligible as a gateway node in
  115. the remote cluster. For instance a node can have a node attribute
  116. `node.attr.gateway: true` such that only nodes with this attribute will be
  117. connected to if `cluster.remote.node.attr` is set to `gateway`.
  118. `cluster.remote.connect`::
  119. By default, any node in the cluster can act as a cross-cluster client and
  120. connect to remote clusters. The `cluster.remote.connect` setting can be set to
  121. `false` (defaults to `true`) to prevent certain nodes from connecting to
  122. remote clusters. Remote cluster requests must be sent to a node that is
  123. allowed to act as a cross-cluster client.
  124. `cluster.remote.${cluster_alias}.skip_unavailable`::
  125. Per cluster boolean setting that allows to skip specific clusters when no
  126. nodes belonging to them are available and they are the targetof a remote
  127. cluster request. Default is `false`, meaning that all clusters are mandatory
  128. by default, but they can selectively be made optional by setting this setting
  129. to `true`.
  130. `cluster.remote.${cluster_alias}.transport.ping_schedule`::
  131. Sets the time interval between regular application-level ping messages that
  132. are sent to ensure that transport connections to nodes belonging to remote
  133. clusters are kept alive. If set to `-1`, application-level ping messages to
  134. this remote cluster are not sent. If unset, application-level ping messages
  135. are sent according to the global `transport.ping_schedule` setting, which
  136. defaults to ``-1` meaning that pings are not sent.
  137. `cluster.remote.${cluster_alias}.transport.compress`::
  138. Per cluster boolean setting that enables you to configure compression for
  139. requests to a specific remote cluster. This setting impacts only requests
  140. sent to the remote cluster. If the inbound request is compressed,
  141. Elasticsearch compresses the response. If unset, the global
  142. `transport.compress` is used as the fallback setting.
  143. [float]
  144. [[retrieve-remote-clusters-info]]
  145. === Retrieving remote clusters info
  146. The <<cluster-remote-info, Remote Cluster Info API>> allows to retrieve
  147. information about the configured remote clusters, as well as the remote nodes
  148. that the node is connected to.