Closed Dorfeuheinz closed 9 months ago
Hi @Dorfeuheinz, would you share your code? Maybe knowing it would help to better address the problem.
But most users would consider the README enough information to use it. Are you following it or are you doing something different?
Hi @Dorfeuheinz, would you share your code? Maybe knowing it would help to better address the problem.
I just followed the docs. created a new elixir project using mix new. Then added the deps as per the docs. & then after mix deps.get
& iex -S mix
, in the console I typed- EtcdEx.start_link(name: MyApp.Etcd)
but it just throws this error everytime- {:error, %Mint.HTTPError{reason: :closed, module: Mint.HTTP2}}
Ive even tried doing Mint.HTTP2.connect(:http, "localhost", 2379) & retry the above operation but the results are the same.
But most users would consider the README enough information to use it. Are you following it or are you doing something different?
Up until now ive followed everything exactly as mentioned. Nothing more nor less
I think it may be a problem how the etcd is started. I could reproduce the error when I just started the etcd locally without any command line arguments.
But once I started like this, it worked:
$ docker run -p 2379:2379 --rm quay.io/coreos/etcd \
etcd \
-advertise-client-urls http://127.0.0.1:2379 \
-listen-client-urls http://0.0.0.0:2379 \
-initial-cluster-state new
iex(1)> EtcdEx.start_link(name: :etcd)
{:ok, #PID<0.233.0>}
iex(2)> EtcdEx.put(:etcd, "foo", "bar")
{:ok,
%{
header: %{
cluster_id: 14841639068965178418,
member_id: 10276657743932975437,
raft_term: 2,
revision: 2
},
prev_kv: nil
}}
iex(3)> EtcdEx.get(:etcd, "foo")
{:ok,
%{
count: 1,
header: %{
cluster_id: 14841639068965178418,
member_id: 10276657743932975437,
raft_term: 2,
revision: 2
},
kvs: [
%{
create_revision: 2,
key: "foo",
lease: 0,
mod_revision: 2,
value: "bar",
version: 1
}
],
more: false
}}
I think it may be a problem how the etcd is started. I could reproduce the error when I just started the etcd locally without any command line arguments.
But once I started like this, it worked:
$ docker run -p 2379:2379 --rm quay.io/coreos/etcd \ etcd \ -advertise-client-urls http://127.0.0.1:2379 \ -listen-client-urls http://0.0.0.0:2379 \ -initial-cluster-state new
iex(1)> EtcdEx.start_link(name: :etcd) {:ok, #PID<0.233.0>} iex(2)> EtcdEx.put(:etcd, "foo", "bar") {:ok, %{ header: %{ cluster_id: 14841639068965178418, member_id: 10276657743932975437, raft_term: 2, revision: 2 }, prev_kv: nil }} iex(3)> EtcdEx.get(:etcd, "foo") {:ok, %{ count: 1, header: %{ cluster_id: 14841639068965178418, member_id: 10276657743932975437, raft_term: 2, revision: 2 }, kvs: [ %{ create_revision: 2, key: "foo", lease: 0, mod_revision: 2, value: "bar", version: 1 } ], more: false }}
oh yes, thanks so much. This does seem to work. I just had a chatgpt generated simple docker-compose & it just didnt work. This helps. Thanks a lot. Appreciate it
I just had a chatgpt generated simple docker-compose & it just didnt work.
Oh my... Not a surprise...
The documentation is a little unclear on the steps to create a connection & start etcd. Id be highly obliged if you could iterate on the exact steps to start the client. Ive got etcd listening on port 2379. & after following through the docs im getting this error everytime-
{:error, %Mint.HTTPError{reason: :closed, module: Mint.HTTP2}}
I cant reason about my way through this. Any help will be appreciated. Thankyou