remote-clusters.asciidoc 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. [[modules-remote-clusters]]
  2. == Remote clusters
  3. ifndef::include-xpack[]
  4. The _remote clusters_ module enables you to establish uni-directional
  5. connections to a remote cluster. This functionality is used in
  6. <<modules-cross-cluster-search,{ccs}>>.
  7. endif::[]
  8. ifdef::include-xpack[]
  9. The _remote clusters_ module enables you to establish uni-directional
  10. connections to a remote cluster. This functionality is used in
  11. {stack-ov}/xpack-ccr.html[{ccr}] and
  12. <<modules-cross-cluster-search,{ccs}>>.
  13. endif::[]
  14. Remote cluster connections work by configuring a remote cluster and connecting
  15. only to a limited number of nodes in that remote cluster. Each remote cluster
  16. is referenced by a name and a list of seed nodes. When a remote cluster is
  17. registered, its cluster state is retrieved from one of the seed nodes and up
  18. to three _gateway nodes_ are selected to be connected to as part of remote
  19. cluster requests. All the communication required between different clusters
  20. goes through the <<modules-transport,transport layer>>. Remote cluster
  21. connections consist of uni-directional connections from the coordinating
  22. node to the selected remote _gateway nodes_ only.
  23. [float]
  24. [[gateway-nodes-selection]]
  25. === Gateway nodes selection
  26. The _gateway nodes_ selection depends on the following criteria:
  27. - *version*: Remote nodes must be compatible with the cluster they are
  28. registered to. This is subject to rules that are similar to those for
  29. <<rolling-upgrades>>. Any node can communicate with any other node on the same
  30. major version (e.g. 7.0 can talk to any 7.x node). Only nodes on the last minor
  31. version of a certain major version can communicate with nodes on the following
  32. major version. Note that in the 6.x series, 6.8 can communicate with any 7.x
  33. node, while 6.7 can only communicate with 7.0. Version compatibility is
  34. symmetric, meaning that if 6.7 can communicate with 7.0, 7.0 can also
  35. communicate with 6.7. The matrix below summarizes compatibility as described above.
  36. [cols="^,^,^,^,^,^,^,^"]
  37. |====
  38. | Compatibility | 5.0->5.5 | 5.6 | 6.0->6.6 | 6.7 | 6.8 | 7.0 | 7.1->7.x
  39. | 5.0->5.5 | Yes | Yes | No | No | No | No | No
  40. | 5.6 | Yes | Yes | Yes | Yes | Yes | No | No
  41. | 6.0->6.6 | No | Yes | Yes | Yes | Yes | No | No
  42. | 6.7 | No | Yes | Yes | Yes | Yes | Yes | No
  43. | 6.8 | No | Yes | Yes | Yes | Yes | Yes | Yes
  44. | 7.0 | No | No | No | Yes | Yes | Yes | Yes
  45. | 7.1->7.x | No | No | No | No | Yes | Yes | Yes
  46. |====
  47. - *role*: Dedicated master nodes never get selected.
  48. - *attributes*: You can tag which nodes should be selected
  49. (see <<remote-cluster-settings>>), though such tagged nodes still have
  50. to satisfy the two above requirements.
  51. [float]
  52. [[configuring-remote-clusters]]
  53. === Configuring remote clusters
  54. You can configure remote clusters globally by using
  55. <<cluster-update-settings,cluster settings>>, which you can update dynamically.
  56. Alternatively, you can configure them locally on individual nodes by using the
  57. `elasticsearch.yml` file.
  58. If you specify the settings in `elasticsearch.yml` files, only the nodes with
  59. those settings can connect to the remote cluster. In other words, functionality
  60. that relies on remote cluster requests must be driven specifically from those
  61. nodes. For example:
  62. [source,yaml]
  63. --------------------------------
  64. cluster:
  65. remote:
  66. cluster_one: <1>
  67. seeds: 127.0.0.1:9300 <2>
  68. transport.ping_schedule: 30s <3>
  69. cluster_two:
  70. seeds: 127.0.0.1:9301
  71. transport.compress: true <4>
  72. skip_unavailable: true <5>
  73. --------------------------------
  74. <1> `cluster_one` and `cluster_two` are arbitrary _cluster aliases_ representing
  75. the connection to each cluster. These names are subsequently used to distinguish
  76. between local and remote indices.
  77. <2> The hostname and <<modules-transport,transport>> port (default: 9300) of a
  78. seed node in the remote cluster.
  79. <3> A keep-alive ping is configured for `cluster_one`.
  80. <4> Compression is explicitly enabled for requests to `cluster_two`.
  81. <5> Disconnected remote clusters are optional for `cluster_two`.
  82. For more information about the optional transport settings, see
  83. <<modules-transport>>.
  84. If you use <<cluster-update-settings,cluster settings>>, the remote clusters
  85. are available on every node in the cluster. For example:
  86. [source,console]
  87. --------------------------------
  88. PUT _cluster/settings
  89. {
  90. "persistent": {
  91. "cluster": {
  92. "remote": {
  93. "cluster_one": {
  94. "seeds": [
  95. "127.0.0.1:9300"
  96. ],
  97. "transport.ping_schedule": "30s"
  98. },
  99. "cluster_two": {
  100. "seeds": [
  101. "127.0.0.1:9301"
  102. ],
  103. "transport.compress": true,
  104. "skip_unavailable": true
  105. },
  106. "cluster_three": {
  107. "seeds": [
  108. "127.0.0.1:9302"
  109. ]
  110. }
  111. }
  112. }
  113. }
  114. }
  115. --------------------------------
  116. // TEST[setup:host]
  117. // TEST[s/127.0.0.1:9300/\${transport_host}/]
  118. You can dynamically update the compression and ping schedule settings. However,
  119. you must re-include seeds in the settings update request. For example:
  120. [source,console]
  121. --------------------------------
  122. PUT _cluster/settings
  123. {
  124. "persistent": {
  125. "cluster": {
  126. "remote": {
  127. "cluster_one": {
  128. "seeds": [
  129. "127.0.0.1:9300"
  130. ],
  131. "transport.ping_schedule": "60s"
  132. },
  133. "cluster_two": {
  134. "seeds": [
  135. "127.0.0.1:9301"
  136. ],
  137. "transport.compress": false
  138. }
  139. }
  140. }
  141. }
  142. }
  143. --------------------------------
  144. // TEST[continued]
  145. NOTE: When the compression or ping schedule settings change, all the existing
  146. node connections must close and re-open, which can cause in-flight requests to
  147. fail.
  148. A remote cluster can be deleted from the cluster settings by setting its seeds and optional settings to `null` :
  149. [source,console]
  150. --------------------------------
  151. PUT _cluster/settings
  152. {
  153. "persistent": {
  154. "cluster": {
  155. "remote": {
  156. "cluster_two": { <1>
  157. "seeds": null,
  158. "skip_unavailable": null,
  159. "transport": {
  160. "compress": null
  161. }
  162. }
  163. }
  164. }
  165. }
  166. }
  167. --------------------------------
  168. // TEST[continued]
  169. <1> `cluster_two` would be removed from the cluster settings, leaving
  170. `cluster_one` and `cluster_three` intact.
  171. [float]
  172. [[remote-cluster-settings]]
  173. === Remote cluster settings
  174. `cluster.remote.connections_per_cluster`::
  175. The number of gateway nodes to connect to per remote cluster. The default is
  176. `3`.
  177. `cluster.remote.initial_connect_timeout`::
  178. The time to wait for remote connections to be established when the node
  179. starts. The default is `30s`.
  180. `cluster.remote.node.attr`::
  181. A node attribute to filter out nodes that are eligible as a gateway node in
  182. the remote cluster. For instance a node can have a node attribute
  183. `node.attr.gateway: true` such that only nodes with this attribute will be
  184. connected to if `cluster.remote.node.attr` is set to `gateway`.
  185. `cluster.remote.connect`::
  186. By default, any node in the cluster can act as a cross-cluster client and
  187. connect to remote clusters. The `cluster.remote.connect` setting can be set to
  188. `false` (defaults to `true`) to prevent certain nodes from connecting to
  189. remote clusters. Remote cluster requests must be sent to a node that is
  190. allowed to act as a cross-cluster client.
  191. `cluster.remote.${cluster_alias}.skip_unavailable`::
  192. Per cluster boolean setting that allows to skip specific clusters when no
  193. nodes belonging to them are available and they are the targetof a remote
  194. cluster request. Default is `false`, meaning that all clusters are mandatory
  195. by default, but they can selectively be made optional by setting this setting
  196. to `true`.
  197. `cluster.remote.${cluster_alias}.transport.ping_schedule`::
  198. Sets the time interval between regular application-level ping messages that
  199. are sent to ensure that transport connections to nodes belonging to remote
  200. clusters are kept alive. If set to `-1`, application-level ping messages to
  201. this remote cluster are not sent. If unset, application-level ping messages
  202. are sent according to the global `transport.ping_schedule` setting, which
  203. defaults to `-1` meaning that pings are not sent.
  204. `cluster.remote.${cluster_alias}.transport.compress`::
  205. Per cluster boolean setting that enables you to configure compression for
  206. requests to a specific remote cluster. This setting impacts only requests
  207. sent to the remote cluster. If the inbound request is compressed,
  208. Elasticsearch compresses the response. If unset, the global
  209. `transport.compress` is used as the fallback setting.
  210. `cluster.remote.${cluster_alias}.proxy`::
  211. Sets a proxy address for the specified remote cluster. By default this is not
  212. set, meaning that Elasticsearch will connect directly to the nodes in the
  213. remote cluster using their <<advanced-network-settings,publish addresses>>.
  214. If this setting is set to an IP address or hostname then Elasticsearch will
  215. connect to the nodes in the remote cluster using this address instead.
  216. [float]
  217. [[retrieve-remote-clusters-info]]
  218. === Retrieving remote clusters info
  219. You can use the <<cluster-remote-info, remote cluster info API>> to retrieve
  220. information about the configured remote clusters, as well as the remote nodes
  221. that the node is connected to.