Register a Service with Consul Service Discovery Flashcards

1
Q

One of the major use cases for Consul is service discovery. Consul provides a _ that downstream services can use to _ of their upstream dependencies.

A

DNS interface

find the IP addresses

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Consul knows where these services are located because _.

A

each service registers with its local Consul client

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

You can register services either _, which is the most common way to register services, or by making _.

A

by providing a service definition

a call to the HTTP API

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Consul loads all configuration files in the _, so a common convention on Unix systems is to name the directory something like

A

configuration directory

/etc/consul.d

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Consul can register services that _. It correlates each running service with its registration based on the service’s port.

A

aren’t running yet

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

If you wanted to register multiple services, you could create multiple _ in the Consul _.

A

service definition files

configuration directory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Once the agent adds the service to Consul’s service catalog you can query it using either the _ or _.

A

DNS interface

HTTP API

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

The DNS name for a service registered with Consul is _ , whereNAMEis _

A

NAME.service.consul

the name you used to register the service

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

The fully-qualified domain name of the web service isweb.service.consul. Query the DNS interface (which Consul runs by default on port8600) for the registered service.

A

dig @127.0.0.1 -p 8600 web.service.consul

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Filter your HTTP API query to look for only healthy instances.

A

curl ‘http://localhost:8500/v1/health/service/web?passing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

You can update service definitions without any downtime by changing _ and sending a_to the agent or running_.

A

the service definition file
SIGHUP
consul reload

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

The ‘check’ stanza of this service definition adds a _ that tries to _ every _.

A

script-based health check
connect to the web service
10 seconds via curl

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

If the command exits with an exit code >= 2, then the check will _. An exit code of 1 will be considered as _

A

fail and Consul will consider the service unhealthy

warning state.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Now reload Consul’s configuration to make it aware of the new health check.

A

consul reload

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Consul’s DNS server only returns _

A

healthy results.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly