Hostname Naming Strategies


#1

Hi All,

We’re starting to think through more of our infrastructure work, and I’m curious how you all approach naming your boxes. We were thinking a simple prefix followed by an index that increments with each new box that starts up. But we’re wondering what the best way is to manage that counter. Is that something you all delegate to the opscode server?

And how do you deal with host names when you scale up/down capacity?

We’re trying to figure this stuff out on our own, so looking to learn from those who have been down this road already.

Thanks!
Ryan Chavez


#2

This tends to follow the standards I’m used to pretty well this is worth a
read … http://labmice.techtarget.com/articles/computernaming.htm

–sahil

On Thu, Aug 5, 2010 at 1:01 PM, Ryan Chavez rsc@plusgrade.com wrote:

Hi All,

We’re starting to think through more of our infrastructure work, and I’m
curious how you all approach naming your boxes. We were thinking a simple
prefix followed by an index that increments with each new box that starts
up. But we’re wondering what the best way is to manage that counter. Is
that something you all delegate to the opscode server?

And how do you deal with host names when you scale up/down capacity?

We’re trying to figure this stuff out on our own, so looking to learn from
those who have been down this road already.

Thanks!
Ryan Chavez


#3

On Aug 5, 2010, at 1:01 PM, Ryan Chavez wrote:

We’re starting to think through more of our infrastructure work, and I’m curious how you all approach naming your boxes. We were thinking a simple prefix followed by an index that increments with each new box that starts up.

I do that: ws0, ws1, … db0, db1… etc

But we’re wondering what the best way is to manage that counter. Is that something you all delegate to the opscode server?
And how do you deal with host names when you scale up/down capacity?

I’d be curious how others do this too. I couldn’t decide whether to set up the DNS from Chef,
or the Chef nodes from the DNS. In the end I went with a single text file that maps dns names
onto servers, and then I have a bit of code that configures the dns entries, creates the servers,
and then adds the Chef runlists for the nodes.

John


John Merrells
http://johnmerrells.com
+1.415.244.5808


#4

On Thu, Aug 5, 2010 at 1:08 PM, John Merrells john@merrells.com wrote:

But we’re wondering what the best way is to manage that counter. Is that something you all delegate to the opscode server?
And how do you deal with host names when you scale up/down capacity?

I’d be curious how others do this too. I couldn’t decide whether to set up the DNS from Chef,
or the Chef nodes from the DNS. In the end I went with a single text file that maps dns names
onto servers, and then I have a bit of code that configures the dns entries, creates the servers,
and then adds the Chef runlists for the nodes.

We use Dynect for our DNS, and we’re on EC2. We have the instance-id
as a piece of unique-ness, so we use that for the node_name. We also
have a data structure that looks like this:

{
“dynect”: {
“zone”: “example.com”,
“domain”: “example.com”,
“ec2”: {
“env”: “prod”,
“type”: “couchdb”
},
}
}

That gets populated by roles. The base role sets the zone and domain,
and the ec2 env and type attributes get assigned by the production and
couchdb role, respectively.

When that system boots, it makes API calls to Dynect ensuring the
following records exist:

i-17734b7c.example.com” => ec2.public_hostname

couchdb-prod-i17734b7c.example.com” => ec2.public_hostname

If the IP address changes, the records get automatically updated.

The code is here:

http://github.com/opscode/cookbooks/blob/master/dynect/recipes/ec2.rb

And you can use it yourself with:

knife cookbook site vendor dynect

Adam


Opscode, Inc.
Adam Jacob, CTO
T: (206) 508-7449 E: adam@opscode.com


#5

On 8/5/2010 1:01 PM, Ryan Chavez wrote:

Hi All,

We’re starting to think through more of our infrastructure work, and I’m curious how you all approach naming your boxes. We were thinking a simple prefix followed by an index that increments with each new box that starts up. But we’re wondering what the best way is to manage that counter. Is that something you all delegate to the opscode server?

And how do you deal with host names when you scale up/down capacity?

We’re trying to figure this stuff out on our own, so looking to learn from those who have been down this road already.

Thanks!
Ryan Chavez

Machine names (well, A records) should not convey function is pretty
much the rule we lived by here at Powerset.

Our machines are named something like this:

aa0-006-4.u.powerset.com

aa = the data center
0 = the network core
006 = the switch number in the data center (switches are named
aa0-006.u.powerset.com)
4 = the switch port.

