The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Playtime: Riak, Azure, F#

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Christian Horsdal

Posts: 253
Nickname: horsdal
Registered: Mar, 2009

Christian Horsdal is a software architect at MjĂžlner Informatics.
Playtime: Riak, Azure, F# Posted: Sep 8, 2013 4:19 PM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Christian Horsdal.
Original Post: Playtime: Riak, Azure, F#
Feed Title: Horsdal
Feed URL: http://www.horsdal-consult.dk/feeds/posts/default
Feed Description: A blog that will be about code, architecture, design, and .NET.
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Christian Horsdal
Latest Posts From Horsdal

Advertisement
Sifting through the programme for this years GOTO conference one of the talks I thought I'd go see was the one on Riak in the big data track. This is not a new topic at GOTO. In fact I've seen several really good Riaks talks there (like the Riak on mobiles one, that has also been at GOTO). Each time I've gone out of the talk thinking "I've gotta play around with Riak! It's cool." This time around I thought I'd start the playing around beforehand, with the added benefit that I have a bit more context coming into this years Riak talk.

What follows is a short account of my Hello World level experiences of getting Riak up and running on Azure and talking to it from a bit of F# sharp code.

Riak on Azure
As someone who works mostly on Windows the first thing I ran into with Riak is that there is no Windows option on the downloads page - it's different Unix flavors all the way through. Not worry though, in the cloud age spinning up a new Unix box is easy. As it turns out getting Riak on there is pretty easy too (just a few curl commands and that's it): I just followed the step-by-step guide to running Riak on Azure. The guide is little bit out of date with regards to the screenshots from Azure, but nothing that will trip you. The stumbling block was the very last curl command in the guide which is

curl -s http://rekon.basho.com | sh

but http://rekon.basho.com just gives you a redirect to a page on github. It's not a hard stumbling block though; you just follow the redirect and put in this command instead:

curl -s https://raw.github.com/basho/rekon/master/download.sh | sh

At this point I had a VM in Azure running Riak. I was able to put data into it and read it again through Riaks HTTP API simply using more curl commands.

Talking to Riak with F#
The basics of Riaks HTTP API are pretty easy - HTTP PUT to create a new key-value pair in a bucket, HTTP PUT to modify existing values, and HTTP GET to read them - but even doing that with curl gets a bit cumbersome pretty quickly. So here is how to talk to Riak with F# code using xUnit as an execution container.

First, checking the Riak cluster is even reachable can be done by pinging it like this:


Moving on to adding a key-value pair and implicitly creating a bucket too looks like this:


Finally reading data out again looks like this:


And that's it for getting data in and out of Riak from F# code.

Read: Playtime: Riak, Azure, F#

Topic: Windows Store Apps Showdown - C# vs JavaScript Previous Topic   Next Topic Topic: Win8 Apps with Windows Azure Mobile Services

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use