How to flush your memcached DB

The Redis Labs Team -

Many of our customers are using our service as their main database, and as such they care a lot about the safety of the data they store in their database.
Many of our customers raised their concern of having a risky operation such as flush available on the UI. This is the reason that we have decided to remove it from the UI.

If you want to flush your database/bucket, you can still do it through the CLI or your preferred client or just using the netcat command to your endpoint will do as well.

using nc command (if your resource is WITHOUT sasl authentication enabled):

The nc (netcat) command is a simple Unix utility which reads and writes data across network connections, using TCP or UDP protocol.
It can simply connect to the Memcached instance and-and invalidate all existing cache.

The usage is simple: `$ echo 'flush_all' | nc [host] [port]`

usage example:


echo 'flush_all' | nc memcached-13367.c11.us-east-1-3.ec2.cloud.redislabs.com 13367

using bmemcached-cli (if your resource enabled SASL authentication):

If your resource has SASL authentication enabled, like most of our users, you can't use nc command or telnet to run `flush_all` on your Memcached Cloud resource. You will have to download some Memcached CLI client that supports SASL. We recommend to use the bmemcached-CLI client, and the instructions here is for this client. This instruction refers to Ubuntu OS. Please make the necessary changes if you are using other Linux flavor.

1. `$ wget https://github.com/RedisLabs/bmemcached-cli/archive/master.zip`
2. `$ sudo apt-get install unzip`
3. `$ unzip master.zip -d bmemcached-cli`
4. `$ cd bmemcached-cli/bmemcached-cli-master/`
5. `$ sudo apt install python-pip`
6. `$ sudo pip install --upgrade pip`
7. `$ sudo pip install . -r requirements.pip`

Now you can run the flush_all command using the bmemcached-cli. The usage is simple:

bmemcached-cli [user]:[password]@[host]:[port]

usage example:


$ bmemcached-cli memcached-app123:x298337!@pub-memcache-1010.us-east-1-3.4.ec2.garantiadata.com:1010

([B]memcached) flush_all
True
exit

Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk