Flushing buckets

Flushing buckets

Buckets are flushed by enable the flush option then flushing.


Flushing buckets involves:
  1. Enable the flush buckets option.
  2. Flush the bucket.

When you want to flush a data bucket, first enable this option and then actually issue the command to flush the data bucket. The --enable-flush option is either true or false. False is 0, meaning, do not enable flush (default). True is 1, meaning enable flush.

You can enable this option when you create the data bucket or edit bucket properties.

Important: After you explicitly enable data bucket flush, flush the data from the bucket. Flushing a bucket is data destructive. Client applications using this are advised to double check with the end user before sending such a request. You can control and limit the ability to flush individual buckets by setting the flushEnabled parameter on a bucket in Couchbase web console.
Warning: We do not advise that you enable this option if your data bucket is in a production environment.

CLI command and parameter

Flush can be enable when either creating or editing a bucket with the bucket-create and bucket-edit commands.

To enable bucket flush when creating a bucket, set the --enable-flush parameter to 1:

To flush the bucket, use couchbase-cli bucket-flush command.


By default, the bucket-flush command confirms whether or not you truly want to flush the data bucket. You can optionally call this command with the --force option to flush data without confirmation.

Request syntax:

couchbase-cli bucket-flush -c [localhost]:8091 -u [admin] -p [password] 
    --enable-flush=[0 | 1]


Example request:

couchbase-cli bucket-flush -c -u Administrator -p password 


Example request response where you need to verify whether you want to flush the bucket. In this case, you need to specify either Yes or No.

Running this command will totally PURGE database data from disk. Do you really want to do it? (Yes/No)

Example request error response where the bucket that you want to flush is set up with XDCR replication:

ERROR: unable to bucket-flush; please check if the bucket exists or not; (503) Service Unavailable
{u'_': u'Cannot flush buckets with outgoing XDCR'}