consul + aws elb

946 views
Skip to first unread message

Izo

unread,
Mar 29, 2016, 12:44:55 PM3/29/16
to Consul
Hi, 

I am trying to setup consul behind AWS ELB. I have the following working pieces:

1) Consul service init script (/etc/init/consul) 
2) Script (consul-elb) that pulls all the ips behind the ELB and outputs them into a json file, e.g.: 
{
  "retry_join": [
    "172.15.1.15",
    "172.19.0.159"
  ]
}
3) If i run first consul-elb and after this start consul, I see all the members properly. 

What i miss is a seamless integration between these two. I want whenever the ELB resizes, the consul members to be removed, instead of marked as failed (based on the json file which is generated from consul-elb). I looked into 'consul watch'  along with 'nodes', but i am not sure what will be the syntax for this. I do not want to use a cronjob for this. Any ideas/suggestions? 

Thanks,
Izo 

David Adams

unread,
Mar 29, 2016, 2:38:57 PM3/29/16
to consu...@googlegroups.com
There's no way to get notifications about ELB IP address changes from AWS, except by monitoring DNS at least once a minute yourself.

But, I'm not sure why you are putting consul behind an ELB. It shouldn't be necessary if you are just using it for joining the cluster. Join directly to the consul hosts' IP addresses and then the cluster will share the IPs of the rest.

It might be reasonable to use an ELB to load balance the Consul UI between multiple hosts to a public DNS name, but in that case, Consul itself doesn't need to keep track of the public IPs. Can you give some more context of what you are trying to achieve?

--
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/d8f66b8f-0d05-4970-b512-57966a0bf2f2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Izo

unread,
Mar 29, 2016, 3:16:38 PM3/29/16
to Consul
Hi David,

Thank you for the feedback. So, by installing consul behind the ELB i want to achieve the following:

1) I want to add service checks.
2) I want to force one of the servers to acquire a session lock and based on this session lock to trigger a service execution. I want to be able to have 1 server (maybe more in the future), per ELB which will run a specific service. I was going to use session lock and if the server that has the lock is localhost, then execute the service.

Now, regarding your answer: "But, I'm not sure why you are putting consul behind an ELB. It shouldn't be necessary if you are just using it for joining the cluster. Join directly to the consul hosts' IP addresses and then the cluster will share the IPs of the rest."

I could join the cluster upon start, however, if the server is being shutdown it will be marked as failed. Currently, if I run my 'consule-elb' it populates 'retry_join.json' and upon start consul will join the cluster. Now, if i shutdown one of the servers, it  will be marked as failed. I wanted to prevent false positives by not having 'failing' servers that are not in the ELB anymore.

Thanks,
izo
Reply all
Reply to author
Forward
0 new messages