network.asciidoc 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. [[modules-network]]
  2. === Network settings
  3. Elasticsearch binds to localhost only by default. This is sufficient for you
  4. to run a local development server (or even a development cluster, if you start
  5. multiple nodes on the same machine), but you will need to configure some
  6. <<common-network-settings,basic network settings>> in order to run a real
  7. production cluster across multiple servers.
  8. [WARNING]
  9. .Be careful with the network configuration!
  10. =============================
  11. Never expose an unprotected node to the public internet.
  12. =============================
  13. [[common-network-settings]]
  14. ==== Commonly used network settings
  15. `network.host`::
  16. (<<static-cluster-setting,Static>>)
  17. The node will bind to this hostname or IP address and _publish_ (advertise)
  18. this host to other nodes in the cluster. Accepts an IP address, hostname, a
  19. <<network-interface-values,special value>>, or an array of any combination of
  20. these. Note that any values containing a `:` (e.g., an IPv6 address or
  21. containing one of the <<network-interface-values,special values>>) must be
  22. quoted because `:` is a special character in YAML. `0.0.0.0` is an acceptable
  23. IP address and will bind to all network interfaces. The value `0` has the
  24. same effect as the value `0.0.0.0`.
  25. +
  26. Defaults to `_local_`.
  27. `discovery.seed_hosts`::
  28. (<<static-cluster-setting,Static>>)
  29. In order to join a cluster, a node needs to know the hostname or IP address of
  30. at least some of the other nodes in the cluster. This setting provides the
  31. initial list of addresses this node will try to contact. Accepts IP addresses
  32. or hostnames. If a hostname lookup resolves to multiple IP addresses then each
  33. IP address will be used for discovery.
  34. {wikipedia}/Round-robin_DNS[Round robin DNS] -- returning a
  35. different IP from a list on each lookup -- can be used for discovery; non-
  36. existent IP addresses will throw exceptions and cause another DNS lookup on the
  37. next round of pinging (subject to <<networkaddress-cache-ttl,JVM DNS
  38. caching>>).
  39. +
  40. Defaults to `["127.0.0.1", "[::1]"]`.
  41. `http.port`::
  42. (<<static-cluster-setting,Static>>)
  43. Port to bind to for incoming HTTP requests. Accepts a single value or a range.
  44. If a range is specified, the node will bind to the first available port in the
  45. range.
  46. +
  47. Defaults to `9200-9300`.
  48. `transport.port`::
  49. (<<static-cluster-setting,Static>>)
  50. Port to bind for communication between nodes. Accepts a single value or a
  51. range. If a range is specified, the node will bind to the first available port
  52. in the range.
  53. +
  54. Defaults to `9300-9400`.
  55. [[network-interface-values]]
  56. ==== Special values for `network.host`
  57. The following special values may be passed to `network.host`:
  58. `_[networkInterface]_`::
  59. Addresses of a network interface, for example `_en0_`.
  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. [[network-interface-values-ipv4-vs-ipv6]]
  67. ===== IPv4 vs IPv6
  68. These special values will work over both IPv4 and IPv6 by default, but you can
  69. also limit this with the use of `:ipv4` of `:ipv6` specifiers. For example,
  70. `_en0:ipv4_` would only bind to the IPv4 addresses of interface `en0`.
  71. [TIP]
  72. .Discovery in the Cloud
  73. ================================
  74. More special settings are available when running in the Cloud with either the
  75. {plugins}/discovery-ec2.html[EC2 discovery plugin] or the
  76. {plugins}/discovery-gce-network-host.html#discovery-gce-network-host[Google Compute Engine discovery plugin]
  77. installed.
  78. ================================
  79. [[advanced-network-settings]]
  80. ==== Advanced network settings
  81. The `network.host` setting explained in <<common-network-settings,Commonly used network settings>>
  82. is a shortcut which sets the _bind host_ and the _publish host_ at the same
  83. time. In advanced used cases, such as when running behind a proxy server, you
  84. may need to set these settings to different values:
  85. `network.bind_host`::
  86. This specifies which network interface(s) a node should bind to in order to
  87. listen for incoming requests. A node can bind to multiple interfaces, e.g.
  88. two network cards, or a site-local address and a local address. Defaults to
  89. `network.host`.
  90. `network.publish_host`::
  91. The publish host is the single interface that the node advertises to other nodes
  92. in the cluster, so that those nodes can connect to it. Currently an
  93. Elasticsearch node may be bound to multiple addresses, but only publishes one.
  94. If not specified, this defaults to the ``best'' address from `network.host`,
  95. sorted by IPv4/IPv6 stack preference, then by reachability. If you set a
  96. `network.host` that results in multiple bind addresses yet rely on a specific
  97. address for node-to-node communication, you should explicitly set
  98. `network.publish_host`.
  99. Both of the above settings can be configured just like `network.host` -- they
  100. accept IP addresses, host names, and
  101. <<network-interface-values,special values>>.
  102. [[tcp-settings]]
  103. ===== Advanced TCP settings
  104. Any component that uses TCP (like the <<modules-http,HTTP>> and
  105. <<modules-transport,transport>> layers) share the following settings:
  106. `network.tcp.no_delay`::
  107. (<<static-cluster-setting,Static>>)
  108. Enable or disable the {wikipedia}/Nagle%27s_algorithm[TCP no delay]
  109. setting. Defaults to `true`.
  110. `network.tcp.keep_alive`::
  111. (<<static-cluster-setting,Static>>)
  112. Configures the `SO_KEEPALIVE` option for this socket, which
  113. determines whether it sends TCP keepalive probes.
  114. `network.tcp.keep_idle`::
  115. (<<static-cluster-setting,Static>>)
  116. Configures the `TCP_KEEPIDLE` option for this socket, which
  117. determines the time in seconds that a connection must be idle before
  118. starting to send TCP keepalive probes. Defaults to `-1`, which uses
  119. the system default. This value cannot exceed `300` seconds. Only applicable on Linux and macOS,
  120. and requires Java 11 or newer.
  121. `network.tcp.keep_interval`::
  122. (<<static-cluster-setting,Static>>)
  123. Configures the `TCP_KEEPINTVL` option for this socket,
  124. which determines the time in seconds between sending TCP keepalive probes.
  125. Defaults to `-1`, which uses the system default. This value cannot exceed `300` seconds.
  126. Only applicable on Linux and macOS, and requires Java 11 or newer.
  127. `network.tcp.keep_count`::
  128. (<<static-cluster-setting,Static>>)
  129. Configures the `TCP_KEEPCNT` option for this socket, which
  130. determines the number of unacknowledged TCP keepalive probes that may be
  131. sent on a connection before it is dropped. Defaults to `-1`,
  132. which uses the system default. Only applicable on Linux and macOS, and requires
  133. Java 11 or newer.
  134. `network.tcp.reuse_address`::
  135. (<<static-cluster-setting,Static>>)
  136. Should an address be reused or not. Defaults to `true` on non-windows
  137. machines.
  138. `network.tcp.send_buffer_size`::
  139. (<<static-cluster-setting,Static>>)
  140. The size of the TCP send buffer (specified with <<size-units,size units>>).
  141. By default not explicitly set.
  142. `network.tcp.receive_buffer_size`::
  143. (<<static-cluster-setting,Static>>)
  144. The size of the TCP receive buffer (specified with <<size-units,size units>>).
  145. By default not explicitly set.
  146. [discrete]
  147. === HTTP and transport network communication
  148. Each {es} node uses the network for two different methods of communication:
  149. * it exposes an <<modules-http,HTTP interface>> for use by clients.
  150. * it exposes a <<modules-transport,transport interface>> for communication
  151. between nodes within a cluster and for communication with a
  152. <<modules-remote-clusters,remote cluster>>.
  153. The network settings described above apply to both methods of communication,
  154. and you can also configure each interface separately if needed. See the
  155. <<modules-http,HTTP>> and <<modules-transport,transport>> pages for more
  156. details on their respective configurations.