sabri

sabri

Hi,

I am building my channels based app, users will be sending their lat, long as messages each 1 second, I need to store all the messages, there could be hundred of thousands users sending their locations, the message size is less than 100 byte.

The question is, what is the recommended db to go with? As I will be storing all those messages in real time.. ? Each process (channel) will store the message once it’s received via Task.async

Please advice!

Showing Posts 16 to 7

gausby

gausby

No problem. We are all here to learn.

Perhaps Basho should have rebranded Riak TS as something different than “Riak.” They are based on the same technology, but you interface them differently and they are tuned to do different things.

sabri

sabri OP

I was confused as the ReadMe at timeseries branch needs to be updated, its currently uses put/2 , I am very new to Riak and Elixir too!

gausby

gausby

They are for Riak KV and cannot be used with Riak TS.

In the timeseries branch of the Elixir Riak Client there is a Timeseries module with a put/3 function: riak-elixir-client/lib/riak/timeseries.ex at timeseries · OpenRiak/riak-elixir-client · GitHub

sabri

sabri OP

Thanks, I will check Erlang examples, would the Riak.Object.create and Riak.put (GitHub - OpenRiak/riak-elixir-client: A Riak client written in Elixir. · GitHub) be sufficient to put data into Riak TS DB?

gausby

gausby

I suspect that you are confusing Riak KV (key-value) with Riak TS.

Please read through the usage documentation for Riak TS. Unfortunately there is not much Elixir information on this yet, but you can follow the Erlang examples and read through the Elixir Riak Client code. That’s what I do.

The Riak TS usage documentation can be found here: Using Riak TS

I might do a Riak TS integration with Ecto, as one uses SQL to interface with it, but I don’t have much time these days. If somebody else are up for the challenge it would be appreciated.

sabri

sabri OP

Thanks, I tried that branch, I’ve successfully connected to Riak TS cluster, but I could not do any query, can you please point me to simple example? I just need to put and get data.

Here is my implementation:

def store_to_riak do
  {:ok, pid} = Riak.Connection.start_link('192.168.99.100', 8098)
  IO.inspect pid
  o = Riak.Object.create(bucket: "user", key: "my_key", data: "Han Solo")
  IO.inspect o
  Riak.put(pid, o)
end

Here is the error I got:

iex(31)> iex(2)> App.LocationController.store_to_riak
iex(31)> #PID<0.390.0>
iex(31)> %Riak.Object{bucket: "user", content_type: 'application/json', data: "Han Solo",
 key: "my_key",
 metadata: {:dict, 1, 16, 16, 8, 80, 48,
  {[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []},
  {{[], [], [], [], [], [], [], [], [], [],
    [["content-type", 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47,
      106, 115, 111, 110]], [], [], [], [], []}}}, type: :undefined,
 vclock: :undefined}
iex(31)> ** (EXIT from #PID<0.354.0>) :disconnected
iex(31)>
iex(31)> Interactive Elixir (1.2.5) - press Ctrl+C to exit (type h() ENTER for help)
iex(31)> [error] GenServer #PID<0.390.0> terminating
** (stop) :disconnected
Last message: {:tcp_closed, #Port<0.13088>}
State: {:state, '192.168.99.100', 8098, false, false, :undefined, false, :gen_tcp, :undefined, {[], []}, 1, [], :infinity, :undefined, :undefined, :undefined, :undefined, [], 100}
sabri

sabri OP

Isn’t Riak TS the same that will be installed here: Riak Quick Start with Docker – Riak ?

gausby

gausby

I suggest using this client and branch for Riak TS.

sabri

sabri OP

Why picking timeseries release?

sabri

sabri OP

I have installed Riak via docker:

And I have installed Elixir Riak client:
https://github.com/drewkerrigan/riak-elixir-client

Connecting worked fine:
{:ok, pid} = Riak.Connection.start_link('192.168.99.100', 32774)

However, putting a user has failed, here is my code:

def store_to_riak do
  {:ok, pid} = Riak.Connection.start_link('192.168.99.100', 32774)
  IO.inspect pid
  o = Riak.Object.create(bucket: "user", key: "my_key", data: "Han Solo")
  IO.inspect o
  Riak.put(pid, o)
end

The result:

iex(1)> App.LocationController.store_to_riak
#PID<0.314.0>
%Riak.Object{bucket: "user", content_type: 'application/json', data: "Han Solo",
 key: "my_key",
 metadata: {:dict, 1, 16, 16, 8, 80, 48,
  {[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []},
  {{[], [], [], [], [], [], [], [], [], [],
    [["content-type", 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47,
      106, 115, 111, 110]], [], [], [], [], []}}}, type: :undefined,
 vclock: :undefined}
nil
** (EXIT from #PID<0.312.0>) :disconnected

Interactive Elixir (1.2.5) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> [error] GenServer #PID<0.314.0> terminating
** (stop) :disconnected
Last message: {:tcp_closed, #Port<0.12186>}
State: {:state, '192.168.99.100', 32774, false, false, :undefined, false, :gen_tcp, :undefined, {[], []}, 1, [], :infinity, :undefined, :undefined, :undefined, :undefined, [], 100}

But, sense I am new to Riak, I don’t know how to handle such errors, if you can help that would be great

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
ryanwinchester
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted” Version...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews