get-follow-stats.asciidoc 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. [role="xpack"]
  2. [[ccr-get-follow-stats]]
  3. === Get follower stats API
  4. ++++
  5. <titleabbrev>Get follower stats</titleabbrev>
  6. ++++
  7. Get follower stats.
  8. [[ccr-get-follow-stats-request]]
  9. ==== {api-request-title}
  10. //////////////////////////
  11. [source,console]
  12. --------------------------------------------------
  13. PUT /follower_index/_ccr/follow?wait_for_active_shards=1
  14. {
  15. "remote_cluster" : "remote_cluster",
  16. "leader_index" : "leader_index"
  17. }
  18. --------------------------------------------------
  19. // TESTSETUP
  20. // TEST[setup:remote_cluster_and_leader_index]
  21. [source,console]
  22. --------------------------------------------------
  23. POST /follower_index/_ccr/pause_follow
  24. --------------------------------------------------
  25. // TEARDOWN
  26. //////////////////////////
  27. [source,console]
  28. --------------------------------------------------
  29. GET /<index>/_ccr/stats
  30. --------------------------------------------------
  31. // TEST[s/<index>/follower_index/]
  32. [[ccr-get-follow-stats-prereqs]]
  33. ==== {api-prereq-title}
  34. * If the {es} {security-features} are enabled, you must have `monitor` cluster
  35. privileges on the cluster that contains the follower index. For more information,
  36. see <<security-privileges>>.
  37. [[ccr-get-follow-stats-desc]]
  38. ==== {api-description-title}
  39. This API gets follower stats. This API will return shard-level stats about the
  40. following tasks associated with each shard for the specified indices.
  41. [[ccr-get-follow-stats-path-parms]]
  42. ==== {api-path-parms-title}
  43. `<index>`::
  44. (Required, string) A comma-delimited list of index patterns.
  45. [[ccr-get-follow-stats-query-params]]
  46. ==== {api-query-parms-title}
  47. `timeout`::
  48. (Optional, time) Controls the amount of time to wait for results. Defaults to unlimited.
  49. [role="child_attributes"]
  50. [[ccr-get-follow-stats-response-body]]
  51. ==== {api-response-body-title}
  52. //Begin indices
  53. `indices`::
  54. (array) An array of follower index statistics.
  55. +
  56. .Properties of `indices`
  57. [%collapsible%open]
  58. ====
  59. `fatal_exception`::
  60. (object) An object representing a fatal exception that cancelled the following
  61. task. In this situation, the following task must be resumed manually with the
  62. <<ccr-post-resume-follow,resume follower API>>.
  63. `index`::
  64. (string) The name of the follower index.
  65. `total_global_checkpoint_lag`::
  66. (long) Indication of how much the follower is lagging the leader. This is the sum of the difference between the `leader_global_checkpoint` and the `follower_global_checkpoint` for all shards.
  67. //Begin shards
  68. `shards`::
  69. (array) An array of shard-level following task statistics.
  70. +
  71. .Properties of objects in `shards`
  72. [%collapsible%open]
  73. =====
  74. `bytes_read`::
  75. (long) The total of transferred bytes read from the leader.
  76. +
  77. --
  78. NOTE: This is only an estimate and does not account for compression if enabled.
  79. --
  80. `failed_read_requests`::
  81. (long) The number of failed reads.
  82. `failed_write_requests`::
  83. (long) The number of failed bulk write requests executed on the follower.
  84. `follower_aliases_version`::
  85. (long) The index aliases version the follower is synced up to.
  86. `follower_global_checkpoint`::
  87. (long) The current global checkpoint on the follower. The difference between the
  88. `leader_global_checkpoint` and the `follower_global_checkpoint` is an
  89. indication of how much the follower is lagging the leader.
  90. `follower_index`::
  91. (string) The name of the follower index.
  92. `follower_mapping_version`::
  93. (long) The mapping version the follower is synced up to.
  94. `follower_max_seq_no`::
  95. (long) The current maximum sequence number on the follower.
  96. `follower_settings_version`::
  97. (long) The index settings version the follower is synced up to.
  98. `last_requested_seq_no`::
  99. (long) The starting sequence number of the last batch of operations requested
  100. from the leader.
  101. `leader_global_checkpoint`::
  102. (long) The current global checkpoint on the leader known to the follower task.
  103. `leader_index`::
  104. (string) The name of the index in the leader cluster being followed.
  105. `leader_max_seq_no`::
  106. (long) The current maximum sequence number on the leader known to the follower
  107. task.
  108. `operations_read`::
  109. (long) The total number of operations read from the leader.
  110. `operations_written`::
  111. (long) The number of operations written on the follower.
  112. `outstanding_read_requests`::
  113. (integer) The number of active read requests from the follower.
  114. `outstanding_write_requests`::
  115. (integer) The number of active bulk write requests on the follower.
  116. //Begin read_exceptions
  117. `read_exceptions`::
  118. (array) An array of objects representing failed reads.
  119. +
  120. .Properties of objects in `read_exceptions`
  121. [%collapsible%open]
  122. ======
  123. `exception`::
  124. (object) Represents the exception that caused the read to fail.
  125. `from_seq_no`::
  126. (long) The starting sequence number of the batch requested from the leader.
  127. `retries`::
  128. (integer) The number of times the batch has been retried.
  129. ======
  130. //End read_exceptions
  131. `remote_cluster`::
  132. (string) The <<remote-clusters,remote cluster>> containing the leader
  133. index.
  134. `shard_id`::
  135. (integer) The numerical shard ID, with values from 0 to one less than the
  136. number of replicas.
  137. `successful_read_requests`::
  138. (long) The number of successful fetches.
  139. `successful_write_requests`::
  140. (long) The number of bulk write requests executed on the follower.
  141. `time_since_last_read_millis`::
  142. (long) The number of milliseconds since a read request was sent to the leader.
  143. +
  144. NOTE: When the follower is caught up to the leader, this number will increase up
  145. to the configured `read_poll_timeout` at which point another read request will
  146. be sent to the leader.
  147. `total_read_remote_exec_time_millis`::
  148. (long) The total time reads spent executing on the remote cluster.
  149. `total_read_time_millis`::
  150. (long) The total time reads were outstanding, measured from the time a read was
  151. sent to the leader to the time a reply was returned to the follower.
  152. `total_write_time_millis`::
  153. (long) The total time spent writing on the follower.
  154. `write_buffer_operation_count`::
  155. (integer) The number of write operations queued on the follower.
  156. `write_buffer_size_in_bytes`::
  157. (long) The total number of bytes of operations currently queued for writing.
  158. =====
  159. //End shards
  160. ====
  161. //End indices
  162. [[ccr-get-follow-stats-examples]]
  163. ==== {api-examples-title}
  164. This example retrieves follower stats:
  165. [source,console]
  166. --------------------------------------------------
  167. GET /follower_index/_ccr/stats
  168. --------------------------------------------------
  169. The API returns the following results:
  170. [source,console-result]
  171. --------------------------------------------------
  172. {
  173. "indices" : [
  174. {
  175. "index" : "follower_index",
  176. "total_global_checkpoint_lag" : 256,
  177. "shards" : [
  178. {
  179. "remote_cluster" : "remote_cluster",
  180. "leader_index" : "leader_index",
  181. "follower_index" : "follower_index",
  182. "shard_id" : 0,
  183. "leader_global_checkpoint" : 1024,
  184. "leader_max_seq_no" : 1536,
  185. "follower_global_checkpoint" : 768,
  186. "follower_max_seq_no" : 896,
  187. "last_requested_seq_no" : 897,
  188. "outstanding_read_requests" : 8,
  189. "outstanding_write_requests" : 2,
  190. "write_buffer_operation_count" : 64,
  191. "follower_mapping_version" : 4,
  192. "follower_settings_version" : 2,
  193. "follower_aliases_version" : 8,
  194. "total_read_time_millis" : 32768,
  195. "total_read_remote_exec_time_millis" : 16384,
  196. "successful_read_requests" : 32,
  197. "failed_read_requests" : 0,
  198. "operations_read" : 896,
  199. "bytes_read" : 32768,
  200. "total_write_time_millis" : 16384,
  201. "write_buffer_size_in_bytes" : 1536,
  202. "successful_write_requests" : 16,
  203. "failed_write_requests" : 0,
  204. "operations_written" : 832,
  205. "read_exceptions" : [ ],
  206. "time_since_last_read_millis" : 8
  207. }
  208. ]
  209. }
  210. ]
  211. }
  212. --------------------------------------------------
  213. // TESTRESPONSE[s/"total_global_checkpoint_lag" : 256/"total_global_checkpoint_lag" : 0/]
  214. // TESTRESPONSE[s/"leader_global_checkpoint" : 1024/"leader_global_checkpoint" : $body.indices.0.shards.0.leader_global_checkpoint/]
  215. // TESTRESPONSE[s/"leader_max_seq_no" : 1536/"leader_max_seq_no" : $body.indices.0.shards.0.leader_max_seq_no/]
  216. // TESTRESPONSE[s/"follower_global_checkpoint" : 768/"follower_global_checkpoint" : $body.indices.0.shards.0.follower_global_checkpoint/]
  217. // TESTRESPONSE[s/"follower_max_seq_no" : 896/"follower_max_seq_no" : $body.indices.0.shards.0.follower_max_seq_no/]
  218. // TESTRESPONSE[s/"last_requested_seq_no" : 897/"last_requested_seq_no" : $body.indices.0.shards.0.last_requested_seq_no/]
  219. // TESTRESPONSE[s/"outstanding_read_requests" : 8/"outstanding_read_requests" : $body.indices.0.shards.0.outstanding_read_requests/]
  220. // TESTRESPONSE[s/"outstanding_write_requests" : 2/"outstanding_write_requests" : $body.indices.0.shards.0.outstanding_write_requests/]
  221. // TESTRESPONSE[s/"write_buffer_operation_count" : 64/"write_buffer_operation_count" : $body.indices.0.shards.0.write_buffer_operation_count/]
  222. // TESTRESPONSE[s/"follower_mapping_version" : 4/"follower_mapping_version" : $body.indices.0.shards.0.follower_mapping_version/]
  223. // TESTRESPONSE[s/"follower_settings_version" : 2/"follower_settings_version" : $body.indices.0.shards.0.follower_settings_version/]
  224. // TESTRESPONSE[s/"follower_aliases_version" : 8/"follower_aliases_version" : $body.indices.0.shards.0.follower_aliases_version/]
  225. // TESTRESPONSE[s/"total_read_time_millis" : 32768/"total_read_time_millis" : $body.indices.0.shards.0.total_read_time_millis/]
  226. // TESTRESPONSE[s/"total_read_remote_exec_time_millis" : 16384/"total_read_remote_exec_time_millis" : $body.indices.0.shards.0.total_read_remote_exec_time_millis/]
  227. // TESTRESPONSE[s/"successful_read_requests" : 32/"successful_read_requests" : $body.indices.0.shards.0.successful_read_requests/]
  228. // TESTRESPONSE[s/"failed_read_requests" : 0/"failed_read_requests" : $body.indices.0.shards.0.failed_read_requests/]
  229. // TESTRESPONSE[s/"operations_read" : 896/"operations_read" : $body.indices.0.shards.0.operations_read/]
  230. // TESTRESPONSE[s/"bytes_read" : 32768/"bytes_read" : $body.indices.0.shards.0.bytes_read/]
  231. // TESTRESPONSE[s/"total_write_time_millis" : 16384/"total_write_time_millis" : $body.indices.0.shards.0.total_write_time_millis/]
  232. // TESTRESPONSE[s/"write_buffer_size_in_bytes" : 1536/"write_buffer_size_in_bytes" : $body.indices.0.shards.0.write_buffer_size_in_bytes/]
  233. // TESTRESPONSE[s/"successful_write_requests" : 16/"successful_write_requests" : $body.indices.0.shards.0.successful_write_requests/]
  234. // TESTRESPONSE[s/"failed_write_requests" : 0/"failed_write_requests" : $body.indices.0.shards.0.failed_write_requests/]
  235. // TESTRESPONSE[s/"operations_written" : 832/"operations_written" : $body.indices.0.shards.0.operations_written/]
  236. // TESTRESPONSE[s/"time_since_last_read_millis" : 8/"time_since_last_read_millis" : $body.indices.0.shards.0.time_since_last_read_millis/]