3

How can I back up and restore data from a Riak cluster? What commands do I need to run?

Nathan Long
  • 1,515
  • 7
  • 22
  • 38

1 Answers1

4

First, on each machine, you need to know a valid node name and the Erlang cookie value.

You can find out what nodes you have by running riak-admin status | grep 'nodename'

You can find the cookie name in vm.args. For me, this file was located in /usr/local/riak/etc/. There should be a line like "-setcookie foo`. The default value is 'riak'.

On the machine where you want to do the backup, run (from the docs):

sudo riak-admin backup <node> <cookie> <filename> [[node|all]]

For example:

sudo riak-admin backup rk1@192.168.10.201 MyCookieVal /home/me/riak-backup-01-11-2012.dat all

(The .dat file extension is arbitrary.)

Note that you can run this command remotely if the machine you're running it from has riak-admin available.

On the machine where you want to do the restore, run (from the docs):

riak-admin restore <node> <cookie> <filename>

For example:

riak-admin restore riak@127.0.0.1 MyCookieVal ~/riak-production-backup-01-11-2012.dat
Nathan Long
  • 1,515
  • 7
  • 22
  • 38
  • Just a note on file permissions, check this thread too http://lists.basho.com/pipermail/riak-users_lists.basho.com/2010-May/001162.html ! – georgepsarakis Sep 20 '13 at 12:44
  • Just a note from 2021 - `riak-admin backup` is deprecated in new Riak KV versions and won't work anymore, thus Riak remains with NO valid backup method. – Vesper Nov 11 '21 at 08:35