In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
This article is about the use of the curl command for etcd clusters. Xiao Bian thinks it is quite practical, so share it for everyone to make a reference. Let's follow the editor and have a look.
##Get etcd version number
curl -L http://127.0.0.1:2379/version
##Set a valuecurl of a key http://127.0.0.1:2379/v2/keys/message-XPUT -d value="Hello world"##Get a valuecurl of a key http://127.0.0.1:2379/v2/keys/message## Change a valuecurl of a key http://127.0.0.1:2379/v2/keys/message-XPUT-d value="Hello etcd"##Delete a key node curl http://127.0.0.1:2379/v2/keys/message-XPUT-d value="Hello etcd"##//127.0.0.1:2379/v2/keys/message-XDeleted ##Use ttl (i.e. set a key value and add a lifetime to the key, after which the value is automatically deleted if not accessed) curl http://127.0.0.1:2379/v2/keys/foo-XPUT -d value=bar -d ttl=5##Wait for a value change curl http://127.0.0.1:2379/v2/keys/foo? wait=true This command will block the process after being invoked until the value changes. When changing the value of a key or deleting an operation occurs, the wait will return. Special attention should be paid to the fact that in the case of a high degree of change, it is best to hand over the change result to another thread for processing. The monitoring thread immediately returns to continue monitoring the change situation. Of course, etcd also provides a command to obtain historical changes. This command is only a remedy for the case of missing listening events.## Create a directory curl http://127.0.0.1:2379/v2/keys/dir-XPUT -d dir=true##List a directory curl http://127.0.0.1:2379/v2/keys/dir## Recursively list a directory curl http://127.0.0.1:2379/v2/keys/dir? Recursive=true Here we can combine many of the above uses to achieve the function we want. For example, monitor all key changes in a directory, including subdirectories. You can use the command curl http://127.0.0.1:2379/v2/keys/dir? recurrent =true&wait=true##Delete a directory curl '127.0.0.1:2379/v2/keys/dir? dir=true' -XDELETE
About etcd cluster curl command usage to share here, hope the above content can have some help to everyone, can learn more knowledge. If you think the article is good, you can share it so that more people can see it.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.