get-ccr-stats.asciidoc 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. [role="xpack"]
  2. [[ccr-get-stats]]
  3. === Get {ccr} stats API
  4. [subs="attributes"]
  5. ++++
  6. <titleabbrev>Get {ccr-init} stats</titleabbrev>
  7. ++++
  8. .New API reference
  9. [sidebar]
  10. --
  11. For the most up-to-date API details, refer to {api-es}/group/endpoint-ccr[Cross-cluster replication APIs].
  12. --
  13. Get <<xpack-ccr,{ccr}>> stats.
  14. [[ccr-get-stats-request]]
  15. ==== {api-request-title}
  16. //////////////////////////
  17. [source,console]
  18. --------------------------------------------------
  19. PUT /follower_index/_ccr/follow?wait_for_active_shards=1
  20. {
  21. "remote_cluster" : "remote_cluster",
  22. "leader_index" : "leader_index"
  23. }
  24. --------------------------------------------------
  25. // TESTSETUP
  26. // TEST[setup:remote_cluster_and_leader_index]
  27. [source,console]
  28. --------------------------------------------------
  29. POST /follower_index/_ccr/pause_follow
  30. --------------------------------------------------
  31. // TEARDOWN
  32. //////////////////////////
  33. [source,console]
  34. --------------------------------------------------
  35. GET /_ccr/stats
  36. --------------------------------------------------
  37. ==== {api-prereq-title}
  38. * If the {es} {security-features} are enabled, you must have `monitor` cluster
  39. privileges on the cluster that contains the follower index. For more information,
  40. see <<security-privileges>>.
  41. [[ccr-get-stats-desc]]
  42. ==== {api-description-title}
  43. This API gets {ccr} stats. This API will return all stats related to {ccr}. In
  44. particular, this API returns stats about auto-following, and returns the same
  45. shard-level stats as in the <<ccr-get-follow-stats,get follower stats API>>.
  46. [[ccr-get-stats-query-params]]
  47. ==== {api-query-parms-title}
  48. `timeout`::
  49. (Optional, time) Controls the amount of time to wait for results. Defaults to unlimited.
  50. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=master-timeout]
  51. [role="child_attributes"]
  52. [[ccr-get-stats-response-body]]
  53. ==== {api-response-body-title}
  54. //Begin auto_follow_stats
  55. `auto_follow_stats`::
  56. (object) An object representing stats for the auto-follow coordinator.
  57. +
  58. .Properties of `auto_follow_stats`
  59. [%collapsible%open]
  60. ====
  61. `number_of_failed_follow_indices`::
  62. (long) The number of indices that the auto-follow coordinator failed to
  63. automatically follow. The causes of recent failures are captured in the logs
  64. of the elected master node and in the
  65. `auto_follow_stats.recent_auto_follow_errors` field.
  66. `number_of_failed_remote_cluster_state_requests`::
  67. (long) The number of times that the auto-follow coordinator failed to retrieve
  68. the cluster state from a remote cluster registered in a collection of
  69. auto-follow patterns.
  70. `number_of_successful_follow_indices`::
  71. (long) The number of indices that the auto-follow coordinator successfully
  72. followed.
  73. `recent_auto_follow_errors`::
  74. (array) An array of objects representing failures by the auto-follow coordinator.
  75. ====
  76. //End auto_follow_stats
  77. `follow_stats`::
  78. (object) An object representing shard-level stats for follower indices; refer to
  79. the details of the response in the
  80. <<ccr-get-follow-stats,get follower stats API>>.
  81. [[ccr-get-stats-examples]]
  82. ==== {api-examples-title}
  83. This example retrieves {ccr} stats:
  84. [source,console]
  85. --------------------------------------------------
  86. GET /_ccr/stats
  87. --------------------------------------------------
  88. The API returns the following results:
  89. [source,console-result]
  90. --------------------------------------------------
  91. {
  92. "auto_follow_stats" : {
  93. "number_of_failed_follow_indices" : 0,
  94. "number_of_failed_remote_cluster_state_requests" : 0,
  95. "number_of_successful_follow_indices" : 1,
  96. "recent_auto_follow_errors" : [],
  97. "auto_followed_clusters" : []
  98. },
  99. "follow_stats" : {
  100. "indices" : [
  101. {
  102. "index" : "follower_index",
  103. "total_global_checkpoint_lag" : 256,
  104. "shards" : [
  105. {
  106. "remote_cluster" : "remote_cluster",
  107. "leader_index" : "leader_index",
  108. "follower_index" : "follower_index",
  109. "shard_id" : 0,
  110. "leader_global_checkpoint" : 1024,
  111. "leader_max_seq_no" : 1536,
  112. "follower_global_checkpoint" : 768,
  113. "follower_max_seq_no" : 896,
  114. "last_requested_seq_no" : 897,
  115. "outstanding_read_requests" : 8,
  116. "outstanding_write_requests" : 2,
  117. "write_buffer_operation_count" : 64,
  118. "follower_mapping_version" : 4,
  119. "follower_settings_version" : 2,
  120. "follower_aliases_version" : 8,
  121. "total_read_time_millis" : 32768,
  122. "total_read_remote_exec_time_millis" : 16384,
  123. "successful_read_requests" : 32,
  124. "failed_read_requests" : 0,
  125. "operations_read" : 896,
  126. "bytes_read" : 32768,
  127. "total_write_time_millis" : 16384,
  128. "write_buffer_size_in_bytes" : 1536,
  129. "successful_write_requests" : 16,
  130. "failed_write_requests" : 0,
  131. "operations_written" : 832,
  132. "read_exceptions" : [ ],
  133. "time_since_last_read_millis" : 8
  134. }
  135. ]
  136. }
  137. ]
  138. }
  139. }
  140. --------------------------------------------------
  141. // TESTRESPONSE[s/"total_global_checkpoint_lag" : 256/"total_global_checkpoint_lag" : 0/]
  142. // TESTRESPONSE[s/"number_of_failed_follow_indices" : 0/"number_of_failed_follow_indices" : $body.auto_follow_stats.number_of_failed_follow_indices/]
  143. // TESTRESPONSE[s/"number_of_failed_remote_cluster_state_requests" : 0/"number_of_failed_remote_cluster_state_requests" : $body.auto_follow_stats.number_of_failed_remote_cluster_state_requests/]
  144. // TESTRESPONSE[s/"number_of_successful_follow_indices" : 1/"number_of_successful_follow_indices" : $body.auto_follow_stats.number_of_successful_follow_indices/]
  145. // TESTRESPONSE[s/"recent_auto_follow_errors" : \[\]/"recent_auto_follow_errors" : $body.auto_follow_stats.recent_auto_follow_errors/]
  146. // TESTRESPONSE[s/"auto_followed_clusters" : \[\]/"auto_followed_clusters" : $body.auto_follow_stats.auto_followed_clusters/]
  147. // TESTRESPONSE[s/"leader_global_checkpoint" : 1024/"leader_global_checkpoint" : $body.follow_stats.indices.0.shards.0.leader_global_checkpoint/]
  148. // TESTRESPONSE[s/"leader_max_seq_no" : 1536/"leader_max_seq_no" : $body.follow_stats.indices.0.shards.0.leader_max_seq_no/]
  149. // TESTRESPONSE[s/"follower_global_checkpoint" : 768/"follower_global_checkpoint" : $body.follow_stats.indices.0.shards.0.follower_global_checkpoint/]
  150. // TESTRESPONSE[s/"follower_max_seq_no" : 896/"follower_max_seq_no" : $body.follow_stats.indices.0.shards.0.follower_max_seq_no/]
  151. // TESTRESPONSE[s/"last_requested_seq_no" : 897/"last_requested_seq_no" : $body.follow_stats.indices.0.shards.0.last_requested_seq_no/]
  152. // TESTRESPONSE[s/"outstanding_read_requests" : 8/"outstanding_read_requests" : $body.follow_stats.indices.0.shards.0.outstanding_read_requests/]
  153. // TESTRESPONSE[s/"outstanding_write_requests" : 2/"outstanding_write_requests" : $body.follow_stats.indices.0.shards.0.outstanding_write_requests/]
  154. // TESTRESPONSE[s/"write_buffer_operation_count" : 64/"write_buffer_operation_count" : $body.follow_stats.indices.0.shards.0.write_buffer_operation_count/]
  155. // TESTRESPONSE[s/"follower_mapping_version" : 4/"follower_mapping_version" : $body.follow_stats.indices.0.shards.0.follower_mapping_version/]
  156. // TESTRESPONSE[s/"follower_settings_version" : 2/"follower_settings_version" : $body.follow_stats.indices.0.shards.0.follower_settings_version/]
  157. // TESTRESPONSE[s/"follower_aliases_version" : 8/"follower_aliases_version" : $body.follow_stats.indices.0.shards.0.follower_aliases_version/]
  158. // TESTRESPONSE[s/"total_read_time_millis" : 32768/"total_read_time_millis" : $body.follow_stats.indices.0.shards.0.total_read_time_millis/]
  159. // TESTRESPONSE[s/"total_read_remote_exec_time_millis" : 16384/"total_read_remote_exec_time_millis" : $body.follow_stats.indices.0.shards.0.total_read_remote_exec_time_millis/]
  160. // TESTRESPONSE[s/"successful_read_requests" : 32/"successful_read_requests" : $body.follow_stats.indices.0.shards.0.successful_read_requests/]
  161. // TESTRESPONSE[s/"failed_read_requests" : 0/"failed_read_requests" : $body.follow_stats.indices.0.shards.0.failed_read_requests/]
  162. // TESTRESPONSE[s/"operations_read" : 896/"operations_read" : $body.follow_stats.indices.0.shards.0.operations_read/]
  163. // TESTRESPONSE[s/"bytes_read" : 32768/"bytes_read" : $body.follow_stats.indices.0.shards.0.bytes_read/]
  164. // TESTRESPONSE[s/"total_write_time_millis" : 16384/"total_write_time_millis" : $body.follow_stats.indices.0.shards.0.total_write_time_millis/]
  165. // TESTRESPONSE[s/"write_buffer_size_in_bytes" : 1536/"write_buffer_size_in_bytes" : $body.follow_stats.indices.0.shards.0.write_buffer_size_in_bytes/]
  166. // TESTRESPONSE[s/"successful_write_requests" : 16/"successful_write_requests" : $body.follow_stats.indices.0.shards.0.successful_write_requests/]
  167. // TESTRESPONSE[s/"failed_write_requests" : 0/"failed_write_requests" : $body.follow_stats.indices.0.shards.0.failed_write_requests/]
  168. // TESTRESPONSE[s/"operations_written" : 832/"operations_written" : $body.follow_stats.indices.0.shards.0.operations_written/]
  169. // TESTRESPONSE[s/"time_since_last_read_millis" : 8/"time_since_last_read_millis" : $body.follow_stats.indices.0.shards.0.time_since_last_read_millis/]