Performing Compaction Manually
- reference
Couchbase Server allows a bucket’s data to be compacted manually.
Description
Couchbase Server allows a specified bucket’s data to be compacted by the administrator, manually. Full Admin and Cluster Admin permissions are required.
HTTP methods and URIs
The following methods and URIs allow explicit initiation and cancellation of data-compaction for a specified bucket:
POST /pools/default/buckets/[bucket-name]/controller/compactBucket POST /pools/default/buckets/[bucket-name]/controller/cancelBucketCompaction
Curl Syntax
curl -i -X POST -u [admin]:[password] http://[localhost]:8091/pools/default/buckets/[bucket-name]/controller/compactBucket curl -i -X POST -u [admin]:[password] http://[localhost]:8091/pools/default/buckets/[bucket-name]/controller/cancelBucketCompaction
Responses
If the call is successful, 200 OK
is given, and an object containing group-related information is returned.
An incorrectly specified bucket-name or URI gives 404 Object Not Found
.
Failure to authenticate gives 401 Unauthorized
.
Example
The following example performs compaction on the bucket travel-sample
:
curl -i -v -X POST -u Administrator:password \ http://10.143.193.101:8091/pools/default/buckets/travel-sample/controller/compactBucket
Once initiated, the compaction-process can be terminated, with a call such as the following:
curl -i -v -X POST -u Administrator:password \ http://10.143.193.101:8091/pools/default/buckets/travel-sample/controller/cancelBucketCompaction
See Also
REST APIs for establishing and retrieving auto-compaction settings are provided in Auto-Compaction: Global and Auto-Compaction: Per Bucket.
See Auto-Compaction, for information on managing auto-compaction with Couchbase Web Console.