remote-clusters.asciidoc 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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. <<xpack-ccr,{ccr}>> and
  12. <<modules-cross-cluster-search,{ccs}>>.
  13. endif::[]
  14. // tag::how-remote-clusters-work[]
  15. Remote cluster connections work by configuring a remote cluster and connecting
  16. only to a limited number of nodes in that remote cluster. Each remote cluster
  17. is referenced by a name and a list of seed nodes. When a remote cluster is
  18. registered, its cluster state is retrieved from one of the seed nodes and up
  19. to three _gateway nodes_ are selected to be connected to as part of remote
  20. cluster requests.
  21. // end::how-remote-clusters-work[]
  22. All the communication required between different clusters
  23. goes through the <<modules-transport,transport layer>>. Remote cluster
  24. connections consist of uni-directional connections from the coordinating
  25. node to the selected remote _gateway nodes_ only.
  26. [float]
  27. [[gateway-nodes-selection]]
  28. === Gateway nodes selection
  29. The _gateway nodes_ selection depends on the following criteria:
  30. - *version*: Remote nodes must be compatible with the cluster they are
  31. registered to. This is subject to rules that are similar to those for
  32. <<rolling-upgrades>>. Any node can communicate with any other node on the same
  33. major version (e.g. 7.0 can talk to any 7.x node). Only nodes on the last minor
  34. version of a certain major version can communicate with nodes on the following
  35. major version. Note that in the 6.x series, 6.8 can communicate with any 7.x
  36. node, while 6.7 can only communicate with 7.0. Version compatibility is
  37. symmetric, meaning that if 6.7 can communicate with 7.0, 7.0 can also
  38. communicate with 6.7. The matrix below summarizes compatibility as described above.
  39. [cols="^,^,^,^,^,^,^,^"]
  40. |====
  41. | Compatibility | 5.0->5.5 | 5.6 | 6.0->6.6 | 6.7 | 6.8 | 7.0 | 7.1->7.x
  42. | 5.0->5.5 | Yes | Yes | No | No | No | No | No
  43. | 5.6 | Yes | Yes | Yes | Yes | Yes | No | No
  44. | 6.0->6.6 | No | Yes | Yes | Yes | Yes | No | No
  45. | 6.7 | No | Yes | Yes | Yes | Yes | Yes | No
  46. | 6.8 | No | Yes | Yes | Yes | Yes | Yes | Yes
  47. | 7.0 | No | No | No | Yes | Yes | Yes | Yes
  48. | 7.1->7.x | No | No | No | No | Yes | Yes | Yes
  49. |====
  50. - *role*: Dedicated master nodes never get selected.
  51. - *attributes*: You can tag which nodes should be selected
  52. (see <<remote-cluster-settings>>), though such tagged nodes still have
  53. to satisfy the two above requirements.
  54. [float]
  55. [[configuring-remote-clusters]]
  56. === Configuring remote clusters
  57. You can configure remote clusters globally by using
  58. <<cluster-update-settings,cluster settings>>, which you can update dynamically.
  59. Alternatively, you can configure them locally on individual nodes by using the
  60. `elasticsearch.yml` file.
  61. If you specify the settings in `elasticsearch.yml` files, only the nodes with
  62. those settings can connect to the remote cluster. In other words, functionality
  63. that relies on remote cluster requests must be driven specifically from those
  64. nodes. For example:
  65. [source,yaml]
  66. --------------------------------
  67. cluster:
  68. remote:
  69. cluster_one: <1>
  70. seeds: 127.0.0.1:9300 <2>
  71. transport.ping_schedule: 30s <3>
  72. cluster_two:
  73. seeds: 127.0.0.1:9301
  74. transport.compress: true <4>
  75. skip_unavailable: true <5>
  76. --------------------------------
  77. <1> `cluster_one` and `cluster_two` are arbitrary _cluster aliases_ representing
  78. the connection to each cluster. These names are subsequently used to distinguish
  79. between local and remote indices.
  80. <2> The hostname and <<modules-transport,transport>> port (default: 9300) of a
  81. seed node in the remote cluster.
  82. <3> A keep-alive ping is configured for `cluster_one`.
  83. <4> Compression is explicitly enabled for requests to `cluster_two`.
  84. <5> Disconnected remote clusters are optional for `cluster_two`.
  85. For more information about the optional transport settings, see
  86. <<modules-transport>>.
  87. If you use <<cluster-update-settings,cluster settings>>, the remote clusters
  88. are available on every node in the cluster. For example:
  89. [source,console]
  90. --------------------------------
  91. PUT _cluster/settings
  92. {
  93. "persistent": {
  94. "cluster": {
  95. "remote": {
  96. "cluster_one": {
  97. "seeds": [
  98. "127.0.0.1:9300"
  99. ],
  100. "transport.ping_schedule": "30s"
  101. },
  102. "cluster_two": {
  103. "seeds": [
  104. "127.0.0.1:9301"
  105. ],
  106. "transport.compress": true,
  107. "skip_unavailable": true
  108. },
  109. "cluster_three": {
  110. "seeds": [
  111. "127.0.0.1:9302"
  112. ]
  113. }
  114. }
  115. }
  116. }
  117. }
  118. --------------------------------
  119. // TEST[setup:host]
  120. // TEST[s/127.0.0.1:9300/\${transport_host}/]
  121. You can dynamically update the compression and ping schedule settings. However,
  122. you must re-include seeds in the settings update request. For example:
  123. [source,console]
  124. --------------------------------
  125. PUT _cluster/settings
  126. {
  127. "persistent": {
  128. "cluster": {
  129. "remote": {
  130. "cluster_one": {
  131. "seeds": [
  132. "127.0.0.1:9300"
  133. ],
  134. "transport.ping_schedule": "60s"
  135. },
  136. "cluster_two": {
  137. "seeds": [
  138. "127.0.0.1:9301"
  139. ],
  140. "transport.compress": false
  141. }
  142. }
  143. }
  144. }
  145. }
  146. --------------------------------
  147. // TEST[continued]
  148. NOTE: When the compression or ping schedule settings change, all the existing
  149. node connections must close and re-open, which can cause in-flight requests to
  150. fail.
  151. A remote cluster can be deleted from the cluster settings by setting its seeds and optional settings to `null` :
  152. [source,console]
  153. --------------------------------
  154. PUT _cluster/settings
  155. {
  156. "persistent": {
  157. "cluster": {
  158. "remote": {
  159. "cluster_two": { <1>
  160. "seeds": null,
  161. "skip_unavailable": null,
  162. "transport": {
  163. "compress": null
  164. }
  165. }
  166. }
  167. }
  168. }
  169. }
  170. --------------------------------
  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. [float]
  214. [[retrieve-remote-clusters-info]]
  215. === Retrieving remote clusters info
  216. You can use the <<cluster-remote-info, remote cluster info API>> to retrieve
  217. information about the configured remote clusters, as well as the remote nodes
  218. that the node is connected to.