Last Updated: January 09, 2023
·
32.43K
· jd_wz

How to name your servers

An early lesson I learned as sysadmin for a multi-machine network is that renaming a computer is a pain in the ass. So much so that it's rarely worth the effort.

Rookie mistake number one is to name servers based on their role. This makes it very easy to figure out which computer does what, sure, but what happens when you need to repurpose the server? Or add more roles? All of a sudden your file server is now your redis server and you're banging your head against the wall because you named it file-server-01.

Woops.

Another rookie mistake is to name it by location. This is better, but computers can and do move. In the cloud it's not so bad, but regions are generally very large so you're going to end up using a ton of numbers: mycorp-aws-west-392.

Eh.

Here's how I like to do it. Pick a theme, something totally unrelated to computing, and stick with it. One of my favorites is to use Mario villains (much respect to Nintendo!). It's very memorable, and the role is no longer part of the machine name. Plus, it's totally fun. If you have physical boxes, go right ahead and slap a sticker on it. (For physical VM boxes the VM host itself should have its own name. Don't start slapping stickers on for each guest container or you'll end up with a sticky mess...)

Edit: Some have pointed out that you'll run out of names in large deployments. I would like to add that you can always mix-and-match names (docker does something like this for containers): mario-bowser-pikachu.

If you end up using video game characters, chances are you'll come across pixel art sprites for the names you choose. For extra fun on Linux hosts, I add a pixel art representation of the hostname to /etc/motd so that every time I log in I get a nice graphic representation of the box I'm logging in to.

Picture

The script I used to generate that is available as a gist. It's pretty simple to use, and uses a color lookup table to find the closest ANSI color code so it works great with most images (just keep them small, like around 48x48).

I do something similar for naming server roles (specifically Docker containers), but that's a topic for another post...

There's an RFC that covers all of this, btw. RFC1178 (Thanks xtagon!)

24 Responses
Add your response

Great stuff, I need to use this!

over 1 year ago ·

Planets are good for us. We have a small number of servers. When we run out of planets we'll move onto starts and more distant objects. :)

over 1 year ago ·

Good stuff, I really like the pixel art greetings.
We came across the same questions when picking names for our servers and went with pub names :)

over 1 year ago ·

And don't forget this gem: http://tools.ietf.org/html/rfc1178

over 1 year ago ·

Brilliant, thanks!

over 1 year ago ·

I name all my electronic Equipment after greek mythology characters, e.g my Macbook is called Zeus, iPhone is called Thor and my Wlan Router is called Olymp.
I really like the idea of having a ascii art of the server name when logging in.

over 1 year ago ·

You should not name after tangible things, then you get attached to them.

over 1 year ago ·

Your idea is very cool but you can't use this naming schema if you have thousands of servers, because it can't scale. If you use some orchestration software and for example you want to affect only the web servers it's very easy to do so if in the hostname you have something you can match against, for example if the hostname would be lpcaweb{01..99} this can be matched by using 'web'.

You have to choose wisely and take into account the scale of your infrastructure.

over 1 year ago ·

The real point here is really to just make sure you're abstracting the name away from the things about the server that do change.

I don't like using numbers at all because they're hard for us humans to remember - the whole identity aspect is lost there. It's at least better to merge a bunch of themes together than to start using numbers (start with Star Wars characters, move on to Star Trek, then Babylon 8, etc...) . Getting attached to a server because it's named after your favorite character might even be a good thing; we don't want them to get hurt and go down! :)

What happens when you realize the hardware you provisioned for your web servers is better for a database role? lpcaweb-01 is an unfortunate name in that case. That's the exact kind of situation I try to avoid.

PS: Your orchestration software should be able to group servers without having to rely on the hostname.

over 1 year ago ·

I actually disagree with this wholeheartedly. Naming machines based on a theme is fun for a small subset (or your home network) but realistically it's a nightmare. Here are a few scenarios.

My current network contains over 500 nodes and they are named based on role and location.

eg. www01.dc1, www02.dc1, www01.dc2, etc.

This makes it extremely easy to train a new staff member on what these machines purpose is and which datacentre that machine lives in. As for renaming a server. How hard is it to change the entry in /etc/{hostname,hosts,mailname} and reboot (just for good measure). We used to name every machine after weather phenomena (storm, glacier, wind, tornado, hurricane, etc) but at about 200 nodes it became apparent that 1) We were scraping the bottom of the barrel to get new cool names and 2) New staff members were so confused it took months to work out the basics from scratch.

As for the whole multifunction server, once again, it works if your network is small, however when you start growing you really want to move to a separation of concern model where a single node does a single task, and does it well (Unix philosophy). As a side note, I use OpenVZ for a whole heap of infrastructure. This means that a single node takes about 4G of disk space (service data is on NAS services) and as such, it's cheap to spin up guests to perform another single task well.

