User Tools

Site Tools


Sidebar

software:riak

Riak

Riak-CS

Setup an S3 clone with Debian

This guide is tested on Debian Wheezy with Riak 1.4.4 in my (virtualized) servers

  • All riak components should be installed on the same machine (riak, riak-cs, riak-cs-control, stanchion)
  • Web application should be on a different machine or you have to use riak ip and port as proxy
  • Development outside the network is possibile but using the proxy as above
                                                            192.168.30.2
                                                           +---------------------------------+
                                                           |                                 |
                                                +--------->|     Web server                  |
                                                |          |                                 |
                                                |          +---------------------------------+
                                                |
                                                |           192.168.30.3
                                                |          +---------------------------------+
                                                |          |                                 |
                                                +--------->|     Web application 1           |
               1.1.1.1        192.168.30.1      |          |                                 |
                  +-------------------+         |          +---------------------------------+
                  |                   |         |
 Internet +------>|    Firewall       +-------->+           192.168.30.4
                  |                   |         |          +---------------------------------+
                  +-------------------+         |          |                                 |
                                                +--------->|     Web application 2           |
                                                |          |                                 |
                                                |          +---------------------------------+
                                                |
                                                |           192.168.30.5
                                                |          +---------------------------------+
                                                |          |                                 |
                                                +--------->|     Riak-CS S3 Clone            |
                                                           |                                 |
                                                           +---------------------------------+

In progress…

Riak-CS S3 Clone

  1. Add basho key
    # curl http://apt.basho.com/gpg/basho.apt.key | apt-key add -
  2. Add basho repository
    echo deb http://apt.basho.com $(lsb_release -sc) main > /etc/apt/sources.list
  3. Install all riak components
    # apt-get install riak riak-cs stanchion riak-cs-control
  4. Change riak backend to use riak-cs
    # nano /etc/riak/app.config
    in riak_kv section comment (place two '%' at line start) the following line:
    
    {storage_backend, riak_kv_bitcask_backend},
    
    and replace it with:
    
    {add_paths, ["/usr/lib/riak-cs/lib/riak_cs-1.4.4/ebin"]},
    {storage_backend, riak_cs_kv_multi_backend},
    {multi_backend_prefix_list, [{<<"0b:">>, be_blocks}]},
    {multi_backend_default, be_default},
    {multi_backend, [
      {be_default, riak_kv_eleveldb_backend, [
        {max_open_files, 50},
          {data_root, "/var/lib/riak/leveldb"}
      ]},
        {be_blocks, riak_kv_bitcask_backend, [
          {data_root, "/var/lib/riak/bitcask"}
      ]}
    ]},
    in riak_core section add:
    
    {default_bucket_props, [{allow_mult, true}]},
  5. Increase riak capacity
    /etc/riak/vm.args
    ## This setting is not present in default Riak installations, so
    ## it should be added.  In some cases, a value of 128000 may be
    ## appropriate.
    +zdbbl 96000
  6. Temporary enable admin user creation
    # nano /etc/riak-cs/ap.config
    change {anonymous_user_creation, false} in {anonymous_user_creation, true}
  7. Start riak, riak-cs and stanchion
    riak start && riak-cs start && stanchion start && riak-cs-control start
  8. Create an admin user
    curl -H 'Content-Type: application/json' \
      -X POST http://localhost:8080/riak-cs/user \
      --data '{"email":"sysadmin@example.com", "name":"admin user"}'
    
    Take a note with the response!
  9. Stop riak&co.
    riak-cs-control stop ; stanchion stop ; riak-cs stop ; riak stop
  10. Set riak-cs network ip
    # nano /etc/riak-cs/app.config
    Change riak_ip value from localhost to your riak machine lan ip
  11. admin-key and admin-secrets in riak-cs and stanchion
  12. set cs_root_host
  13. script
  14. ulimit

Web server

  1. install nginx
  2. configure nginx server

Firewall

  1. redirect rule
software/riak.txt · Last modified: 2014/02/05 18:45 by Michele Porelli