network.asciidoc 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. [[modules-network]]
  2. === Networking
  3. Each {es} node has two different network interfaces. Clients send requests to
  4. {es}'s REST APIs using its <<http-settings,HTTP interface>>, but nodes
  5. communicate with other nodes using the <<transport-settings,transport
  6. interface>>. The transport interface is also used for communication with
  7. <<modules-remote-clusters,remote clusters>>.
  8. You can configure both of these interfaces at the same time using the
  9. `network.*` settings. If you have a more complicated network, you might need to
  10. configure the interfaces independently using the `http.*` and `transport.*`
  11. settings. Where possible, use the `network.*` settings that apply to both
  12. interfaces to simplify your configuration and reduce duplication.
  13. By default {es} binds only to `localhost` which means it cannot be accessed
  14. remotely. This configuration is sufficient for a local development cluster made
  15. of one or more nodes all running on the same host. To form a cluster across
  16. multiple hosts, or which is accessible to remote clients, you must adjust some
  17. <<common-network-settings,network settings>> such as `network.host`.
  18. [WARNING]
  19. .Be careful with the network configuration!
  20. =============================
  21. Never expose an unprotected node to the public internet. If you do, you are
  22. permitting anyone in the world to download, modify, or delete any of the data
  23. in your cluster.
  24. =============================
  25. Configuring {es} to bind to a non-local address will <<dev-vs-prod,convert some
  26. warnings into fatal exceptions>>. If a node refuses to start after configuring
  27. its network settings then you must address the logged exceptions before
  28. proceeding.
  29. [[common-network-settings]]
  30. ==== Commonly used network settings
  31. Most users will need to configure only the following network settings.
  32. `network.host`::
  33. (<<static-cluster-setting,Static>>)
  34. Sets the address of this node for both HTTP and transport traffic. The node
  35. will bind to this address and will also use it as its publish address. Accepts
  36. an IP address, a hostname, or a <<network-interface-values,special value>>.
  37. +
  38. Defaults to `_local_`.
  39. `http.port`::
  40. (<<static-cluster-setting,Static>>)
  41. The port to bind for HTTP client communication. Accepts a single value or a
  42. range. If a range is specified, the node will bind to the first available port
  43. in the range.
  44. +
  45. Defaults to `9200-9300`.
  46. `transport.port`::
  47. (<<static-cluster-setting,Static>>)
  48. The port to bind for communication between nodes. Accepts a single value or a
  49. range. If a range is specified, the node will bind to the first available port
  50. in the range. Set this setting to a single port, not a range, on every
  51. master-eligible node.
  52. +
  53. Defaults to `9300-9400`.
  54. [[network-interface-values]]
  55. ==== Special values for network addresses
  56. You can configure {es} to automatically determine its addresses by using the
  57. following special values. Use these values when configuring
  58. `network.host`, `network.bind_host`, `network.publish_host`, and the
  59. corresponding settings for the HTTP and transport interfaces.
  60. `_local_`::
  61. Any loopback addresses on the system, for example `127.0.0.1`.
  62. `_site_`::
  63. Any site-local addresses on the system, for example `192.168.0.1`.
  64. `_global_`::
  65. Any globally-scoped addresses on the system, for example `8.8.8.8`.
  66. `_[networkInterface]_`::
  67. Use the addresses of the network interface called `[networkInterface]`. For
  68. example if you wish to use the addresses of an interface called `en0` then
  69. set `network.host: _en0_`.
  70. `0.0.0.0`::
  71. The addresses of all available network interfaces.
  72. NOTE: Any values containing a `:` (e.g. an IPv6 address or some of the
  73. <<network-interface-values,special values>>) must be quoted because `:` is a
  74. special character in YAML.
  75. [[network-interface-values-ipv4-vs-ipv6]]
  76. ===== IPv4 vs IPv6
  77. These special values yield both IPv4 and IPv6 addresses by default, but you can
  78. also add an `:ipv4` or `:ipv6` suffix to limit them to just IPv4 or IPv6
  79. addresses respectively. For example, `network.host: _en0:ipv4_` would set this
  80. node's addresses to the IPv4 addresses of interface `en0`.
  81. [TIP]
  82. .Discovery in the Cloud
  83. ================================
  84. More special settings are available when running in the Cloud with either the
  85. {plugins}/discovery-ec2.html[EC2 discovery plugin] or the
  86. {plugins}/discovery-gce-network-host.html#discovery-gce-network-host[Google Compute Engine discovery plugin]
  87. installed.
  88. ================================
  89. [[modules-network-binding-publishing]]
  90. ==== Binding and publishing
  91. {es} uses network addresses for two distinct purposes known as binding and
  92. publishing. Most nodes will use the same address for everything, but more
  93. complicated setups may need to configure different addresses for different
  94. purposes.
  95. When an application such as {es} wishes to receive network communications, it
  96. must indicate to the operating system the address or addresses whose traffic it
  97. should receive. This is known as _binding_ to those addresses. {es} can bind to
  98. more than one address if needed, but most nodes only bind to a single address.
  99. {es} can only bind to an address if it is running on a host that has a network
  100. interface with that address. If necessary, you can configure the transport and
  101. HTTP interfaces to bind to different addresses.
  102. Each {es} node has an address at which clients and other nodes can contact it,
  103. known as its _publish address_. Each node has one publish address for its HTTP
  104. interface and one for its transport interface. These two addresses can be
  105. anything, and don't need to be addresses of the network interfaces on the host.
  106. The only requirements are that each node must be:
  107. * Accessible at its transport publish address by all other
  108. nodes in its cluster, and by any remote clusters that will discover it using
  109. <<sniff-mode>>.
  110. * Accessible at its HTTP publish address by all clients
  111. that will discover it using sniffing.
  112. ===== Using a single address
  113. The most common configuration is for {es} to bind to a single address at which
  114. it is accessible to clients and other nodes. In this configuration you should
  115. just set `network.host` to that address. You should not separately set any bind
  116. or publish addresses, nor should you separately configure the addresses for the
  117. HTTP or transport interfaces.
  118. ===== Using multiple addresses
  119. Use the <<advanced-network-settings, advanced network settings>> if you wish to
  120. bind {es} to multiple addresses, or to publish a different address from the
  121. addresses to which you are binding. Set `network.bind_host` to the bind
  122. addresses, and `network.publish_host` to the address at which this node is
  123. exposed. In complex configurations, you can configure these addresses
  124. differently for the HTTP and transport interfaces.
  125. [[advanced-network-settings]]
  126. ==== Advanced network settings
  127. These advanced settings let you bind to multiple addresses, or to use different
  128. addresses for binding and publishing. They are not required in most cases and
  129. you should not use them if you can use the <<common-network-settings,commonly
  130. used settings>> instead.
  131. `network.bind_host`::
  132. (<<static-cluster-setting,Static>>)
  133. The network address(es) to which the node should bind in order to listen for
  134. incoming connections. Accepts a list of IP addresses, hostnames, and
  135. <<network-interface-values,special values>>. Defaults to the address given by
  136. `network.host`. Use this setting only if binding to multiple addresses or using
  137. different addresses for publishing and binding.
  138. `network.publish_host`::
  139. (<<static-cluster-setting,Static>>)
  140. The network address that clients and other nodes can use to contact this node.
  141. Accepts an IP address, a hostname, or a <<network-interface-values,special
  142. value>>. Defaults to the address given by `network.host`. Use this setting only
  143. if bindiing to multiple addresses or using different addresses for publishing
  144. and binding.
  145. NOTE: You can specify a list of addresses for `network.host` and
  146. `network.publish_host`. You can also specify a single hostname which resolves
  147. to multiple addresses. If you do this then {es} chooses one of the addresses
  148. for its publish address. This choice uses heuristics based on IPv4/IPv6 stack
  149. preference and reachability and may change when the node restarts. You must
  150. make sure that each node is accessible at all possible publish addresses.
  151. [[tcp-settings]]
  152. ===== Advanced TCP settings
  153. Use the following settings to control the low-level parameters of the TCP
  154. connections used by the HTTP and transport interfaces.
  155. `network.tcp.no_delay`::
  156. (<<static-cluster-setting,Static>>)
  157. Enable or disable the {wikipedia}/Nagle%27s_algorithm[TCP no delay]
  158. setting. Defaults to `true`.
  159. `network.tcp.keep_alive`::
  160. (<<static-cluster-setting,Static>>)
  161. Configures the `SO_KEEPALIVE` option for this socket, which
  162. determines whether it sends TCP keepalive probes.
  163. `network.tcp.keep_idle`::
  164. (<<static-cluster-setting,Static>>)
  165. Configures the `TCP_KEEPIDLE` option for this socket, which
  166. determines the time in seconds that a connection must be idle before
  167. starting to send TCP keepalive probes. Defaults to `-1`, which uses
  168. the system default. This value cannot exceed `300` seconds. Only applicable on Linux and macOS,
  169. and requires Java 11 or newer.
  170. `network.tcp.keep_interval`::
  171. (<<static-cluster-setting,Static>>)
  172. Configures the `TCP_KEEPINTVL` option for this socket,
  173. which determines the time in seconds between sending TCP keepalive probes.
  174. Defaults to `-1`, which uses the system default. This value cannot exceed `300` seconds.
  175. Only applicable on Linux and macOS, and requires Java 11 or newer.
  176. `network.tcp.keep_count`::
  177. (<<static-cluster-setting,Static>>)
  178. Configures the `TCP_KEEPCNT` option for this socket, which
  179. determines the number of unacknowledged TCP keepalive probes that may be
  180. sent on a connection before it is dropped. Defaults to `-1`,
  181. which uses the system default. Only applicable on Linux and macOS, and requires
  182. Java 11 or newer.
  183. `network.tcp.reuse_address`::
  184. (<<static-cluster-setting,Static>>)
  185. Should an address be reused or not. Defaults to `true` on non-windows
  186. machines.
  187. `network.tcp.send_buffer_size`::
  188. (<<static-cluster-setting,Static>>)
  189. The size of the TCP send buffer (specified with <<size-units,size units>>).
  190. By default not explicitly set.
  191. `network.tcp.receive_buffer_size`::
  192. (<<static-cluster-setting,Static>>)
  193. The size of the TCP receive buffer (specified with <<size-units,size units>>).
  194. By default not explicitly set.
  195. include::http.asciidoc[]
  196. include::transport.asciidoc[]
  197. include::network/tracers.asciidoc[]