get-follow-stats.asciidoc 10 KB

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