get-follow-stats.asciidoc 9.9 KB

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