u.powerset.com is our giant DDNS zone where all of our hosts live.

All the ‘details’ for a host, such as the data centers physical address,
the model of the switch or the host, are all in our inventory database
we call Boltz.

If we have to associate a function with a machine we use CNAMEs which
follow the convention:

fucntion.datacenter.powerset.com (e.g. ganglia.aa.powerset.com)

function might be something like nagios or ganglia
datacenter follows the hosts naming structure above.

Cheers,
Ryan


#6

We also use CNAMEs exclusively.

Adam

On Thu, Aug 5, 2010 at 2:07 PM, Ryan Dooley ryan.dooley@gmail.com wrote:

On 8/5/2010 1:01 PM, Ryan Chavez wrote:

Hi All,

We’re starting to think through more of our infrastructure work, and I’m curious how you all approach naming your boxes. We were thinking a simple prefix followed by an index that increments with each new box that starts up. But we’re wondering what the best way is to manage that counter. Is that something you all delegate to the opscode server?

And how do you deal with host names when you scale up/down capacity?

We’re trying to figure this stuff out on our own, so looking to learn from those who have been down this road already.

Thanks!
Ryan Chavez

Machine names (well, A records) should not convey function is pretty
much the rule we lived by here at Powerset.

Our machines are named something like this:

aa0-006-4.u.powerset.com

aa = the data center
0 = the network core
006 = the switch number in the data center (switches are named
aa0-006.u.powerset.com)
4 = the switch port.

u.powerset.com is our giant DDNS zone where all of our hosts live.

All the ‘details’ for a host, such as the data centers physical address,
the model of the switch or the host, are all in our inventory database
we call Boltz.

If we have to associate a function with a machine we use CNAMEs which
follow the convention:

fucntion.datacenter.powerset.com (e.g. ganglia.aa.powerset.com)

function might be something like nagios or ganglia
datacenter follows the hosts naming structure above.

Cheers,
Ryan


Opscode, Inc.
Adam Jacob, CTO
T: (206) 508-7449 E: adam@opscode.com


#7

On Aug 5, 2010, at 5:03 PM, Adam Jacob wrote:

When that system boots, it makes API calls to Dynect ensuring the
following records exist:

i-17734b7c.example.com” => ec2.public_hostname

couchdb-prod-i17734b7c.example.com” => ec2.public_hostname

If the IP address changes, the records get automatically updated.

Sorry to resurrect an old thread, but I’ve jumped back into the DNS/hostname stuff again, and wanted to ask whether the IP address changes on the AWS side frequently? Why wouldn’t you just map i-177734b7c.example.com to the IP address on the interface?

Also, do you do a similar mapping for your internal host names? e.g. would you map i-177734b7c.int.example.com to domU-12-84-39-3C-72-B2.compute-1.internal as well?

Thanks,
Ryan


#8

On Thu, Aug 26, 2010 at 11:06 AM, Ryan Chavez rsc@plusgrade.com wrote:

Sorry to resurrect an old thread, but I’ve jumped back into the DNS/hostname
stuff again, and wanted to ask whether the IP address changes on the AWS
side frequently? Why wouldn’t you just map i-177734b7c.example.com to the
IP address on the interface?

It can change any time the system reboots and gets a new DHCP lease -
so it could change at any time.

Also, do you do a similar mapping for your internal host names? e.g. would
you map i-177734b7c.int.example.com
to domU-12-84-39-3C-72-B2.compute-1.internal as well?

We don’t, because if you are inside AWS, their own internal split
horizon gets you the right address from resolving the public hostname.

Adam


Opscode, Inc.
Adam Jacob, CTO
T: (206) 508-7449 E: adam@opscode.com


#9

Ahh, so I didn’t realize that. Quite a nifty feature. :slight_smile: Thanks for that
tip.

So, back to the system reboot, if you get a new DHCP lease, and the hostname
is something along the lines of ec2-123-123-123-123.compute-1.amazon.aws.com,
and you reboot, get a new IP address, and that address is now
124.124.124.124, I presume the hostname will still remain
ec2-123-123-123-123.compute-1.amazonaws.com, right? Or will that instance
now get a new hostname of ec2-124-124-124-124?

Ryan

On Thu, Aug 26, 2010 at 5:34 PM, Adam Jacob adam@opscode.com wrote:

On Thu, Aug 26, 2010 at 11:06 AM, Ryan Chavez rsc@plusgrade.com wrote:

