transport.asciidoc 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. [[modules-transport]]
  2. === Transport
  3. Clients send requests to your {es} cluster over <<modules-http,HTTP>>, but the
  4. node that receives a client request cannot always handle it alone and must
  5. normally pass it on to other nodes for further processing. It does this using
  6. the transport networking layer. The transport layer is used for all internal
  7. communication between nodes within a cluster, and also for all communication
  8. with the nodes of a <<modules-remote-clusters,remote cluster>>.
  9. [[transport-settings]]
  10. ==== Transport settings
  11. The following settings can be configured for the internal transport that
  12. communicates over TCP. These settings also use the common
  13. <<modules-network,network settings>>.
  14. `transport.port`::
  15. (<<static-cluster-setting,Static>>)
  16. A bind port range. Defaults to `9300-9400`.
  17. `transport.publish_port`::
  18. (<<static-cluster-setting,Static>>)
  19. The port that other nodes in the cluster
  20. should use when communicating with this node. Useful when a cluster node
  21. is behind a proxy or firewall and the `transport.port` is not directly
  22. addressable from the outside. Defaults to the actual port assigned via
  23. `transport.port`.
  24. `transport.bind_host`::
  25. (<<static-cluster-setting,Static>>)
  26. The host address to bind the transport service to. Defaults to
  27. `transport.host` (if set) or `network.bind_host`.
  28. `transport.publish_host`::
  29. (<<static-cluster-setting,Static>>)
  30. The host address to publish for nodes in the cluster to connect to.
  31. Defaults to `transport.host` (if set) or `network.publish_host`.
  32. `transport.host`::
  33. (<<static-cluster-setting,Static>>)
  34. Used to set the `transport.bind_host` and the `transport.publish_host`.
  35. `transport.connect_timeout`::
  36. (<<static-cluster-setting,Static>>)
  37. The connect timeout for initiating a new connection (in
  38. time setting format). Defaults to `30s`.
  39. `transport.compress`::
  40. (<<static-cluster-setting,Static>>)
  41. Set to `true` to enable compression (`DEFLATE`) between
  42. all nodes. Defaults to `false`.
  43. `transport.ping_schedule`::
  44. (<<static-cluster-setting,Static>>)
  45. Schedule a regular application-level ping message
  46. to ensure that transport connections between nodes are kept alive. Defaults to
  47. `5s` in the transport client and `-1` (disabled) elsewhere. It is preferable
  48. to correctly configure TCP keep-alives instead of using this feature, because
  49. TCP keep-alives apply to all kinds of long-lived connections and not just to
  50. transport connections.
  51. `transport.tcp.no_delay`::
  52. (<<static-cluster-setting,Static>>)
  53. Enable or disable the {wikipedia}/Nagle%27s_algorithm[TCP no delay]
  54. setting. Defaults to `network.tcp.no_delay`.
  55. `transport.tcp.keep_alive`::
  56. (<<static-cluster-setting,Static>>)
  57. Configures the `SO_KEEPALIVE` option for this socket, which
  58. determines whether it sends TCP keepalive probes.
  59. Defaults to `network.tcp.keep_alive`.
  60. `transport.tcp.keep_idle`::
  61. (<<static-cluster-setting,Static>>)
  62. Configures the `TCP_KEEPIDLE` option for this socket, which
  63. determines the time in seconds that a connection must be idle before
  64. starting to send TCP keepalive probes. Defaults to `network.tcp.keep_idle` if set,
  65. or the system default otherwise.
  66. This value cannot exceed `300` seconds. In cases where the system default
  67. is higher than `300`, the value is automatically lowered to `300`. Only applicable on
  68. Linux and macOS, and requires Java 11 or newer.
  69. `transport.tcp.keep_interval`::
  70. (<<static-cluster-setting,Static>>)
  71. Configures the `TCP_KEEPINTVL` option for this socket,
  72. which determines the time in seconds between sending TCP keepalive probes.
  73. Defaults to `network.tcp.keep_interval` if set, or the system default otherwise.
  74. This value cannot exceed `300` seconds. In cases where the system default is higher than `300`,
  75. the value is automatically lowered to `300`. Only applicable on Linux and macOS,
  76. and requires Java 11 or newer.
  77. `transport.tcp.keep_count`::
  78. (<<static-cluster-setting,Static>>)
  79. Configures the `TCP_KEEPCNT` option for this socket, which
  80. determines the number of unacknowledged TCP keepalive probes that may be
  81. sent on a connection before it is dropped. Defaults to `network.tcp.keep_count`
  82. if set, or the system default otherwise. Only applicable on Linux and macOS, and
  83. requires Java 11 or newer.
  84. `transport.tcp.reuse_address`::
  85. (<<static-cluster-setting,Static>>)
  86. Should an address be reused or not. Defaults to `network.tcp.reuse_address`.
  87. `transport.tcp.send_buffer_size`::
  88. (<<static-cluster-setting,Static>>)
  89. The size of the TCP send buffer (specified with <<size-units,size units>>).
  90. Defaults to `network.tcp.send_buffer_size`.
  91. `transport.tcp.receive_buffer_size`::
  92. (<<static-cluster-setting,Static>>)
  93. The size of the TCP receive buffer (specified with <<size-units,size units>>).
  94. Defaults to `network.tcp.receive_buffer_size`.
  95. [[transport-profiles]]
  96. ===== Transport profiles
  97. Elasticsearch allows you to bind to multiple ports on different interfaces by
  98. the use of transport profiles. See this example configuration
  99. [source,yaml]
  100. --------------
  101. transport.profiles.default.port: 9300-9400
  102. transport.profiles.default.bind_host: 10.0.0.1
  103. transport.profiles.client.port: 9500-9600
  104. transport.profiles.client.bind_host: 192.168.0.1
  105. transport.profiles.dmz.port: 9700-9800
  106. transport.profiles.dmz.bind_host: 172.16.1.2
  107. --------------
  108. The `default` profile is special. It is used as a fallback for any other
  109. profiles, if those do not have a specific configuration setting set, and is how
  110. this node connects to other nodes in the cluster.
  111. The following parameters can be configured on each transport profile, as in the
  112. example above:
  113. * `port`: The port to which to bind.
  114. * `bind_host`: The host to which to bind.
  115. * `publish_host`: The host which is published in informational APIs.
  116. Profiles also support all the other transport settings specified in the
  117. <<transport-settings,transport settings>> section, and use these as defaults.
  118. For example, `transport.profiles.client.tcp.reuse_address` can be explicitly
  119. configured, and defaults otherwise to `transport.tcp.reuse_address`.
  120. [[long-lived-connections]]
  121. ===== Long-lived idle connections
  122. A transport connection between two nodes is made up of a number of long-lived
  123. TCP connections, some of which may be idle for an extended period of time.
  124. Nonetheless, Elasticsearch requires these connections to remain open, and it
  125. can disrupt the operation of your cluster if any inter-node connections are
  126. closed by an external influence such as a firewall. It is important to
  127. configure your network to preserve long-lived idle connections between
  128. Elasticsearch nodes, for instance by leaving `tcp.keep_alive` enabled and
  129. ensuring that the keepalive interval is shorter than any timeout that might
  130. cause idle connections to be closed, or by setting `transport.ping_schedule` if
  131. keepalives cannot be configured. Devices which drop connections when they reach
  132. a certain age are a common source of problems to Elasticsearch clusters, and
  133. must not be used.
  134. [[request-compression]]
  135. ===== Request compression
  136. By default, the `transport.compress` setting is `false` and network-level
  137. request compression is disabled between nodes in the cluster. This default
  138. normally makes sense for local cluster communication as compression has a
  139. noticeable CPU cost and local clusters tend to be set up with fast network
  140. connections between nodes.
  141. The `transport.compress` setting always configures local cluster request
  142. compression and is the fallback setting for remote cluster request compression.
  143. If you want to configure remote request compression differently than local
  144. request compression, you can set it on a per-remote cluster basis using the
  145. <<remote-cluster-settings,`cluster.remote.${cluster_alias}.transport.compress` setting>>.
  146. [[response-compression]]
  147. ===== Response compression
  148. The compression settings do not configure compression for responses. {es} will
  149. compress a response if the inbound request was compressed--even when compression
  150. is not enabled. Similarly, {es} will not compress a response if the inbound
  151. request was uncompressed--even when compression is enabled.
  152. [[transport-tracer]]
  153. ==== Transport tracer
  154. The transport layer has a dedicated tracer logger which, when activated, logs incoming and out going requests. The log can be dynamically activated
  155. by setting the level of the `org.elasticsearch.transport.TransportService.tracer` logger to `TRACE`:
  156. [source,console]
  157. --------------------------------------------------
  158. PUT _cluster/settings
  159. {
  160. "transient" : {
  161. "logger.org.elasticsearch.transport.TransportService.tracer" : "TRACE"
  162. }
  163. }
  164. --------------------------------------------------
  165. You can also control which actions will be traced, using a set of include and exclude wildcard patterns. By default every request will be traced
  166. except for fault detection pings:
  167. [source,console]
  168. --------------------------------------------------
  169. PUT _cluster/settings
  170. {
  171. "transient" : {
  172. "transport.tracer.include" : "*",
  173. "transport.tracer.exclude" : "internal:coordination/fault_detection/*"
  174. }
  175. }
  176. --------------------------------------------------