eg. Database, Web, Monitoring, Reverse Proxies, Syslog.

This of course means I NEVER "re-purpose" a server for another task any time, EVER. Seriously, this just leads to absolute server/disk bloat and leads to a huge amount of unknown when it comes to software (version and upgrades) auditing.

Another point (as also mentioned by @pincoded for a similar method) is the following.

I use saltstack for server management and targeting hosts using commands similar to the following;

$ salt 'www*.dc1.mydomain' cmd.run X</pre></code>

This works great for dealing with all web servers in datacentre1. Of course, I can use grains for this but the host dictates it's role pretty well.

Overall, an interesting article, just scoped very much to a smaller network structure.

over 1 year ago ·

@hrabbit Renaming a *nix server is easy when you're running your own datacenter, yes. It's hard when you're running a Windows server, and not even possible with AWS or Google Compute Engine instances without recreating them. In an environment like yours, though, it's one of those cases where it actually is practical to use location & role.

over 1 year ago ·

Naming scales just fine. It's human conversation that doesn't scale.

If you have dozens or hundreds of servers, then it would be impractical for a human to try to distinguish them individually. Your array of web servers that de/commissions servers on-the-fly can all have numbers or random strings appended- but you should name the array.

(let's just say planets)

mercury-* = database cluster

venus-* = web cluster

earth-* = load balancers

mars = beanstalkd

jupiter = puppet master

That way you can say "Mercury is down" or "Twelve mercury nodes are down" or "Mercury-11 is down"; it applies semantic meaning to your infrastructure at a level human beings can converse about.

over 1 year ago ·

I've answered a similar question on serverfault.com and I'm pretty happy with this convention: http://serverfault.com/questions/574957/servers-hostname-normalisation/574963#574963

over 1 year ago ·

Related story. Worked for a company back in '98 that used Thunderbird character names like Virgil, Brains and Penelope for their servers. One morning the AS400 gateway PC 'Gordon' had its motherboard fried and the helpdesk staff relayed the message to the users. After lunch we started receiving "Sorry for your loss" cards regarding Gordons death, obviously some people thought Gordon was a real person.

over 1 year ago ·

At my current place of work, we are using god names, like apollo, hermes, odr, sol, mani, haesoon, volos, etc.. We are not limited to Greek-only gods, there are plenty Roman, Norse, Slavic, Indian, pagan and other culture's gods to cover 300+ servers..
But if I'd have to come up with names for more servers, I'd try to go by space sector and star naming convention.. http://www.iau.org/public/themes/naming/

over 1 year ago ·

I just "wasted" almost two hours setting up the ascii script, converting some pics with prior photoshopping, updating somt motd files... arrggh coderwall! Addicting shit.

over 1 year ago ·

We are running a couple of different services and we use different sci-fi themes to know what we are talking about i.e one set of services are named deepspace9, voyager etc while others are named adama, number six etc.
Then again we have others that are just playing with the letters (i.e nagios becomes saigon etc)
This is more fun than practical though ;)

over 1 year ago ·

Thanks

over 1 year ago ·

Workstations, yes. Servers, no! Bad!

over 1 year ago ·

I Use planets and their moons, there a a hell of a lot of cool moon names.

over 1 year ago ·

This is such bad advice. It certainly doesn't scale. Renaming a server is trivial, and as hrabbit said, significantly re-purposing a server without re-installing is a terrible idea that should never happen outside of a development environment. If you're using configuration management (and you should be), you can re-install a server back to it's current running configuration in minutes.

Name your personal workstations something cute. Name your clusters (if you have a handful of them) something unique or memorable, Name the actual servers after their purpose, a number and the domain. Eg. Not 'mercury-zeus.mycompany.com' but db1.zeus.mycompany.com.

At the very least, it makes on-boarding new people much easier, and it makes the monitoring alerts make much more sense.

over 1 year ago ·

fantastic advice!

over 1 year ago ·

@hrabbit Totally agree! For a couple of years we were running servers in 3 datacentres based on names from The Simpsons, another one on Star Trek characters, and another one on Star Wars characters.
While it's really cool to do so, and you can make some nice associations to remember that the XMPP server is "Jabba" (from Jabba the Hutt) or that "Uhura" is the mail server, in the end we just kept scrathing one's head to remember - what the hell is that server responsible for, for the less obvious ones. The number of servers has grown and we're slowly switching to naming based on function and project codename. Likewise, we never re-use servers (full reinstall if a need arises), so there's never a renaming problem. We moved from OpenVZ to LXC for service isolation.

over 1 year ago ·

I named my servers after planets from Star Wars, they are easy to remember a few of them are only one word, and you find wallpapers to them everywhere :D (Tatooine, Alderaan, Hoth etc..) 100% cool idea! (Even more fun when you setup subdomains and put the wallpaper on the default vhost on the webserver)

over 1 year ago ·