remote-clusters.asciidoc 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. [[modules-remote-clusters]]
  2. == Remote clusters
  3. The _remote clusters_ functionality enables you to establish unidirectional
  4. connections to a remote cluster. Remote clusters are required for
  5. <<xpack-ccr,{ccr}>> and <<modules-cross-cluster-search,{ccs}>>.
  6. Remote cluster connections work by configuring a remote cluster and connecting
  7. to a limited number of nodes in that remote cluster. There are two modes for
  8. remote cluster connections: <<sniff-mode,sniff mode>> and
  9. <<proxy-mode,proxy mode>>.
  10. All the communication required between different clusters
  11. goes through the <<modules-transport,transport layer>>. Remote cluster
  12. connections consist of uni-directional connections from the coordinating
  13. node to the remote remote connections.
  14. [float]
  15. [[sniff-mode]]
  16. === Sniff mode
  17. In sniff mode, a cluster is created using a name and a list of seed nodes. When
  18. a remote cluster is registered, its cluster state is retrieved from one of the
  19. seed nodes and up to three _gateway nodes_ are selected as part of remote
  20. cluster requests. This mode requires that the gateway node's publish addresses
  21. are accessible by the local cluster.
  22. Sniff mode is the default connection mode.
  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. // tag::remote-cluster-compatibility-matrix[]
  37. [cols="^,^,^,^,^,^,^,^"]
  38. |====
  39. | Compatibility | 5.0->5.5 | 5.6 | 6.0->6.6 | 6.7 | 6.8 | 7.0 | 7.1->7.x
  40. | 5.0->5.5 | Yes | Yes | No | No | No | No | No
  41. | 5.6 | Yes | Yes | Yes | Yes | Yes | No | No
  42. | 6.0->6.6 | No | Yes | Yes | Yes | Yes | No | No
  43. | 6.7 | No | Yes | Yes | Yes | Yes | Yes | No
  44. | 6.8 | No | Yes | Yes | Yes | Yes | Yes | Yes
  45. | 7.0 | No | No | No | Yes | Yes | Yes | Yes
  46. | 7.1->7.x | No | No | No | No | Yes | Yes | Yes
  47. |====
  48. // end::remote-cluster-compatibility-matrix[]
  49. - *role*: Dedicated master nodes never get selected.
  50. - *attributes*: You can tag which nodes should be selected
  51. (see <<remote-cluster-settings>>), though such tagged nodes still have
  52. to satisfy the two above requirements.
  53. [float]
  54. [[proxy-mode]]
  55. === Proxy mode
  56. In proxy mode, a cluster is created using a name and a single proxy address. When
  57. a remote cluster is registered, a configurable number of socket connections are
  58. opened to the proxy address. The proxy is required to route those connections to
  59. the remote cluster. Proxy mode does not require remote cluster nodes to have
  60. accessible publish addresses.
  61. The proxy mode is not the default connection mode and must be configured. Similar
  62. to the sniff <<gateway-nodes-selection,gateway nodes>>, the remote
  63. connections are subject to the same version compatibility rules as
  64. <<rolling-upgrades>>.
  65. [float]
  66. [[configuring-remote-clusters]]
  67. ==== Configuring remote clusters
  68. You can configure remote clusters globally by using
  69. <<cluster-update-settings,cluster settings>>, which you can update dynamically.
  70. Alternatively, you can configure them locally on individual nodes by using the
  71. `elasticsearch.yml` file.
  72. If you specify the settings in `elasticsearch.yml` files, only the nodes with
  73. those settings can connect to the remote cluster. In other words, functionality
  74. that relies on remote cluster requests must be driven specifically from those
  75. nodes. For example:
  76. [source,yaml]
  77. --------------------------------
  78. cluster:
  79. remote:
  80. cluster_one: <1>
  81. seeds: 127.0.0.1:9300 <2>
  82. transport.ping_schedule: 30s <3>
  83. cluster_two: <1>
  84. mode: sniff <4>
  85. seeds: 127.0.0.1:9301 <2>
  86. transport.compress: true <5>
  87. skip_unavailable: true <6>
  88. cluster_three: <1>
  89. mode: proxy <4>
  90. proxy_address: 127.0.0.1:9302 <7>
  91. --------------------------------
  92. <1> `cluster_one`, `cluster_two`, and `cluster_three` are arbitrary _cluster aliases_
  93. representing the connection to each cluster. These names are subsequently used to
  94. distinguish between local and remote indices.
  95. <2> The hostname and <<modules-transport,transport>> port (default: 9300) of a
  96. seed node in the remote cluster.
  97. <3> A keep-alive ping is configured for `cluster_one`.
  98. <4> The configured connection mode. By default, this is <<sniff-mode,`sniff`>>, so
  99. the mode is implicit for `cluster_one`. However, it can be explicitly configured
  100. as demonstrated by `cluster_two` and must be explicitly configured for
  101. <<proxy-mode,proxy mode>> as demonstrated by `cluster_three`.
  102. <5> Compression is explicitly enabled for requests to `cluster_two`.
  103. <6> Disconnected remote clusters are optional for `cluster_two`.
  104. <7> The address for the proxy endpoint used to connect to `cluster_three`.
  105. For more information about the optional transport settings, see
  106. <<modules-transport>>.
  107. If you use <<cluster-update-settings,cluster settings>>, the remote clusters
  108. are available on every node in the cluster. For example:
  109. [source,console]
  110. --------------------------------
  111. PUT _cluster/settings
  112. {
  113. "persistent": {
  114. "cluster": {
  115. "remote": {
  116. "cluster_one": {
  117. "seeds": [
  118. "127.0.0.1:9300"
  119. ],
  120. "transport.ping_schedule": "30s"
  121. },
  122. "cluster_two": {
  123. "mode": "sniff",
  124. "seeds": [
  125. "127.0.0.1:9301"
  126. ],
  127. "transport.compress": true,
  128. "skip_unavailable": true
  129. },
  130. "cluster_three": {
  131. "mode": "proxy",
  132. "proxy_address": "127.0.0.1:9302"
  133. }
  134. }
  135. }
  136. }
  137. }
  138. --------------------------------
  139. // TEST[setup:host]
  140. // TEST[s/127.0.0.1:9300/\${transport_host}/]
  141. You can dynamically update the compression and ping schedule settings. However,
  142. you must re-include seeds or `proxy_address` in the settings update request.
  143. For example:
  144. [source,console]
  145. --------------------------------
  146. PUT _cluster/settings
  147. {
  148. "persistent": {
  149. "cluster": {
  150. "remote": {
  151. "cluster_one": {
  152. "seeds": [
  153. "127.0.0.1:9300"
  154. ],
  155. "transport.ping_schedule": "60s"
  156. },
  157. "cluster_two": {
  158. "mode": "sniff",
  159. "seeds": [
  160. "127.0.0.1:9301"
  161. ],
  162. "transport.compress": false
  163. },
  164. "cluster_three": {
  165. "mode": "proxy",
  166. "proxy_address": "127.0.0.1:9302",
  167. "transport.compress": true
  168. }
  169. }
  170. }
  171. }
  172. }
  173. --------------------------------
  174. // TEST[continued]
  175. NOTE: When the compression or ping schedule settings change, all the existing
  176. node connections must close and re-open, which can cause in-flight requests to
  177. fail.
  178. A remote cluster can be deleted from the cluster settings by setting its settings to `null` :
  179. [source,console]
  180. --------------------------------
  181. PUT _cluster/settings
  182. {
  183. "persistent": {
  184. "cluster": {
  185. "remote": {
  186. "cluster_two": { <1>
  187. "mode": null,
  188. "seeds": null,
  189. "skip_unavailable": null,
  190. "transport": {
  191. "compress": null
  192. }
  193. }
  194. }
  195. }
  196. }
  197. }
  198. --------------------------------
  199. // TEST[continued]
  200. <1> `cluster_two` would be removed from the cluster settings, leaving
  201. `cluster_one` and `cluster_three` intact.
  202. [float]
  203. [[remote-cluster-settings]]
  204. === Remote cluster settings for all modes
  205. These settings apply to both <<sniff-mode,sniff mode>> and
  206. <<proxy-mode,proxy mode>>. <<remote-cluster-sniff-settings,Sniff mode settings>>
  207. and <<remote-cluster-proxy-settings,proxy mode settings>> are described below.
  208. `cluster.remote.<cluster_alias>.mode`::
  209. The mode used for a remote cluster connection. The only supported modes are
  210. `sniff` and `proxy`.
  211. `cluster.remote.initial_connect_timeout`::
  212. The time to wait for remote connections to be established when the node
  213. starts. The default is `30s`.
  214. `node.remote_cluster_client`::
  215. By default, any node in the cluster can act as a cross-cluster client and
  216. connect to remote clusters. The `node.remote_cluster_client` setting can be
  217. set to `false` (defaults to `true`) to prevent certain nodes from connecting
  218. to remote clusters. Remote cluster requests must be sent to a node that is
  219. allowed to act as a cross-cluster client.
  220. `cluster.remote.<cluster_alias>.skip_unavailable`::
  221. Per cluster boolean setting that allows to skip specific clusters when no
  222. nodes belonging to them are available and they are the target of a remote
  223. cluster request. Default is `false`, meaning that all clusters are mandatory
  224. by default, but they can selectively be made optional by setting this setting
  225. to `true`.
  226. `cluster.remote.<cluster_alias>.transport.ping_schedule`::
  227. Sets the time interval between regular application-level ping messages that
  228. are sent to ensure that transport connections to nodes belonging to remote
  229. clusters are kept alive. If set to `-1`, application-level ping messages to
  230. this remote cluster are not sent. If unset, application-level ping messages
  231. are sent according to the global `transport.ping_schedule` setting, which
  232. defaults to `-1` meaning that pings are not sent.
  233. `cluster.remote.<cluster_alias>.transport.compress`::
  234. Per cluster boolean setting that enables you to configure compression for
  235. requests to a specific remote cluster. This setting impacts only requests
  236. sent to the remote cluster. If the inbound request is compressed,
  237. Elasticsearch compresses the response. If unset, the global
  238. `transport.compress` is used as the fallback setting.
  239. [float]
  240. [[remote-cluster-sniff-settings]]
  241. === Remote cluster settings for sniff mode
  242. `cluster.remote.<cluster_alias>.seeds`::
  243. The list of seed nodes used to sniff the remote cluster state.
  244. `cluster.remote.<cluster_alias>.node_connections`::
  245. The number of gateway nodes to connect to for this remote cluster. The default
  246. is `3`.
  247. `cluster.remote.node.attr`::
  248. A node attribute to filter out nodes that are eligible as a gateway node in
  249. the remote cluster. For instance a node can have a node attribute
  250. `node.attr.gateway: true` such that only nodes with this attribute will be
  251. connected to if `cluster.remote.node.attr` is set to `gateway`.
  252. [float]
  253. [[remote-cluster-proxy-settings]]
  254. === Remote cluster settings for proxy mode
  255. `cluster.remote.<cluster_alias>.proxy_address`::
  256. The address used for all remote connections.
  257. `cluster.remote.<cluster_alias>.proxy_socket_connections`::
  258. The number of socket connections to open per remote cluster. The default is
  259. `18`.
  260. [role="xpack"]
  261. `cluster.remote.<cluster_alias>.server_name`::
  262. An optional hostname string which is sent in the `server_name` field of
  263. the TLS Server Name Indication extension if
  264. <<configuring-tls,TLS is enabled>>. The TLS transport will fail to open
  265. remote connections if this field is not a valid hostname as defined by the
  266. TLS SNI specification.
  267. [float]
  268. [[retrieve-remote-clusters-info]]
  269. === Retrieving remote clusters info
  270. You can use the <<cluster-remote-info, remote cluster info API>> to retrieve
  271. information about the configured remote clusters, as well as the remote nodes
  272. that the node is connected to.