jsonserializationbackupriak

How to deserialize a Riak backup into a JSON?


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.


Solution

  • 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"