A newer version of this documentation is available.

View Latest

bucket-flush

Flushes all data from the disk for a given bucket.

Syntax

The basic syntax is:

couchbase-cli bucket-flush -c [host]:8091 -u [admin] -p [password]
    --bucket=[bucket-name]
    --force

Description

You can enable flushing when you create the bucket or edit bucket properties. First enable this option and then issue the command to flush the bucket.

Flushing a bucket can be done as follows:

  1. Enable the flush bucket option.

  2. Flush the bucket.

By default, the bucket-flush command confirms whether or not you want to flush the bucket before performing the flush.

During a flush, any client operations will receive a temporary failure. Once the flush is completed all operations will work as normal.

Flushing a bucket is data destructive. Client applications using this are advised to 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 the Couchbase Web Console.
Do not enable this option if your bucket is in a production environment.

Options

The following are the command options:

Table 1. bucket-flush options
Option Description

--bucket=BUCKETNAME

Named bucket to act on.

--force

Force command execution without asking for confirmation.

Examples

Request:

couchbase-cli bucket-flush -c 192.168.0.1:8091 -u Administrator -p password \
--bucket=testBucket

Response:

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'}