5. (riak-dev-cluster) rake bootstrap (riak-dev-cluster) rake
member_status ---- Cluster Status ---- Ring ready: true 5 Starting
the riak-dev-cluster for a local dev environment
6. 6 Starting the Riak.app for a local dev environment
7. 7 Starting the Riak.app getting search going right away
https://github.com/mjbrender/riak- app-enable-search
8. Its not about NoSQL 8
9. What we really need.. 9
10. is a database that allows my app to scale 10
11. Enter Riak 11
12. Using Riak the art of key/value 12
13. Keys simply binary values used to identify Objects.* Values
can be numbers, strings, objects, binaries, etc. Buckets used to
define a virtual namespace for storing Riak objects. Data Model
Riak stores data as a combination of keys and values in buckets
13
14. curl
http://127.0.0.1:8098/types/places/buckets/country/keys/US {
"Alpha2_s": "US, "Alpha3_s": "USA, "EnglishName_s": "United States,
"NumericCode_i": 840 } Riak offers both HTTP and Protocol Buffers
APIs. The following HTTP API example uses curl to retrieve a value
by key: Note: Protocol buffers are Google's language-neutral,
platform-neutral, extensible mechanism for serializing structured
data think XML, but smaller, faster, and simpler. Data Model
14
15. There are a diverse group of client libraries for Riak that
support both the HTTP and Protocol Buffer APIs: Basho Supported
Libraries: Java Ruby Python PHP Erlang .NET Node.js Community
Libraries: C Clojure Go Perl Scala R Polylingual
16. export RIAK_HOST=http://localhost:8098 curl -v
$RIAK_HOST/buckets/capitals/keys/usa-X PUT-H "content-type:
text/plain-d "Washington D.C. * Trying 127.0.0.1... connected >
PUT /buckets/capitals/keys/usa HTTP/1.1 > Content-Type:
text/plain > < HTTP/1.1 204 No Content 16 Storing data
Through HTTP
17. curl $RIAK_HOST/buckets/capitals/keys/usa Washington D.C.
17 Retrieving data Through HTTP
18. curl -v $RIAK_HOST/buckets/capitals/keys/usa Trying
127.0.0.1... Connected > GET /buckets/capitals/keys/usa HTTP/1.1
< HTTP/1.1 200 OK < X-Riak-Vclock:
a85hYGBgzGDKBVIcR4M2cvvL1tzJYEpkzGNluGw/+QRfFgA= < Vary:
Accept-Encoding < Server: MochiWeb/1.1 WebMachine/1.9.0 (someone
had painted it blue) < Link: /capitals>; rel="up" <
Last-Modified: Tue, 26 May 2015 14:44:35 GMT < ETag:
"1yAFlUinalK2zNd7LpkOgU Washington D.C. 18 Retrieving data Through
HTTP (extended)
19. gem install riak-client Successfully installed
riak-client-2.1.0 1 gem installed 19
https://github.com/basho/riak-ruby-client A Simple Ruby App
Starting with the client
20. >> require 'riak' => true >> client =
Riak::Client.new(:pb_port => 8087) => #]> >>
client.ping => true 20 A Simple Ruby App That stores and
retrieves data
21. >> default_bucket = client.bucket("default") => #
>> value = default_bucket.new("Monty Python") => #]>
>> value.data = ["Graham Chapman", "Eric Idle", "Terry
Gilliam", "Terry Jones", "John Cleese", "Michael Palin] >>
value.store() => #]> 21 A Simple Ruby App That stores and
retrieves data
22. >> fetched = default_bucket.get("Monty Python") =>
#]> >> fetched.data.to_json => "["Graham Chapman","Eric
Idle","Terry Gilliam","Terry Jones","John Cleese","Michael Palin"]"
22 A Simple Ruby App That stores and retrieves data
23. Searching in Riak
24. riak-2.1.0 cat etc/riak.conf | grep -i search ## this to be
set to 'active', including search. ## To enable Search set this
'on'. search = on 24 Solr will index any field that it recognizes,
based on the index's schema. The default schema (_yz_default) uses
the suffix to decide the field type (_s represents a string, _i is
an integer, _b is binary and so on). A Simple Search Enabling
search in Riak
26. Riak stores data as a combination of keys and values in
buckets A SIMPLE SEARCH Key Value Bucket ruby { "name_s" : "Ruby
Client", "maintainer_s" : Basho", "popular_b" : true }
coding-with-riak go { "name_s" : "Go Client", "popular_b" : true,
"maintainer_s" : Community" } coding-with-riak 26 A Simple Search
Using Apache Solr