remote-clusters.asciidoc 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  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. // tag::remote-cluster-compatibility-matrix[]
  40. [cols="^,^,^,^,^,^,^,^"]
  41. |====
  42. | Compatibility | 5.0->5.5 | 5.6 | 6.0->6.6 | 6.7 | 6.8 | 7.0 | 7.1->7.x
  43. | 5.0->5.5 | Yes | Yes | No | No | No | No | No
  44. | 5.6 | Yes | Yes | Yes | Yes | Yes | No | No
  45. | 6.0->6.6 | No | Yes | Yes | Yes | Yes | No | No
  46. | 6.7 | No | Yes | Yes | Yes | Yes | Yes | No
  47. | 6.8 | No | Yes | Yes | Yes | Yes | Yes | Yes
  48. | 7.0 | No | No | No | Yes | Yes | Yes | Yes
  49. | 7.1->7.x | No | No | No | No | Yes | Yes | Yes
  50. |====
  51. // end::remote-cluster-compatibility-matrix[]
  52. - *role*: Dedicated master nodes never get selected.
  53. - *attributes*: You can tag which nodes should be selected
  54. (see <<remote-cluster-settings>>), though such tagged nodes still have
  55. to satisfy the two above requirements.
  56. [float]
  57. [[configuring-remote-clusters]]
  58. === Configuring remote clusters
  59. You can configure remote clusters globally by using
  60. <<cluster-update-settings,cluster settings>>, which you can update dynamically.
  61. Alternatively, you can configure them locally on individual nodes by using the
  62. `elasticsearch.yml` file.
  63. If you specify the settings in `elasticsearch.yml` files, only the nodes with
  64. those settings can connect to the remote cluster. In other words, functionality
  65. that relies on remote cluster requests must be driven specifically from those
  66. nodes. For example:
  67. [source,yaml]
  68. --------------------------------
  69. cluster:
  70. remote:
  71. cluster_one: <1>
  72. seeds: 127.0.0.1:9300 <2>
  73. transport.ping_schedule: 30s <3>
  74. cluster_two:
  75. seeds: 127.0.0.1:9301
  76. transport.compress: true <4>
  77. skip_unavailable: true <5>
  78. --------------------------------
  79. <1> `cluster_one` and `cluster_two` are arbitrary _cluster aliases_ representing
  80. the connection to each cluster. These names are subsequently used to distinguish
  81. between local and remote indices.
  82. <2> The hostname and <<modules-transport,transport>> port (default: 9300) of a
  83. seed node in the remote cluster.
  84. <3> A keep-alive ping is configured for `cluster_one`.
  85. <4> Compression is explicitly enabled for requests to `cluster_two`.
  86. <5> Disconnected remote clusters are optional for `cluster_two`.
  87. For more information about the optional transport settings, see
  88. <<modules-transport>>.
  89. If you use <<cluster-update-settings,cluster settings>>, the remote clusters
  90. are available on every node in the cluster. For example:
  91. [source,console]
  92. --------------------------------
  93. PUT _cluster/settings
  94. {
  95. "persistent": {
  96. "cluster": {
  97. "remote": {
  98. "cluster_one": {
  99. "seeds": [
  100. "127.0.0.1:9300"
  101. ],
  102. "transport.ping_schedule": "30s"
  103. },
  104. "cluster_two": {
  105. "seeds": [
  106. "127.0.0.1:9301"
  107. ],
  108. "transport.compress": true,
  109. "skip_unavailable": true
  110. },
  111. "cluster_three": {
  112. "seeds": [
  113. "127.0.0.1:9302"
  114. ]
  115. }
  116. }
  117. }
  118. }
  119. }
  120. --------------------------------
  121. // TEST[setup:host]
  122. // TEST[s/127.0.0.1:9300/\${transport_host}/]
  123. You can dynamically update the compression and ping schedule settings. However,
  124. you must re-include seeds in the settings update request. For example:
  125. [source,console]
  126. --------------------------------
  127. PUT _cluster/settings
  128. {
  129. "persistent": {
  130. "cluster": {
  131. "remote": {
  132. "cluster_one": {
  133. "seeds": [
  134. "127.0.0.1:9300"
  135. ],
  136. "transport.ping_schedule": "60s"
  137. },
  138. "cluster_two": {
  139. "seeds": [
  140. "127.0.0.1:9301"
  141. ],
  142. "transport.compress": false
  143. }
  144. }
  145. }
  146. }
  147. }
  148. --------------------------------
  149. // TEST[continued]
  150. NOTE: When the compression or ping schedule settings change, all the existing
  151. node connections must close and re-open, which can cause in-flight requests to
  152. fail.
  153. A remote cluster can be deleted from the cluster settings by setting its seeds and optional settings to `null` :
  154. [source,console]
  155. --------------------------------
  156. PUT _cluster/settings
  157. {
  158. "persistent": {
  159. "cluster": {
  160. "remote": {
  161. "cluster_two": { <1>
  162. "seeds": null,
  163. "skip_unavailable": null,
  164. "transport": {
  165. "compress": null
  166. }
  167. }
  168. }
  169. }
  170. }
  171. }
  172. --------------------------------
  173. // TEST[continued]
  174. <1> `cluster_two` would be removed from the cluster settings, leaving
  175. `cluster_one` and `cluster_three` intact.
  176. [float]
  177. [[remote-cluster-settings]]
  178. === Remote cluster settings
  179. `cluster.remote.connections_per_cluster`::
  180. The number of gateway nodes to connect to per remote cluster. The default is
  181. `3`.
  182. `cluster.remote.initial_connect_timeout`::
  183. The time to wait for remote connections to be established when the node
  184. starts. The default is `30s`.
  185. `cluster.remote.node.attr`::
  186. A node attribute to filter out nodes that are eligible as a gateway node in
  187. the remote cluster. For instance a node can have a node attribute
  188. `node.attr.gateway: true` such that only nodes with this attribute will be
  189. connected to if `cluster.remote.node.attr` is set to `gateway`.
  190. `cluster.remote.connect`::
  191. By default, any node in the cluster can act as a cross-cluster client and
  192. connect to remote clusters. The `cluster.remote.connect` setting can be set to
  193. `false` (defaults to `true`) to prevent certain nodes from connecting to
  194. remote clusters. Remote cluster requests must be sent to a node that is
  195. allowed to act as a cross-cluster client.
  196. `cluster.remote.${cluster_alias}.skip_unavailable`::
  197. Per cluster boolean setting that allows to skip specific clusters when no
  198. nodes belonging to them are available and they are the targetof a remote
  199. cluster request. Default is `false`, meaning that all clusters are mandatory
  200. by default, but they can selectively be made optional by setting this setting
  201. to `true`.
  202. `cluster.remote.${cluster_alias}.transport.ping_schedule`::
  203. Sets the time interval between regular application-level ping messages that
  204. are sent to ensure that transport connections to nodes belonging to remote
  205. clusters are kept alive. If set to `-1`, application-level ping messages to
  206. this remote cluster are not sent. If unset, application-level ping messages
  207. are sent according to the global `transport.ping_schedule` setting, which
  208. defaults to `-1` meaning that pings are not sent.
  209. `cluster.remote.${cluster_alias}.transport.compress`::
  210. Per cluster boolean setting that enables you to configure compression for
  211. requests to a specific remote cluster. This setting impacts only requests
  212. sent to the remote cluster. If the inbound request is compressed,
  213. Elasticsearch compresses the response. If unset, the global
  214. `transport.compress` is used as the fallback setting.
  215. [float]
  216. [[retrieve-remote-clusters-info]]
  217. === Retrieving remote clusters info
  218. You can use the <<cluster-remote-info, remote cluster info API>> to retrieve
  219. information about the configured remote clusters, as well as the remote nodes
  220. that the node is connected to.