Sorry to resurrect an old thread, but I’ve jumped back into the
DNS/hostname
stuff again, and wanted to ask whether the IP address changes on the AWS
side frequently? Why wouldn’t you just map i-177734b7c.example.com to
the
IP address on the interface?

It can change any time the system reboots and gets a new DHCP lease -
so it could change at any time.

Also, do you do a similar mapping for your internal host names? e.g.
would
you map i-177734b7c.int.example.com
to domU-12-84-39-3C-72-B2.compute-1.internal as well?

We don’t, because if you are inside AWS, their own internal split
horizon gets you the right address from resolving the public hostname.

Adam


Opscode, Inc.
Adam Jacob, CTO
T: (206) 508-7449 E: adam@opscode.com


#10

New hostname.

Adam

On Thu, Aug 26, 2010 at 2:48 PM, Ryan Chavez rsc@plusgrade.com wrote:

Ahh, so I didn’t realize that. Quite a nifty feature. :slight_smile: Thanks for that
tip.
So, back to the system reboot, if you get a new DHCP lease, and the hostname
is something along the lines of
ec2-123-123-123-123.compute-1.amazon.aws.com, and you reboot, get a new IP
address, and that address is now 124.124.124.124, I presume the hostname
will still remain ec2-123-123-123-123.compute-1.amazonaws.com, right? Or
will that instance now get a new hostname of ec2-124-124-124-124?
Ryan
On Thu, Aug 26, 2010 at 5:34 PM, Adam Jacob adam@opscode.com wrote:

On Thu, Aug 26, 2010 at 11:06 AM, Ryan Chavez rsc@plusgrade.com wrote:

Sorry to resurrect an old thread, but I’ve jumped back into the
DNS/hostname
stuff again, and wanted to ask whether the IP address changes on the AWS
side frequently? Why wouldn’t you just map i-177734b7c.example.com to
the
IP address on the interface?

It can change any time the system reboots and gets a new DHCP lease -
so it could change at any time.

Also, do you do a similar mapping for your internal host names? e.g.
would
you map i-177734b7c.int.example.com
to domU-12-84-39-3C-72-B2.compute-1.internal as well?

We don’t, because if you are inside AWS, their own internal split
horizon gets you the right address from resolving the public hostname.

Adam


Opscode, Inc.
Adam Jacob, CTO
T: (206) 508-7449 E: adam@opscode.com


Opscode, Inc.
Adam Jacob, CTO
T: (206) 508-7449 E: adam@opscode.com


#11

Cool. Thanks. Now off to reconfigure the CNAMEs I just setup. :slight_smile:

On Thu, Aug 26, 2010 at 5:50 PM, Adam Jacob adam@opscode.com wrote:

New hostname.

Adam

On Thu, Aug 26, 2010 at 2:48 PM, Ryan Chavez rsc@plusgrade.com wrote:

Ahh, so I didn’t realize that. Quite a nifty feature. :slight_smile: Thanks for
that
tip.
So, back to the system reboot, if you get a new DHCP lease, and the
hostname
is something along the lines of
ec2-123-123-123-123.compute-1.amazon.aws.com, and you reboot, get a new
IP
address, and that address is now 124.124.124.124, I presume the hostname
will still remain ec2-123-123-123-123.compute-1.amazonaws.com, right?
Or
will that instance now get a new hostname of ec2-124-124-124-124?
Ryan
On Thu, Aug 26, 2010 at 5:34 PM, Adam Jacob adam@opscode.com wrote:

On Thu, Aug 26, 2010 at 11:06 AM, Ryan Chavez rsc@plusgrade.com
wrote:

Sorry to resurrect an old thread, but I’ve jumped back into the
DNS/hostname
stuff again, and wanted to ask whether the IP address changes on the
AWS

side frequently? Why wouldn’t you just map i-177734b7c.example.comto
the
IP address on the interface?

It can change any time the system reboots and gets a new DHCP lease -
so it could change at any time.

Also, do you do a similar mapping for your internal host names? e.g.
would
you map i-177734b7c.int.example.com
to domU-12-84-39-3C-72-B2.compute-1.internal as well?

We don’t, because if you are inside AWS, their own internal split
horizon gets you the right address from resolving the public hostname.

Adam


Opscode, Inc.
Adam Jacob, CTO
T: (206) 508-7449 E: adam@opscode.com


Opscode, Inc.
Adam Jacob, CTO
T: (206) 508-7449 E: adam@opscode.com