gpt4 book ai didi

rest - 如何使用etcd v3 Restful api观看

转载 作者:行者123 更新时间:2023-12-01 17:54:57 34 4
gpt4 key购买 nike

我正在尝试使用 etcdv3 Restful api 观看 key ,如下 etcd/Documentation/dev-guide/api_grpc_gateway.md ,但似乎不太适合 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"}}

watch 不会有响应。

这是我的 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"

最佳答案

试试这个:

$ curl --no-buffer http://localhost:2379/v3beta/watch \
-X POST -d '{"create_request": {"key":"Zm9v"} }'

另请参阅这篇精彩文章:HTTP Streaming (or Chunked vs Store & Forward)

关于rest - 如何使用etcd v3 Restful api观看,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50245297/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com