network.asciidoc 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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. [float]
  14. [[common-network-settings]]
  15. === Commonly Used Network Settings
  16. `network.host`::
  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
  20. of these.
  21. +
  22. Defaults to `_local_`.
  23. `discovery.zen.ping.unicast.hosts`::
  24. In order to join a cluster, a node needs to know the hostname or IP address of
  25. at least some of the other nodes in the cluster. This setting provides the
  26. initial list of other nodes that this node will try to contact. Accepts IP
  27. addresses or hostnames. If a hostname lookup resolves to multiple IP
  28. addresses then each IP address will be used for discovery.
  29. https://en.wikipedia.org/wiki/Round-robin_DNS[Round robin DNS] -- returning a
  30. different IP from a list on each lookup -- can be used for discovery; non-
  31. existent IP addresses will throw exceptions and cause another DNS lookup
  32. on the next round of pinging (subject to JVM DNS caching).
  33. +
  34. Defaults to `["127.0.0.1", "[::1]"]`.
  35. `http.port`::
  36. Port to bind to for incoming HTTP requests. Accepts a single value or a range.
  37. If a range is specified, the node will bind to the first available port in the
  38. range.
  39. +
  40. Defaults to `9200-9300`.
  41. `transport.tcp.port`::
  42. Port to bind for communication between nodes. Accepts a single value or a
  43. range. If a range is specified, the node will bind to the first available port
  44. in the range.
  45. +
  46. Defaults to `9300-9400`.
  47. [float]
  48. [[network-interface-values]]
  49. === Special values for `network.host`
  50. The following special values may be passed to `network.host`:
  51. [horizontal]
  52. `_[networkInterface]_`::
  53. Addresses of a network interface, for example `_en0_`.
  54. `_local_`::
  55. Any loopback addresses on the system, for example `127.0.0.1`.
  56. `_site_`::
  57. Any site-local addresses on the system, for example `192.168.0.1`.
  58. `_global_`::
  59. Any globally-scoped addresses on the system, for example `8.8.8.8`.
  60. [float]
  61. ==== IPv4 vs IPv6
  62. These special values will work over both IPv4 and IPv6 by default, but you can
  63. also limit this with the use of `:ipv4` of `:ipv6` specifiers. For example,
  64. `_en0:ipv4_` would only bind to the IPv4 addresses of interface `en0`.
  65. [TIP]
  66. .Discovery in the cloud
  67. ================================
  68. More special settings are available when running in the cloud with either the
  69. {plugins}/discovery-ec2-discovery.html#discovery-ec2-network-host[EC2 discovery plugin] or the
  70. {plugins}/discovery-gce-network-host.html#discovery-gce-network-host[Google Compute Engine discovery plugin]
  71. installed.
  72. ================================
  73. [float]
  74. [[advanced-network-settings]]
  75. === Advanced network settings
  76. The `network.host` setting explained in <<common-network-settings,Commonly used network settings>>
  77. is a shortcut which sets the _bind host_ and the _publish host_ at the same
  78. time. In advanced used cases, such as when running behind a proxy server, you
  79. may need to set these settings to different values:
  80. `network.bind_host`::
  81. This specifies which network interface(s) a node should bind to in order to
  82. listen for incoming requests. A node can bind to multiple interfaces, e.g.
  83. two network cards, or a site-local address and a local address. Defaults to
  84. `network.host`.
  85. `network.publish_host`::
  86. The publish host is the single interface that the node advertises to other nodes
  87. in the cluster, so that those nodes can connect to it. Currently an
  88. Elasticsearch node may be bound to multiple addresses, but only publishes one.
  89. If not specified, this defaults to the ``best'' address from `network.host`,
  90. sorted by IPv4/IPv6 stack preference, then by reachability. If you set a
  91. `network.host` that results in multiple bind addresses yet rely on a specific
  92. address for node-to-node communication, you should explicitly set
  93. `network.publish_host`.
  94. Both of the above settings can be configured just like `network.host` -- they
  95. accept IP addresses, host names, and
  96. <<network-interface-values,special values>>.
  97. [float]
  98. [[tcp-settings]]
  99. === Advanced TCP Settings
  100. Any component that uses TCP (like the <<modules-http,HTTP>> and
  101. <<modules-transport,Transport>> modules) share the following settings:
  102. [horizontal]
  103. `network.tcp.no_delay`::
  104. Enable or disable the https://en.wikipedia.org/wiki/Nagle%27s_algorithm[TCP no delay]
  105. setting. Defaults to `true`.
  106. `network.tcp.keep_alive`::
  107. Enable or disable https://en.wikipedia.org/wiki/Keepalive[TCP keep alive].
  108. Defaults to `true`.
  109. `network.tcp.reuse_address`::
  110. Should an address be reused or not. Defaults to `true` on non-windows
  111. machines.
  112. `network.tcp.send_buffer_size`::
  113. The size of the TCP send buffer (specified with <<size-units,size units>>).
  114. By default not explicitly set.
  115. `network.tcp.receive_buffer_size`::
  116. The size of the TCP receive buffer (specified with <<size-units,size units>>).
  117. By default not explicitly set.
  118. [float]
  119. === Transport and HTTP protocols
  120. An Elasticsearch node exposes two network protocols which inherit the above
  121. settings, but may be further configured independently:
  122. TCP Transport::
  123. Used for communication between nodes in the cluster, by the Java
  124. {javaclient}/transport-client.html[Transport client] and by the
  125. <<modules-tribe,Tribe node>>. See the <<modules-transport,Transport module>>
  126. for more information.
  127. HTTP::
  128. Exposes the JSON-over-HTTP interface used by all clients other than the Java
  129. clients. See the <<modules-http,HTTP module>> for more information.