Delete all records from a riak database
Note: Applies to riak 1.2.1 installed on Ubuntu Server 12.04 LT (hosted in Amazon EC2)
The riak API allows to delete a bucket only if its content is empty. Sometimes (if you are performing various performance tests over the database, for example) the contained data is not important, so a script or program iterating through all the buckets and deleting all the content in a bucket is very time consuming.
A most convenient solution is to delete the directories holding the data on the riak server. In order to do this, follow the steps below:
1. Stop the riak server
sudo service riak stop
2. Change directory to the riak data
cd /var/lib/riak/bitcask
sudo rm -r *
cd /var/lib/riak/kv_nodes
sudo rm -r *
3. Restart riak service
sudo service riak start
After these steps, the database is empty and riak is up and running.
Note: Applies to riak 1.2.1 installed on Ubuntu Server 12.04 LT (hosted in Amazon EC2)
The riak API allows to delete a bucket only if its content is empty. Sometimes (if you are performing various performance tests over the database, for example) the contained data is not important, so a script or program iterating through all the buckets and deleting all the content in a bucket is very time consuming.
A most convenient solution is to delete the directories holding the data on the riak server. In order to do this, follow the steps below:
1. Stop the riak server
sudo service riak stop
2. Change directory to the riak data
cd /var/lib/riak/bitcask
sudo rm -r *
cd /var/lib/riak/kv_nodes
sudo rm -r *
3. Restart riak service
sudo service riak start
After these steps, the database is empty and riak is up and running.
No comments:
Post a Comment