Based on the file below, in what directory would you place the consul.hcl configuration file in order to start the Consul service?

Based on the file below, in what directory would you place the consul.hcl configuration file in order to start the Consul service?

A . /usr/local/bin
B. /opt/services/consul
C. /etc/consul.d/
D. /etc/systemd/system/

Answer: C

Explanation:

Based on the executable statement in the service file, all .hcl configuration files for Consul would be placed in /etc/consul.d/ . You can break up your desired Consul configurations across multiple .hcl files if you wish. It’s common to put the actual Consul configuration in a consul.hcl file while putting node_meta data into a node_meta.hcl file, therefore both will be read upon starting or refreshing the Consul service. This is because the executable statement in the service file is using -config-dir rather than pointing to a single file using -config-file.

ExecStart=/usr/local/bin/consul agent -config-dir=/etc/consul.d/

For more information about the configuration file and the -config-file and -config-dir can be found here.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments