whatyouhide/xandra

Connection refused on execute

Closed this issue · 3 comments

Hi,
I am a bit new to elixir and I am trying to integrate xandra to connect to a remote cassandra setup. I have kept my start_link options extremely basic by just passing the host and port specifications
{:ok, pid} = Xandra.start_link(host: config.dbhost, port: config.dbport, )
According to my tests this runs fine. However the issue that I am having is when I try to run the execute command,

query = "select * FROM geo_location;"
result = Xandra.execute(conn, query, _params = [])

I get the following error (conn being the pid but i've also tried using an atom specified via :name in start_link )

10:05:32.987 [error] Xandra.Connection (#PID<0.205.0>) failed to connect: ** (Xandra.ConnectionError) action "TCP connect" failed with reason: connection refused`

This probably indicates that there is an issue with the setup however when i try to connect to the same host/port via cqlsh it works fine and I can run the same query that I am using in the Xandra.execute function.

Any help would be appreciated as I am at a loss as to what the issue could be

Hi @peterRd,

I'm sorry, it was an incorrect example in the README file (fixed in e8376f2).

You need to use the :nodes option instead of :host and :port combination:

Xandra.start_link(nodes: ["127.0.0.1:9042"])

Thanks

Hi, I am a bit new to elixir and I am trying to integrate xandra to connect to a remote cassandra setup. I have kept my start_link options extremely basic by just passing the host and port specifications {:ok, pid} = Xandra.start_link(host: config.dbhost, port: config.dbport, ) According to my tests this runs fine. However the issue that I am having is when I try to run the execute command,

query = "select * FROM geo_location;"
result = Xandra.execute(conn, query, _params = [])

I get the following error (conn being the pid but i've also tried using an atom specified via :name in start_link )

10:05:32.987 [error] Xandra.Connection (#PID<0.205.0>) failed to connect: ** (Xandra.ConnectionError) action "TCP connect" failed with reason: connection refused`

This probably indicates that there is an issue with the setup however when i try to connect to the same host/port via cqlsh it works fine and I can run the same query that I am using in the Xandra.execute function.

Any help would be appreciated as I am at a loss as to what the issue could be

Hello Im a bit new to elixir mself, an even Im trying to do the same thing could you please share the github repo of a project where you have used Cassanadra as a db in ecto, Im finding it really hard trying to figure out the file structure of an app with a nosql db in elixir. I would be highly grateful