【consul】consul tnx update接口

2020-02-18  本文已影响0人  不务正业的coder

注: 若通过cas更新,必须携带正确的ModifyIndex,否则会报错。

1.请求http://consul.ali-bj-dev01.xx.net/v1/txn

[
    {
        "Check":{
            "Verb":"cas",
            "Check":{
                "Status":"passing",
                "CheckID":"service:abapp.apps01.dev.xx.net-80",
                "ServiceName":"abapp",
                "Node":"aws_cn-northwest-1_dev_01",
                "Definition":{
                    "Http":"http://abapp.apps01.dev.xx.net/abapp/home",
                    "Interval":"10s",
                    "DeregisterCriticalServiceAfter":"72h"
                },
                "ModifyIndex":56807,
                "Name":"service-abapp-abapp.apps01.dev.xx.net-80",
                "ServiceID":"abapp-abapp.apps01.dev.xx.ne-t80"
            }
        }
    }
]

2.响应

{
    "Results":[
        {
            "Check":{
                "Node":"aws_cn-northwest-1_dev_01",
                "CheckID":"service:abapp-abapp.apps01.dev.xx.net-80",
                "Name":"service:[abapp-abapp.apps01.dev.caijj.net](http://abapp-abapp.apps01.dev.caijj.net/)-80",
                "Status":"passing",
                "Notes":"",
                "Output":"",
                "ServiceID":"[abapp-abapp.apps01.dev.xx.net-80",
                "ServiceName":"abapp",
                "ServiceTags":[
                    "secure=false",
                    "contextPath=/abapp"
                ],
                "Definition":{
                    "Interval":"10s",
                    "DeregisterCriticalServiceAfter":"72h0m0s",
                    "HTTP":"http://abapp.apps01.dev.xx.net/abapp/home"
                },
                "CreateIndex":19852,
                "ModifyIndex":56807
            }
        }
    ],
    "Errors":null
}
上一篇下一篇

猜你喜欢

热点阅读