从discovery.etcd.io中删除陈旧的CoreOS节点

我从CoreOS集群中删除了一个节点,并提出了一个新的节点。 不幸的是,它获得了与旧机器相同的IP。

这停止etcd发现群集的其余部分,在日记中这样的消息:“失败:join请求失败:对等地址已存在”

我如何从discovery.etcd.io中删除旧节点?

如果你知道机器ID,简短的回答

发送HTTP DELETE请求到https://discovery.etcd.io/<cluster-id>/<machine-id>

例如

 curl https://discovery.etcd.io/abcdef0123456789abcdef0123456789/7cf9a5cf5e3b4baea82e28618bffeaf5 -XDELETE 

较长的答案 – 如何find要删除的计算机ID

首先,从您的发现URL中获取JSON对象,例如

 https://discovery.etcd.io/abcdef0123456789abcdef0123456789 

它看起来有点像这样:

 { "action": "get", "node": { "key": "\/_etcd\/registry\/abcdef0123456789abcdef0123456789", "dir": true, "nodes": [ { "key": "\/_etcd\/registry\/abcdef0123456789abcdef0123456789\/6148dbb812a44dbe8773bebf329634e7", "value": "http:\/\/10.132.47.218:7001", "expiration": "2015-04-15T17:58:12.753046544Z", "ttl": 598570, "modifiedIndex": 453369429, "createdIndex": 453369429 }, { "key": "\/_etcd\/registry\/abcdef0123456789abcdef0123456789\/646fbdaee73544e6ac289894e935f0c7", "value": "http:\/\/10.132.47.218:7001", "expiration": "2015-04-15T18:30:03.08506867Z", "ttl": 600480, "modifiedIndex": 453418705, "createdIndex": 453418705 }, { "key": "\/_etcd\/registry\/abcdef0123456789abcdef0123456789\/05e0decf1d9240819382db7a7f8ff2e7", "value": "http:\/\/10.132.58.166:7001", "expiration": "2015-04-14T23:47:31.402148037Z", "ttl": 533129, "modifiedIndex": 451690943, "createdIndex": 451690943 }, { "key": "\/_etcd\/registry\/abcdef0123456789abcdef0123456789\/af2783b2327e4f3a9b6e7ea169814a06", "value": "http:\/\/10.132.58.167:7001", "expiration": "2015-04-14T23:47:38.676204353Z", "ttl": 533136, "modifiedIndex": 451691169, "createdIndex": 451691169 } ], "modifiedIndex": 426955695, "createdIndex": 426955695 } } 

假设我们的重用IP是10.132.47.218 – 我们要识别10.132.47.218相对应的机器ID。 我们可以从关键看到这是6148dbb812a44dbe8773bebf329634e7

现在我们可以简单地使用DELETE动词来删除它

 curl https://discovery.etcd.io/abcdef0123456789abcdef0123456789/7cf9a5cf5e3b4baea82e28618bffeaf5 -XDELETE