remote-clusters.asciidoc 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  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,js]
  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. // CONSOLE
  117. // TEST[setup:host]
  118. // TEST[s/127.0.0.1:9300/\${transport_host}/]
  119. You can dynamically update the compression and ping schedule settings. However,
  120. you must re-include seeds in the settings update request. For example:
  121. [source,js]
  122. --------------------------------
  123. PUT _cluster/settings
  124. {
  125. "persistent": {
  126. "cluster": {
  127. "remote": {
  128. "cluster_one": {
  129. "seeds": [
  130. "127.0.0.1:9300"
  131. ],
  132. "transport.ping_schedule": "60s"
  133. },
  134. "cluster_two": {
  135. "seeds": [
  136. "127.0.0.1:9301"
  137. ],
  138. "transport.compress": false
  139. }
  140. }
  141. }
  142. }
  143. }
  144. --------------------------------
  145. // CONSOLE
  146. // TEST[continued]
  147. NOTE: When the compression or ping schedule settings change, all the existing
  148. node connections must close and re-open, which can cause in-flight requests to
  149. fail.
  150. A remote cluster can be deleted from the cluster settings by setting its seeds and optional settings to `null` :
  151. [source,js]
  152. --------------------------------
  153. PUT _cluster/settings
  154. {
  155. "persistent": {
  156. "cluster": {
  157. "remote": {
  158. "cluster_two": { <1>
  159. "seeds": null,
  160. "skip_unavailable": null,
  161. "transport": {
  162. "compress": null
  163. }
  164. }
  165. }
  166. }
  167. }
  168. }
  169. --------------------------------
  170. // CONSOLE
  171. // TEST[continued]
  172. <1> `cluster_two` would be removed from the cluster settings, leaving
  173. `cluster_one` and `cluster_three` intact.
  174. [float]
  175. [[remote-cluster-settings]]
  176. === Remote cluster settings
  177. `cluster.remote.connections_per_cluster`::
  178. The number of gateway nodes to connect to per remote cluster. The default is
  179. `3`.
  180. `cluster.remote.initial_connect_timeout`::
  181. The time to wait for remote connections to be established when the node
  182. starts. The default is `30s`.
  183. `cluster.remote.node.attr`::
  184. A node attribute to filter out nodes that are eligible as a gateway node in
  185. the remote cluster. For instance a node can have a node attribute
  186. `node.attr.gateway: true` such that only nodes with this attribute will be
  187. connected to if `cluster.remote.node.attr` is set to `gateway`.
  188. `cluster.remote.connect`::
  189. By default, any node in the cluster can act as a cross-cluster client and
  190. connect to remote clusters. The `cluster.remote.connect` setting can be set to
  191. `false` (defaults to `true`) to prevent certain nodes from connecting to
  192. remote clusters. Remote cluster requests must be sent to a node that is
  193. allowed to act as a cross-cluster client.
  194. `cluster.remote.${cluster_alias}.skip_unavailable`::
  195. Per cluster boolean setting that allows to skip specific clusters when no
  196. nodes belonging to them are available and they are the targetof a remote
  197. cluster request. Default is `false`, meaning that all clusters are mandatory
  198. by default, but they can selectively be made optional by setting this setting
  199. to `true`.
  200. `cluster.remote.${cluster_alias}.transport.ping_schedule`::
  201. Sets the time interval between regular application-level ping messages that
  202. are sent to ensure that transport connections to nodes belonging to remote
  203. clusters are kept alive. If set to `-1`, application-level ping messages to
  204. this remote cluster are not sent. If unset, application-level ping messages
  205. are sent according to the global `transport.ping_schedule` setting, which
  206. defaults to `-1` meaning that pings are not sent.
  207. `cluster.remote.${cluster_alias}.transport.compress`::
  208. Per cluster boolean setting that enables you to configure compression for
  209. requests to a specific remote cluster. This setting impacts only requests
  210. sent to the remote cluster. If the inbound request is compressed,
  211. Elasticsearch compresses the response. If unset, the global
  212. `transport.compress` is used as the fallback setting.
  213. `cluster.remote.${cluster_alias}.proxy`::
  214. Sets a proxy address for the specified remote cluster. By default this is not
  215. set, meaning that Elasticsearch will connect directly to the nodes in the
  216. remote cluster using their <<advanced-network-settings,publish addresses>>.
  217. If this setting is set to an IP address or hostname then Elasticsearch will
  218. connect to the nodes in the remote cluster using this address instead.
  219. [float]
  220. [[retrieve-remote-clusters-info]]
  221. === Retrieving remote clusters info
  222. You can use the <<cluster-remote-info, remote cluster info API>> to retrieve
  223. information about the configured remote clusters, as well as the remote nodes
  224. that the node is connected to.