You can manage statistics collection by using different configurations, file locations, and methods.
Changing statistics configuration
The default Couchbase Server statistics collection is set to collect every second, but can be adjusted to collect statistics less frequently.
To change statistic collection:
- Log in as root or use sudo to change the Couchbase Server static configuration, which is located at: /opt/couchbase/etc/couchbase/static_config by default.
- Add the parameter grab_stats_every_n_ticks, 10, where 10 is the number of ticks. In the Couchbase Server environment, one tick is one second (default). It is recommended that the statistics collection be more frequent (and accurate). However, assign an appropriate tick value for your environment.
- Restart the Couchbase Server service.
After restarting the Couchbase service, the statistics collection rate is changed.
Changing statistics file location
The default stats file location is /opt/couchbase/var/lib/couchbase/stats. However, if you want to change the default stats file location, create a symlink location to the new directory.
Monitoring cluster tasks
You can use the REST API or Couchbase Server command-line tools to monitor various cluster tasks, such as node warmup, rebalance operations, and more. In this section examples for retrieving the following per-node operational information from a Couchbase Server cluster will be detailed to familiarize you with the resources available to you.
Example operational information:
- Basic node status
- Node warmup status
- Current operations per second
- Rebalance progress
As previously shown, The REST API provides a great deal of statistical and performance metric oriented information. You can also gather a wealth of cluster operational information from it as well. The cbstats and couchbase-cli commands can also be used to gather cluster task related information.
The following are command examples to retrieve the example operational information listed above.
- Basic node status: Node warmup status
You can use the cbstats utility on the node in question to quickly monitor warmup. Here is an example with output showing warmup in progress (note
cbstats localhost:11210 all | grep warmup ep_failpartialwarmup: 0 ep_waitforwarmup: 0 ep_warmup: 1 ep_warmup_batch_size: 1000 ep_warmup_dups: 0 ep_warmup_min_items_threshold: 100 ep_warmup_min_memory_threshold: 100 ep_warmup_oom: 0 ep_warmup_thread: running
- Current operations per second: Rebalance progress
Use curl, python, and grep with the REST API to check rebalance status:
curl --silent -u Administrator:couchbase cb1:8091/pools/default/tasks \ | python -mjson.tool | grep -A1 -B4 rebalance }, "progress": 83.18109021492943, "recommendedRefreshPeriod": 0.25, "status": "running", "subtype": "rebalance", "type": "rebalance" },
From this simplified example, you can see that rebalance is running and is approximately 83% complete. If you omit the grep command, you can get detailed rebalance progress metrics as well.