How to deserialize a Riak backup into a JSON?

319 views Asked by At

I have just dumped a riak db (back-up). But the backup file is a binary file. Is there a lib that it deserialize it into a human readable file (JSON w/e) ?

I haven't found anything on google, neither on Stack Overflow.

2

There are 2 answers

0
Xavier S. On BEST ANSWER

Found a solution for my current problem:

Connect to the env and then run following command:

  wget https://s3-us-west-2.amazonaws.com/ps-tools/riak-data-migrator-0.2.9-bin.tar.gz
  tar -xvzf riak-data-migrator-0.2.9-bin.tar.gz
  cd riak-data-migrator-0.2.9
  java -jar riak-data-migrator-0.2.9.jar -d -r /var/riak_export -a -h 127.0.0.1 -p 8087 -H 8098

(source: https://github.com/basho-labs/riak-data-migrator)

EDIT Another way to export riak db https://www.npmjs.com/package/riak-bucket-exporter

  #!/bin/bash

  for bucket in $(curl http://localhost:8098/riak?buckets=true | sed -e 's/[{}:"]//gi' -e 's/buckets\[//' -e 's/\]//' -e 's/,/ /g')
  do
    echo "Exporting bucket $bucket"
    rm -f $bucket.json
    riak-bucket-exporter -H localhost -p 8098 $bucket
  done

  echo "Export done"
0
cueedee On

As all the suggestions listed so far appear to be broken in one way or another (at least for me and [email protected]), I ultimately resorted to homegrow a bash shell script that leverages riak-kv's HTTP API with no other prerequisites than curl and jq to accomplish an export of sorts.

It can be found in this gist here: https://gist.github.com/cueedee/0b26ec746c4ef578cd98e93c93d2b6e8 hoping that someone will find it useful.