hashicorp / hashicorp/consul

consul node can't be deregister

Open
#22,071 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
30.1k
Forks
4.6k
Avg merge
2d 6h
Merged PRs (30d)
43

Description

Consul version: Consul v1.9.0
Consul Cluster Node Total: 2w+
Consul Server Total: 5

8.219.x.x This node is unhealthy on Consul console, and this machine has not been deleted by Consul for several days, then I plan to call consul api to delete it. But the curl command keeps sticking (calling other consul server nodes for deregister operations doesn't stick)

![Image](https://github.com/user-attachments/assets/b35a0d43-4eee-42fc-bc6b-165ee583be83)

deregister command
`curl --header X-Consul-Token:2a825e81-b249-433d-a22e-xxxxx --request PUT http://172.31.x.x:8500/v1/agent/service/deregister/tpn,tpn_adx_micro,fk_tpn_adx_micro,8.209.x.x,heartbeat`

The node 8.219.x.x is currently registered on the node 172.31.x.x , i login the node 172.31.x.x and use grep command to view some data of 8.219.x.x, and find that 8.219.x.x displays "passing" in consul data, Is this a Bug?

![Image](https://github.com/user-attachments/assets/45b5e9ab-eccc-451b-990a-f14c66e47191)

use this code to register to consul cluster

```
func register(agentConfig config.Config) error {
consulId := fmt.Sprintf("%s,%s,%s,%s,heartbeat", agentConfig.Tagteam, agentConfig.Taggroup, agentConfig.Tagname, agentConfig.PublicIP)
registration := new(consulapi.AgentServiceRegistration)
registration.Name = "hawkeye"
registration.ID = consulId
registration.Port = agentConfig.Port
registration.Address = agentConfig.PublicIP
registration.Tags = []string{consulId}
registration.Meta = map[string]string{
"public_ip": agentConfig.PublicIP,
"tagteam": agentConfig.Tagteam,
"taggroup": agentConfig.Taggroup,
"tagname": agentConfig.Tagname,
}
registration.Check = &consulapi.AgentServiceCheck{
HTTP: fmt.Sprintf("http://%s:%d/heartbeat/%s_%s_%s", registration.Address, agentConfig.Port, agentConfig.Tagteam, agentConfig.Taggroup, agentConfig.Tagname),
Timeout: "10s",
Interval: "20s",
DeregisterCriticalServiceAfter: "10s",
Status: "passing",
}
return consul_client.Agent().ServiceRegister(registration)
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.