Closed ericbrumfield closed 4 years ago
Hi Eric, thank you for the report! By chance is there a file called node-id
in the data directory used by Consul? Consul will always use the NodeID stored in the file, if the file exists. The disable-host-node-id
setting is only used when that file does not exist, and the config does not contain a NodeID.
We may need to improve the documentation to make this clear.
I fired up a fresh container just now in docker locally. There is a file under my specified data directory named node-id. This file contains a uuid of '627e0dc9-15ec-6712-106b-c5a19d7d4e1f', but in my test consul cluster it is appearing still as 'docker-desktop'
I'm not creating this file so it seems like consul is doing it at startup or something when the container starts up? Can I prevent the creation of it somehow?
These are the contents of my docker file I use to make the container:
FROM consul:1.8.2 AS base
WORKDIR /consul/config
COPY ./config/ .
This is my agent config:
{"datacenter": "aws-us-west-1",
"domain": "test.consul",
"client_addr": "0.0.0.0",
"enable_script_checks": false,
"disable_remote_exec": true,
"data_dir": "/consul/data",
"log_level": "TRACE",
"encrypt": "<redacted>",
"encrypt_verify_incoming": true,
"encrypt_verify_outgoing": true,
"leave_on_terminate": true,
"disable_host_node_id": true,
"acl": {
"enabled": true,
"default_policy": "deny",
"enable_token_persistence": true,
"down_policy": "extend-cache",
"tokens": {
"agent": "<redacted>"
}
},
"ca_file": "/consul/config/consul-agent-ca.pem",
"cert_file": "/consul/config/dc1-client-consul-registrator.pem",
"key_file": "/consul/config/dc1-client-consul-registrator-key.pem",
"auto_encrypt": {
"tls": true
},
"ports": {
"http": -1,
"https": 8501
}
I may be confusing node name with node id, apologies if I am. Should I expect this uuid to appear as the name of the node in the consul ui/dashboard?
Consul will write the NodeID to that file when it starts. If the file contains that UUID that seems like it is working correctly. Where are you seeing the hostname used as the NodeID?
In the nodes list in consul UI using a server node to view what's joining the cluster.
I think that is NodeName, which you can override from the config or CLI flag, but -disable-host-node-id
will not change the node name.
Thanks, sorry I confused the two.
Following the documentation and specifying -disable-host-node-id=true from cli as well as setting this in my agent config as "disable_host_node_id": true doesn't seem to be working as the consul documentation advertises.
I'm expecting that consul when supplied these parameters will generate a uuid as the name of the node, instead, it's giving me the host name as the name of the node.
I've tested this in 2 different hosting contexts, on my local machine docker (windows 10) as well as in ECS that uses host of amzn linux 2 ami, both results are similar. I am building the consul linux container from a windows 10 machine.
With disable_host_node_id to true, when I run locally the node is named 'docker-desktop'. In ECS it comes in as the host name of the backing ec2 instance i.e 'ip-10-80-5-61.us-west-1.compute.internal'. The setting seems to have no effect.