Module 8 - Monitor Couchbase Cluster Statistics

  Active Queries:  

 select active_requests.* from system:active_requests;
  Prepared Queries: 
 SELECT *, meta().plan FROM system:completed_requests;
  Query completed requests information:  
SELECT *, meta().plan FROM system:completed_requests;

 [OR]

 $ curl -u Administrator:couchbase http://localhost:8093/admin/completed_requests| python -mjson.tool >Cluster_completed_requestes.json
  Top 10 requests having the top reads from the requests that have completed recently:   
select statement, remoteAddr, requestAddr, phaseCounts.`fetch` from system:completed_requests order by phaseCounts.`fetch` desc limit 10;
  Get total execution time of every prepared statement:  
SELECT sum(str_to_duration(avgServiceTime)*uses/1000000000) total,  statement
FROM system:prepareds
WHERE avgServiceTime is not missing  GROUP BY statement
ORDER BY total;
  How many times a statement was executed and what is its  average service time:  
SELECT duration_to_str(avg(str_to_duration(serviceTime)))  avgServiceTime,
count(*) reqCount,  statement
FROM system:completed_requests  GROUP BY statement
ORDER BY avgServiceTime desc;
  Find the most used statements:  
SELECT sum(uses) usecount, statement  FROM system:prepareds WHERE uses is not missing  GROUP BY statement ORDER BY usecount;
  Find statements prepared by the most clients:  
SELECT count(*) prepcount, statement  FROM system:prepareds GROUP BY statement  ORDER BY prepcount;
  Essential Monitoring with REST API:  
Essential Monitoring with REST API: http://<ip>:8091/admin/vitals
Get cluster information-nodes, RAM, storage, URI endpoints: http://<ip>:8091/pools/default
Get stats for a specific node: http://<ip>:8091/nodes/self
Get stats for a specific bucket: http://<ip>:8091/pools/default/buckets/<bucket_name>
List buckets : curl http://<ip>:8091/pools/default/buckets
 
XDCR Stats : curl http://<ip>:8091/pools/default/buckets/<bucket>/stats/replications/<taskId>/<stat>
   Query stats: 
curl http://localhost:8093/admin/stats
curl -u Administrator:password http://<node>:8093/admin/completed_requests  
curl -u Administrator:password http://<node>:8093/admin/active_requests  
curl -u Administrator:password http://<node>:8093/admin/prepareds
  Killing a query (requires connection to the query node):  
curl -u Administrator:password -X DELETE http://<node>:8093/admin/active_requests/uuid
  Index Statistics:  
curl -X GET -u Administrator:password "http://localhost:9102/api/v1/stats/mybucket/myindex?pretty=true"

Note: Above are the commands used/mentioned in Module 8 of the Couchbase Database Administration Course. 

 

DISCLAIMER

The purpose of sharing the content on this website is to Educate. The author/owner of the content do not warrant that the information provided on this website is fully complete and shall not be responsible for any errors or omissions.The author/owner shall have neither liability nor responsibility to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the contents of this website. So, use the content of this website at your own risk.

This content has been shared under Educational And Non-Profit Purposes Only. No Copyright Infringement Intended, All Rights Reserved to the Actual Owner.

For Copyright Content Removal Please Contact us by Email at besttechreads[at]gmail.com


Post a Comment

Previous Post Next Post