- From: Matt Ray <
>
- To:
- Subject: [chef] Re: Setting up hosts between multiple boxes on EC2
- Date: Sun, 20 Nov 2011 14:31:06 +0000
You'll want to take a good look at how Chef utilizes search within
recipes. Rather than try to manage dns, you use search in the recipes
for your "app1" to find the machines that have the recipe or roles
that identify your "db1" machine (and vice versa). Many recipes do
this sort of work, load balancers looking for web apps, clients
looking for servers and workers looking for masters. IMHO, it's one of
the cooler features of working with Chef.
http://wiki.opscode.com/display/chef/Search
and more specifically
http://wiki.opscode.com/display/chef/Search#Search-UsingSearchinRecipes
Thanks,
Matt Ray
Senior Technical Evangelist | Opscode Inc.
| (512) 731-2218
Twitter, IRC, GitHub: mattray
On Sun, Nov 20, 2011 at 1:32 PM, Luis Correa d'Almeida
<
>
wrote:
>
Let's say I provision two boxes on EC2: db1 and app1
>
>
What's the best way to make each box aware of the other? I need to
>
tell app1 the IP/host/FQDN of the db1 machine so it can connect to it.
>
>
One option is to use hosts in the config files - for example, in the
>
app1 box the config references a host (db1) that I can set up either
>
in the hosts file or in the local DNS. But I still wouldn't know the
>
IP of db1 to populate the hosts file with when running chef. At this
>
point, I need to change my data-bags once I find out the address of
>
db1 and then provision app1, running a recipe that adds the right
>
entry to the hosts file with the newly found db1 IP.
>
>
Just wondering if there is a better way.
>
>
Thanks,
>
>
Luis
>
Archive powered by MHonArc 2.6.16.