Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hachreak/riak_core_demo
Riak Core Demo (KV store)
https://github.com/hachreak/riak_core_demo
demo demo-app distributed-systems erlang kvstore riak riak-core
Last synced: about 1 month ago
JSON representation
Riak Core Demo (KV store)
- Host: GitHub
- URL: https://github.com/hachreak/riak_core_demo
- Owner: hachreak
- License: other
- Created: 2017-04-26T17:28:31.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-28T20:23:20.000Z (almost 8 years ago)
- Last Synced: 2024-11-06T13:00:44.466Z (3 months ago)
- Topics: demo, demo-app, distributed-systems, erlang, kvstore, riak, riak-core
- Language: Erlang
- Homepage:
- Size: 19.5 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
riak_core_demo
==============This is a riak demo application following the elixir tutorials by
[Gpad](https://github.com/gpad/no_slides) and adapting them to erlang([Part 1](https://medium.com/@GPad/create-a-riak-core-application-in-elixir-part-1-41354c1f26c3),
[Part 2](https://medium.com/@GPad/create-a-riak-core-application-in-elixir-part-2-88bdec73f368),
[Part 3](https://medium.com/@GPad/create-a-riak-core-application-in-elixir-part-3-8bac36632be0),
[Part 4](https://medium.com/@GPad/create-a-riak-core-application-in-elixir-part-4-728512ece224))Build
-----$ rebar3 compile
Run demo
--------Start the first node:
```bash
rebar3 shell --name [email protected] --config config/vars_dev1.config
1> application:ensure_all_started(riak_core_demo).
```Start the second node:
```bash
rebar3 shell --name [email protected] --config config/vars_dev2.config
1> application:ensure_all_started(riak_core_demo).
```Join the two nodes together (run from the first node):
```erlang
2> riak_core:join('[email protected]').
```Ping
----Test the ping (you can run from both nodes):
```erlang
3> riak_core_demo:ping().
```You should see messages from console like:
`{pong, ....}`
and in one of the two nodes (it's pseudo random) a message like:
`[ping received] from ...`
Get/Put values in the store
---------------------------```erlang
riak_core_demo:put(a, 1).
riak_core_demo:put(b, 2).
...
riak_core_demo:get(a).
riak_core_demo:get(b).
```Handoff
-------After you insert many data in the store, just try to disconnect
the second node from the cluster:```erlang
riak_core:leave().
```In the console you should be able to see the different messages.
Automatically, all information stored in the second node will be transfered
to the first node.To reconnect again the second node, simply:
```erlang
application:ensure_all_started(riak_core_demo).
riak_core:join('[email protected]').
```Again, you will see the handoff of some process from the first node and
part of the data will be transfered to the second node.Coverage commands: keys() and values()
--------------------------------------After you insert many data in the store, try to get the list of keys stored in
all nodes or list of values:```erlang
riak_core_demo:keys().
riak_core_demo:values().
```Cluster status
--------------Show cluster status:
```erlang
riak_core_demo:status().
```