Search:

Search all manuals
Search this manual
Manual
Couchbase Server Manual 2.0
Community Wiki and Resources
Download Couchbase Server 2.0
Couchbase Developer Guide 2.0
Client Libraries
Couchbase Server Forum
Additional Resources
Community Wiki
Community Forums
Couchbase SDKs
Parent Section
8.6 Managing Buckets
Chapter Sections
Chapters

8.6.12. Flushing a Bucket

Warning

This operation is data destructive. The service makes no attempt to confirm or double check the request. 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 or via cbepctl flush_param.

For information about changing this setting in the Web Console, see Section 6.3, “Viewing Data Buckets. For information about flushing data buckets via REST, see Section 8.6.12, “Flushing a Bucket”.

The doFlush operation empties the contents of the specified bucket, deleting all stored data. The operation will only succeed if flush is enabled on configured bucket. The format of the request is the URL of the REST endpoint using the POST HTTP operation:

http://localhost:8091/pools/default/buckets/default/controller/doFlush

For example, using curl:

shell> curl -X POST 'http://Administrator:Password@localhost:8091/pools/default/buckets/default/controller/doFlush'

The equivalent HTTP protocol request:

HTTP Request
POST /pools/default/buckets/default/controller/doFlush
Host: localhost:8091
Authorization: Basic xxxxxxxxxxxxxxxxxxx

Parameters and payload data are ignored, but the request must including the authorization header if the system has been secured.

If flushing is disable for the specified bucket, a 400 response will be returned with the bucket status:

JSON
{"_":"Flush is disabled for the bucket"}

If the flush is successful, the HTTP response code is 200:

HTTP Response
HTTP/1.1 200 OK

Warning

The flush request may lead to significant disk activity as the data in the bucket is deleted from the database. The high disk utilization may affect the performance of your server until the data has been successfully deleted.

Note

Also note that the flush request is not transmitted over XDCR replication configurations; the remote bucket will not be flushed.

Couchbase Server will return a HTTP 404 response if the URI is invalid or if it does not correspond to an active bucket in the system.

HTTP Response
404 Not Found

You can configure whether flush is enabled for a bucket by configuring the individual bucket properties, either the REST API (see Section 8.6.7, “Modifying Bucket Parameters”), or through the Admin Console (see Section 6.3.1, “Creating and Editing Data Buckets”).