i am trying to watch key with etcdv3 restful api,following etcd/Documentation/dev-guide/api_grpc_gateway.md,but it seems not work well with watch.
curl http://localhost:2379/v3beta/watch \
-X POST -d '{"create_request": {"key":"Zm9v"} }'
curl http://localhost:2379/v3beta/watch \
-X POST -d '{"create_request": {"key":"Zm9v"} }'
#{"header":{"cluster_id":"7016043442779247867","member_id":"5993310732371594633","revision":"2","raft_term":"2"}}
the watch will not have a response.
this is my docker-compose.yml:
version: "3"
services:
etcd:
image: quay.io/coreos/etcd:latest
command: >
/usr/local/bin/etcd
--name node1
--initial-advertise-peer-urls http://${HOST}:2380
--listen-peer-urls http://0.0.0.0:2380
--advertise-client-urls http://${HOST}:2379
--listen-client-urls http://0.0.0.0:2379
--initial-cluster node1=http://${HOST}:2380
--debug
expose:
- 2379
- 2380
ports:
- "2379:2379"
- "3380:2380"
Try this instead:
$ curl --no-buffer http://localhost:2379/v3beta/watch \
-X POST -d '{"create_request": {"key":"Zm9v"} }'
Also refer to this awesome article: HTTP Streaming (or Chunked vs Store & Forward)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With