Consul allows you to configure the ports for your agents so they don't conflict on a single host. I was able to do so in a file named:
consul.json
With contents:
{
"ports": {
"dns": 9600,
"http":9500,
"serf_lan":9301,
"serf_wan": 9401,
"server":9300,
"grpc":9502
}
}
I then started the agent with the following command:
consul agent -dev -bind 127.0.0.1 --config-file consul.json
I then had two agents on the same machine seen via command line tool ps x
(output abbreviated):
7510 ... consul agent -dev -bind 127.0.0.1
7780 ... consul agent -dev -bind 127.0.0.1 --config-file consul.json
Lastly I used the --http-addr=
option specied here to speak to the non-default port agent and clustered them together on the same host just to see if it was possible, sure was:
[vagrant@localhost ~]$ consul members
Node Address Status Type Build Protocol DC Segment
localhost.localdomain 127.0.0.1:8301 alive server 1.10.2 2 dc1 <all>
localhost.localdomain.dc1 127.0.0.1:9401 alive server 1.10.2 2 dc1 <all>
Therefore, I'm fairly confident you can run two agents on the same hosts with the proper settings in a configuration file for each agegnt (or use defaults on one and a configuration file on the other).