Getting Started with Ruby
If you haven’t set up a Riak Node and started it, please visit Running A Cluster first. To try this flavor of Riak, a working installation of Ruby is required.
First, install the Riak Ruby client via RubyGems.
gem install riak-client
Start IRB, the Ruby REPL, and let’s get set up. Enter the following into IRB:
If you are using a single local Riak node, use the following to create a
new client instance, assuming that the node is running on
client = Riak::Client.new(:protocol => "pbc", :pb_port => 8087) # Since the Ruby Riak client uses the Protocol Buffers API by default, # you can also just enter this: client = Riak::Client.new(:pb_port => 8087)
If you set up a local Riak cluster using the [[five-minute install]] method, use this code snippet instead:
client = Riak::Client.new(:protocol => "pbc", :pb_port => 10017) # For the reasons explain in the snippet above, this will also work: client = Riak::Client.new(:pb_port => 10017)
We are now ready to start interacting with Riak.