Clearing the cache (flushing) nightly
I have what I hope is a simple question.
I want to flush the cache (empty it) nightly at midnight.
I have a cron that will do this:
/opt/couchbase/bin/couchbase-cli bucket-flush -c 127.0.0.1:8091 --bucket=default
/etc/init.d/couchbase-server restart
Questions:
Do I have to do this on all 5 of the servers in the cluster, or if I do it on one will that clear/empty/flush all of them?
If I do only need to do this on one server is there a master or preferred server? I don't see anything like a master/preferred server in the docs or web interface, so I am guessing any server will do.
If I only have to flush on 1 server do I need to restart them all, or just the one I flushed?
When I tested this, the server I flushed (I only had one at the time) stopped working until I restarted it.
Thanks for your help.
^C
So we tested this, you have to flush each machine with:
/opt/couchbase/bin/couchbase-cli bucket-flush -c 10.1.1.140:8091 --bucket=default
/opt/couchbase/bin/couchbase-cli bucket-flush -c 10.1.1.141:8091 --bucket=default
...
/opt/couchbase/bin/couchbase-cli bucket-flush -c 10.1.1.149:8091 --bucket=default
and then restart the service for the machine that is acting as the proxy (which we will be going away from moxi soon it has too many issues) with:
/etc/init.d/couchbase-server restart
So I wrote a little script that runs the flushes all from the proxy then restarts the couchbase server
You should only need to do this against one server. The bucket on the whole cluster will be flushed. By design, there is no master in the cluster. All nodes are like all other nodes.
You shouldn't need to restart that server either.
That said, we have had some issues related to flush, and bucket delete/recreate is more reliable, though also has some issues. These are being worked on.