get-follow-stats.asciidoc 10 KB

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