get-follow-stats.asciidoc 11 KB

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