| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 | [[modules-network]]=== NetworkingEach {es} node has two different network interfaces. Clients send requests to{es}'s REST APIs using its <<http-settings,HTTP interface>>, but nodescommunicate with other nodes using the <<transport-settings,transportinterface>>. The transport interface is also used for communication with<<modules-remote-clusters,remote clusters>>.You can configure both of these interfaces at the same time using the`network.*` settings. If you have a more complicated network, you might need toconfigure the interfaces independently using the `http.*` and `transport.*`settings. Where possible, use the `network.*` settings that apply to bothinterfaces to simplify your configuration and reduce duplication.By default {es} binds only to `localhost` which means it cannot be accessedremotely. This configuration is sufficient for a local development cluster madeof one or more nodes all running on the same host. To form a cluster acrossmultiple hosts, or which is accessible to remote clients, you must adjust some<<common-network-settings,network settings>> such as `network.host`.[WARNING].Be careful with the network configuration!=============================Never expose an unprotected node to the public internet. If you do, you arepermitting anyone in the world to download, modify, or delete any of the datain your cluster.=============================Configuring {es} to bind to a non-local address will <<dev-vs-prod,convert somewarnings into fatal exceptions>>. If a node refuses to start after configuringits network settings then you must address the logged exceptions beforeproceeding.[[common-network-settings]]==== Commonly used network settingsMost users will need to configure only the following network settings.`network.host`::(<<static-cluster-setting,Static>>)Sets the address of this node for both HTTP and transport traffic. The nodewill bind to this address and will also use it as its publish address. Acceptsan IP address, a hostname, or a <<network-interface-values,special value>>.+Defaults to `_local_`.`http.port`::(<<static-cluster-setting,Static>>)The port to bind for HTTP client communication. Accepts a single value or arange. If a range is specified, the node will bind to the first available portin the range.+Defaults to `9200-9300`.`transport.port`::(<<static-cluster-setting,Static>>)The port to bind for communication between nodes. Accepts a single value or arange. If a range is specified, the node will bind to the first available portin the range. Set this setting to a single port, not a range, on everymaster-eligible node.+Defaults to `9300-9400`.[[network-interface-values]]==== Special values for network addressesYou can configure {es} to automatically determine its addresses by using thefollowing special values. Use these values when configuring`network.host`, `network.bind_host`, `network.publish_host`, and thecorresponding settings for the HTTP and transport interfaces.`_local_`::  Any loopback addresses on the system, for example `127.0.0.1`.`_site_`::  Any site-local addresses on the system, for example `192.168.0.1`.`_global_`::  Any globally-scoped addresses on the system, for example `8.8.8.8`.`_[networkInterface]_`::  Use the addresses of the network interface called `[networkInterface]`. For  example if you wish to use the addresses of an interface called `en0` then  set `network.host: _en0_`.`0.0.0.0`::  The addresses of all available network interfaces.NOTE: Any values containing a `:` (e.g. an IPv6 address or some of the<<network-interface-values,special values>>) must be quoted because `:` is aspecial character in YAML.[[network-interface-values-ipv4-vs-ipv6]]===== IPv4 vs IPv6These special values yield both IPv4 and IPv6 addresses by default, but you canalso add an `:ipv4` or `:ipv6` suffix to limit them to just IPv4 or IPv6addresses respectively. For example, `network.host: _en0:ipv4_` would set thisnode's addresses to the IPv4 addresses of interface `en0`.[TIP].Discovery in the Cloud================================More special settings are available when running in the Cloud with either the{plugins}/discovery-ec2.html[EC2 discovery plugin] or the{plugins}/discovery-gce-network-host.html#discovery-gce-network-host[Google Compute Engine discovery plugin]installed.================================[[modules-network-binding-publishing]]==== Binding and publishing{es} uses network addresses for two distinct purposes known as binding andpublishing. Most nodes will use the same address for everything, but morecomplicated setups may need to configure different addresses for differentpurposes.When an application such as {es} wishes to receive network communications, itmust indicate to the operating system the address or addresses whose traffic itshould receive. This is known as _binding_ to those addresses. {es} can bind tomore than one address if needed, but most nodes only bind to a single address.{es} can only bind to an address if it is running on a host that has a networkinterface with that address. If necessary, you can configure the transport andHTTP interfaces to bind to different addresses.Each {es} node has an address at which clients and other nodes can contact it,known as its _publish address_. Each node has one publish address for its HTTPinterface and one for its transport interface. These two addresses can beanything, and don't need to be addresses of the network interfaces on the host.The only requirements are that each node must be:* Accessible at its transport publish address by all other  nodes in its cluster, and by any remote clusters that will discover it using  <<sniff-mode>>.* Accessible at its HTTP publish address by all clients  that will discover it using sniffing.===== Using a single addressThe most common configuration is for {es} to bind to a single address at whichit is accessible to clients and other nodes. In this configuration you shouldjust set `network.host` to that address. You should not separately set any bindor publish addresses, nor should you separately configure the addresses for theHTTP or transport interfaces.===== Using multiple addressesUse the <<advanced-network-settings, advanced network settings>> if you wish tobind {es} to multiple addresses, or to publish a different address from theaddresses to which you are binding. Set `network.bind_host` to the bindaddresses, and `network.publish_host` to the address at which this node isexposed. In complex configurations, you can configure these addressesdifferently for the HTTP and transport interfaces.[[advanced-network-settings]]==== Advanced network settingsThese advanced settings let you bind to multiple addresses, or to use differentaddresses for binding and publishing. They are not required in most cases andyou should not use them if you can use the <<common-network-settings,commonlyused settings>> instead.`network.bind_host`::(<<static-cluster-setting,Static>>)The network address(es) to which the node should bind in order to listen forincoming connections. Accepts a list of IP addresses, hostnames, and<<network-interface-values,special values>>. Defaults to the address given by`network.host`. Use this setting only if binding to multiple addresses or usingdifferent addresses for publishing and binding.`network.publish_host`::(<<static-cluster-setting,Static>>)The network address that clients and other nodes can use to contact this node.Accepts an IP address, a hostname, or a <<network-interface-values,specialvalue>>. Defaults to the address given by `network.host`. Use this setting onlyif bindiing to multiple addresses or using different addresses for publishingand binding.NOTE: You can specify a list of addresses for `network.host` and`network.publish_host`. You can also specify a single hostname which resolvesto multiple addresses. If you do this then {es} chooses one of the addressesfor its publish address. This choice uses heuristics based on IPv4/IPv6 stackpreference and reachability and may change when the node restarts. You mustmake sure that each node is accessible at all possible publish addresses.[[tcp-settings]]===== Advanced TCP settingsUse the following settings to control the low-level parameters of the TCPconnections used by the HTTP and transport interfaces.`network.tcp.no_delay`::(<<static-cluster-setting,Static>>)Enable or disable the {wikipedia}/Nagle%27s_algorithm[TCP no delay]setting. Defaults to `true`.`network.tcp.keep_alive`::(<<static-cluster-setting,Static>>)Configures the `SO_KEEPALIVE` option for this socket, whichdetermines whether it sends TCP keepalive probes.`network.tcp.keep_idle`::(<<static-cluster-setting,Static>>)Configures the `TCP_KEEPIDLE` option for this socket, whichdetermines the time in seconds that a connection must be idle beforestarting to send TCP keepalive probes. Defaults to `-1`, which usesthe system default. This value cannot exceed `300` seconds. Only applicable on Linux and macOS,and requires Java 11 or newer.`network.tcp.keep_interval`::(<<static-cluster-setting,Static>>)Configures the `TCP_KEEPINTVL` option for this socket,which determines the time in seconds between sending TCP keepalive probes.Defaults to `-1`, which uses the system default. This value cannot exceed `300` seconds.Only applicable on Linux and macOS, and requires Java 11 or newer.`network.tcp.keep_count`::(<<static-cluster-setting,Static>>)Configures the `TCP_KEEPCNT` option for this socket, whichdetermines the number of unacknowledged TCP keepalive probes that may besent on a connection before it is dropped. Defaults to `-1`,which uses the system default. Only applicable on Linux and macOS, and requiresJava 11 or newer.`network.tcp.reuse_address`::(<<static-cluster-setting,Static>>)Should an address be reused or not. Defaults to `true` on non-windowsmachines.`network.tcp.send_buffer_size`::(<<static-cluster-setting,Static>>)The size of the TCP send buffer (specified with <<size-units,size units>>).By default not explicitly set.`network.tcp.receive_buffer_size`::(<<static-cluster-setting,Static>>)The size of the TCP receive buffer (specified with <<size-units,size units>>).By default not explicitly set.include::http.asciidoc[]include::transport.asciidoc[]include::network/tracers.asciidoc[]
 |