get-follow-stats.asciidoc 10 KB

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