What should you name your hosts?
I used to believe this was an easy problem. Pick a theme, like Star Wars Characters or Constellations, and then name machines based on that theme: “chewbacca.tertiusfamily.net” for example. Use DNS CNAMEs to point your “functional” names (webapp1, or db1 or whatever) at the theme name and you’re off. Then I started working for Digg.
Digg’s infrastructure is massively horizontally-scaled. That means clusters, which means *lots* of individual nodes. No matter what “theme” you choose, you run out of names awfully fast. Not only that, but when you start building out a service-oriented architecture, you stop wanting to deal with individual nodes and start thinking in terms of clusters which provide services instead.
At the Puppet training I went to in Portland, we discussed the issue and I found out that there are two camps (well, as many camps as there are sysadmins, but it can be broken down into two camps). On the one side are those who want to put meta-data into their hostnames. On the other are those who think that hostnames should be as arbitrary as possible. There are strong arguments either way.
I think I come down firmly on the side of arbitrary hostnames. I’m coming to believe that, since IP addresses are necessarily unique, they should be the only unique identifier for an individual node. But I can’t come up with a solid argument as to why that is the best way.
What do you do about naming?
I like being able to look at a hostname or fqdn and know what function that server provides, optionally which environment it belongs to. For example:
web1prod
web1.prod.example.com
For multiple customer systems in a hosted environment that have the same domain:
custid-web1prod
web1prod.custid.example.com
Etc.
I don’t like “theme” hostnames. They’re not useful, especially in an environment that has high sysadmin turnover or even growth, because then each new person needs to be trained to know that systems named after star wars planets are web servers and star trek races are database servers. “What does chewbacca do again?” Sure, CNAMEs can be used, but thats extra hassle for very little practical gain.
Instead, have fun with comments in your configuration code and git commit messages
.
Comment by jtimberman — 2009/01/20 @ 6:06 pm
I work with a guy who uses names of Transformers.
Comment by Nathan — 2009/01/28 @ 8:35 am
I use arbitrary names for sets of machines that are distinct. Names of the moons of Jupiter, literature mentioned in “Ghostbusters”, interesting words from the dictionary…
For clusters or grids of machines, or pooled common machines, I use functional or positional names. app1,app2,appN : dns1,dns2, or r1p1,r1p2 for names of machines that fill up rack 1, all of which are in a common cluster or grid.
Comment by egon — 2009/01/28 @ 5:06 pm
I like themes a lot, but I have definitely run into issues before. I think hostnames shouldn’t matter as much as they do.
Comment by plathrop — 2009/01/28 @ 6:40 pm
But what do you do when you move the server to a different rack location? Or repurpose it from a app/dns/whatever to something else?
Comment by plathrop — 2009/01/28 @ 6:41 pm
I completely disagree with you here, actually. CNAMEs grant you a HUGE benefit when you want to move a service from one machine/cluster to another. Fail-over becomes as simple as updating the CNAME.
I used to follow the idea of functional names with meta-data until I started working on large-scale installations with a lot of re-purposing of servers.
Comment by plathrop — 2009/01/28 @ 6:43 pm
For small environments I use Kurosawa films (yojimbo, rashmon, etc..), I’m a fan.
When I first started at outbrain the functionality of machines and what app was deployed on each one changed somewhat often. We had se1, be4, ofl2, api24 & mysql4 all running Solr at one point.
It was frustrating.
We’re moving to a generic host naming scheme that works thus:
ob + environment + last IP octet.
Where environment 1 is NYDC1 App VLAN,or 2 might be LADC2 Web VLAN.
So 192.168.252.4/24 is in our first NY Datacenter’s app VLAN so it’s hostname would be: ob1004.
Then I give it a cname related to it’s function like api*, mysql*, cass* and also I create a TXT record that a bash script grabs it’s prompt info from which ultimately looks like:
(ob1004)(nathan@ofl2:~)$
This makes it easy on the developers and Q&A folks who need to get on a specific machine and it makes it easy on me since I don’t need to change a mass of stuff if a machine’s purpose changes.
- n
Comment by Nathan Milford — 2010/04/23 @ 7:03 pm