get-follow-stats.asciidoc 10 KB

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