remote-clusters.asciidoc 12 KB

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