Performing Compaction Manually

  • reference
    Couchbase Server allows a bucket’s data to be compacted manually.


    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]
    curl -i -X POST -u [admin]:[password]


    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.


    The following example performs compaction on the bucket travel-sample:

    curl -i -v -X POST -u Administrator:password \

    Once initiated, the compaction-process can be terminated, with a call such as the following:

    curl -i -v -X POST -u Administrator:password \

    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.