Closed jaypipes closed 7 years ago
@jaypipes the v3 API differs from v2.
Here is the example how to use it:
curl -X POST -d '{"key": "L2FwcA==", "range_end": "L2I="}' http://localhost:2379/v3alpha/kv/range
The main difficulty - keys and values are base64-encoded, so it's not convenient to use it in real life. Better to use etcdctl directly.
Hey, thanks @mwf, that's exactly the information I needed. :)
BTW, is that documented anywhere? I couldn't find any docs, but I know it's alpha so not expecting anything. I can contribute some docs if folks would like?
Just https://coreos.com/etcd/docs/latest/dev-guide/api_reference_v3.html and that's all, I believe.
OK, thanks again, @mwf, really appreciate the assist :)
@mwf @jaypipes there's documentation on the grpc gateway at https://github.com/coreos/etcd/blob/master/Documentation/dev-guide/api_grpc_gateway.md
@mwf Hi, Now I have a problem that I want to get all keys by rest api(etcd v3).But no solution.Can you do me a favor?Thanks.
Hi @tantjp
curl -X POST -d '{"key": "AA==", "range_end": "AA=="}' http://localhost:2379/v3beta/kv/range
As posted here https://github.com/coreos/etcd/blob/v3.3.9/etcdserver/etcdserverpb/rpc.proto#L379
If both key and range_end are '0', then the range request returns all keys.
So, first we should encode '\0'-byte to base64:
$ printf '\0' | base64
AA==
And use the base64 value in the curl call.
@mwf it works, thanks.
@mwf @jaypipes there's documentation on the grpc gateway at https://github.com/coreos/etcd/blob/master/Documentation/dev-guide/api_grpc_gateway.md
This documentation says it will work with v3
and not with v3alpha
or v3beta
, however on the latest etcd version it does not work with v3
:
$ curl -L http://192.168.121.20:31379/v3beta/kv/put -X POST -d '{"key": "Zm9v", "value": "YmFy"}'
{"header":{"cluster_id":"14841639068965178418","member_id":"10276657743932975437","revision":"354","raft_term":"2"}}%
$ curl -L http://192.168.121.20:31379/v3/kv/put -X POST -d '{"key": "Zm9v", "value": "YmFy"}'
404 page not found
$ curl -L http://192.168.121.20:31379/version
{"etcdserver":"3.3.8","etcdcluster":"3.3.0"}
Docs clearly state
/v3 will be available in 3.4+
On Thu, May 30, 2019 at 5:46 AM gunix notifications@github.com wrote:
@mwf https://github.com/mwf @jaypipes https://github.com/jaypipes there's documentation on the grpc gateway at https://github.com/coreos/etcd/blob/master/Documentation/dev-guide/api_grpc_gateway.md
This documentation says it will work with v3 and not with v3alpha or v3beta, however on the latest etcd version it does not work with v3:
$ curl -L http://192.168.121.20:31379/v3beta/kv/put -X POST -d '{"key": "Zm9v", "value": "YmFy"}'
{"header":{"cluster_id":"14841639068965178418","member_id":"10276657743932975437","revision":"354","raft_term":"2"}}%
$ curl -L http://192.168.121.20:31379/v3/kv/put -X POST -d '{"key": "Zm9v", "value": "YmFy"}'
404 page not found
$ curl -L http://192.168.121.20:31379/version
{"etcdserver":"3.3.8","etcdcluster":"3.3.0"}
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/etcd-io/etcd/issues/7484?email_source=notifications&email_token=AAJRDVOLEDXSC5DNL6QBXZTPX6PAVA5CNFSM4DDKTLEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWR4LUY#issuecomment-497272275, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJRDVMCEYWKK5A4FTSFXNDPX6PAVANCNFSM4DDKTLEA .
-- —
Hi May i know how to store local files in etcd using the curl command?
I have a rkt container image running etcd 3.0.6:
As you can see above, there are no keys in the store.
I'm trying to use the
python-etcd3
library to create and set keys in the etcd3 server, and then double-check my code by using curl within my functional tests. When I usepython-etcd3
to create a key, things seem to work fine:However, when I curl to get the key I just added, they aren't found:
I've tried looking in the
/v3alpha
and/v3
key spaces, but nothing:Am I missing something? Is there a proxy of some sort that needs to be running somewhere? Any help would be most appreciated. Thanks in advance!
-jay