V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
gramyang

consul 的一个小问题

  •  
  •   gramyang · Jun 29, 2019 · 3357 views
    This topic created in 2502 days ago, the information mentioned may be changed or developed.

    最近在看 consul,奈何资料较少,一个问题迟迟找不到答案:

    consul 的-data-dir 的定义是:保存 agent 的状态。

    这个状态是什么??我能不能理解就是把 consul 里面的 KV Pair 里的值本地化?本地化的格式是什么?是 json 文件吗?

    5 replies    2019-06-29 15:04:43 +08:00
    xuxu555
        1
    xuxu555  
       Jun 29, 2019 via Android
    已经注册了的服务的信息(ip 端口)?? 我猜的
    mondeo
        2
    mondeo  
       Jun 29, 2019 via Android
    consul 上注册的服务和节点信息,具体格式直接看源代码吧
    joysir
        3
    joysir  
       Jun 29, 2019
    > (What is Consul?)[https://www.consul.io/intro/index.html]

    Consul 是一个集服务发现、健康检测、KV、Sidecar 为一体的平台。

    所以,Consul 的状态信息包含以上所有:
    1. 节点信息
    2. 服务信息
    3. KV 信息
    4. Connect 信息
    5. 其他运行时数据

    关于 KV 信息的存储,文档中有说明

    > The datastore itself is located on the Consul servers in the data directory. To ensure data is not lost in the event of a complete outage, use the consul snapshot feature to backup the data.


    状态存储文件不是直接可读的,可以从 $data-dir/raft/snapshots/xxxxxxx/state.bin 中查看,一般在尾部可以看见你 KV 的信息。
    gramyang
        4
    gramyang  
    OP
       Jun 29, 2019
    很详细的解答了我的疑问,感谢老铁!
    gramyang
        5
    gramyang  
    OP
       Jun 29, 2019
    @joysir 忘记 @了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   910 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 18:37 · PVG 02:37 · LAX 11:37 · JFK 14:37
    ♥ Do have faith in what you're doing.