Running Consul Server and agent on same server?

3,691 views
Skip to first unread message

Sathiya Shunmugasundaram

unread,
Sep 27, 2015, 9:02:41 AM9/27/15
to Consul
We are trying to minimize server footprint. We will be running a 3 Node Consul cluster for example. We will run some other services that need to connect to consul. Currently we run them on different severs and use consul agent to connect to server.

Now if I run those in same server as Consul server, can I still run an agent for clients to connect? 

Also want to run the Web UI as part of agent so that, we don't need a separate instance for UI.

Thx


george....@kkbox.com

unread,
Sep 27, 2015, 9:25:49 AM9/27/15
to Consul
Yes, you can still run an agent for clients to connect.

You can also run the Web UI as part of an agent. Infact, it might be the best way to run the Web UI i.e, as part of an agent. So no need for a separate instance for the Web UI.

Cheers.

Sathiya Shunmugasundaram

unread,
Sep 29, 2015, 12:58:22 AM9/29/15
to Consul
I see couple of issues when trying to run a client in same machine as server.

If I run Consul agent as client in the same server as Consul server, since the consul process is already running, the second process cannot start

If I pass -client option to server itself, it comes up, but join commands fail. I need to join with other members of cluster.

[ro...@ip-x.x.x.x. log]# consul join y.y.y.y.

Error connecting to Consul agent: dial tcp 127.0.0.1:8400: connection refused

My consul flags $PRIVATE_IP is the IP of server

CONSUL_FLAGS="-server -bootstrap-expect=${SERVER_COUNT} -data-dir=/mnt/consul -ui-dir /opt/consul/dist -client $PRIVATE_IP"   

Thx
Sathiya

Michael Fischer

unread,
Sep 29, 2015, 2:28:06 AM9/29/15
to consu...@googlegroups.com
You don't need to run both on the same host.  Server mode is a superset of client mode.  They're both agents; activating server mode merely gives it more responsibility. 
--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/consul/issues
IRC: #consul on Freenode
---
You received this message because you are subscribed to the Google Groups "Consul" group.
To unsubscribe from this group and stop receiving emails from it, send an email to consul-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/consul-tool/567b5594-e8ae-4f08-b112-850c07fec352%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sathiya Shunmugasundaram

unread,
Sep 29, 2015, 8:01:25 AM9/29/15
to Consul
Looks like a catch 22. 

If I don't specify -client, I am not able to open the HTTP interface to outside the server so that I can connect from my web browser to the UI like http://IP:8500

When I specify -client along with server, I cannot do join probably -server and -client are conflicting options.

Is this doable at all? Running UI in server ?

Thx 
To unsubscribe from this group and stop receiving emails from it, send an email to consul-tool+unsubscribe@googlegroups.com.

Michael Fischer

unread,
Sep 29, 2015, 5:22:27 PM9/29/15
to consu...@googlegroups.com
Sathiya,

I think there may be a bit of confusion here.  The -client option isn't a boolean option like -server is.  The -client option is for specifying which IP address the client API should bind to.  

If you want to use the UI you'll need to do one of two things:

Option 1:  Add '-client 0.0.0.0' to consul's options.  This will make it bind to all interfaces.

Option 2:  Continue to bind consul's client ports to 127.0.0.1 (loopback).  Then install a HTTP reverse proxy such as nginx on the same host, and configure it to listen on the public interface and reverse proxy the requests to consul on the loopback interface.

Best regards,

--MIchael

Thx 
To unsubscribe from this group and stop receiving emails from it, send an email to consul-tool...@googlegroups.com.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/consul/issues
IRC: #consul on Freenode
---
You received this message because you are subscribed to the Google Groups "Consul" group.
To unsubscribe from this group and stop receiving emails from it, send an email to consul-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/consul-tool/d7f57768-34a4-497e-9ed4-8bc7f5884a33%40googlegroups.com.

george....@kkbox.com

unread,
Sep 29, 2015, 8:02:02 PM9/29/15
to consu...@googlegroups.com
I don't honk they was a miss understanding. 

I meant running the Web UI from a client agent, not server agent. I should have verified with you what agent you were talking about, whether client or server.

With all things clear now, you should not run the client and the server on the same machine. The client for the web UI should be on a separate machine. 

Hope this makes sense now.

Sent from my iPhone
--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/consul/issues
IRC: #consul on Freenode
---
You received this message because you are subscribed to a topic in the Google Groups "Consul" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/consul-tool/4Iwcl1q86vo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to consul-tool...@googlegroups.com.

george....@kkbox.com

unread,
Sep 29, 2015, 8:05:38 PM9/29/15
to consu...@googlegroups.com
And by join command fails, you mean joining the client agent fails? If so, then the command to join the client to the cluster is different from the one you use to join a server. Check the consul documentation again.

And pease, be more specific when posting your questions so it's easy to help you and avoid miss understandings 

Sent from my iPhone

On Sep 29, 2015, at 12:58 PM, Sathiya Shunmugasundaram <vag...@gmail.com> wrote:

Sathiya Shunmugasundaram

unread,
Sep 29, 2015, 8:19:59 PM9/29/15
to Consul
Thx folks

nginx seems a viable option if we were to avoid a client UI instance
Thx 
To unsubscribe from this group and stop receiving emails from it, send an email to consul-tool+unsubscribe@googlegroups.com.

Sathiya Shunmugasundaram

unread,
Sep 30, 2015, 9:21:07 PM9/30/15
to Consul
-client 0.0.0.0 did the trick. Not only I save an instance for UI, I get an ELB with multiple UI instances.

Thx a bunch


On Tuesday, 29 September 2015 17:22:27 UTC-4, Michael Fischer wrote:
Thx 
To unsubscribe from this group and stop receiving emails from it, send an email to consul-tool+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages