get-follow-stats.asciidoc 10 KB

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