News for hackers. Stuff that matters.
Re:A Server Naming Scheme by siliconc0w on Wednesday July 09, 2014 @01:19PM (#8010869)
Use something like a mac address and map them logically (i.e use chef envs/roles/tags). This forces you to stop remembering hostnames and setup automation to ssh/run commands. If you try to encode information into hostnames you head into the deep end pretty quickly and it's probably going to change in six months anyway.
Re:A Server Naming Scheme by jmtulloss on Wednesday July 09, 2014 @02:35PM (#8011437)
I believe that's why the information is all encoded with CNAMES. That way you can change purposes easily without ever touching the original A record, which refers to the hardware (not its function)
Re:A Server Naming Scheme by eldavido on Wednesday July 09, 2014 @06:57PM (#8012675)
You should be very careful with this. Even a relatively low TTL of 300 (5 minutes) can be too long to wait during a major outage. Make sure changing CNAMEs is a very rare thing, and be prepared to tolerate inconsistency.

It's also worth noting that some widely-used pieces of software cache DNS lookups in-process (MongoDB), so changing a DNS name is no guarantee that all connected processes will automatically fail-over to the new machine unless restarted.

Moral of the story: distributed systems is hard

Re:A Server Naming Scheme by Total_Meltdown on Wednesday July 09, 2014 @11:10PM (#8013385)
I have run into this at least twice this week alone with both Nginx and HAProxy pointing at Amazon Elastic Load Balancers. Amazon occasionally rotates out IPs for ELBs, so everything's working fine for weeks and then boom, now we're having a bad day.
Re:A Server Naming Scheme by aalbertson on Friday July 11, 2014 @11:54PM (#8023664)
As a rule, NEVER EVER use CNAME's within AWS on Route53. You should always use their A Alias function. This provides near instant changes when you need to adjust a record. This only works on aws resources, but it is a great feature they built in.
Re:A Server Naming Scheme by Total_Meltdown on Saturday July 12, 2014 @09:57PM (#8026385)
I totally agree. In these two specific cases, R53 + ELB wasn't going to work for us though, because of reasons. (I don't think I can go into specifics, but they're actual reasons.) Our workaround was reloading the configs (which triggers a DNS cache flush on both Nginx[1] and HAproxy[2]) once every couple of minutes.

I know, I know, I hate it too. We're working on it. Just wanted to share the workaround.

[1] http://wiki.nginx.org/CommandLine#Loading_a_New_Configuratio...

[2] http://www.mgoff.in/2010/04/18/haproxy-reloading-your-config...

Re:A Server Naming Scheme by jmtulloss on Tuesday July 15, 2014 @07:59PM (#8039869)
Personally, I don't think you should use DNS at all for intra-network service communication. I think the naming scheme described in the article is useful for humans, but for services trying to connect to other services, I would stick with hardcoding or Zookeeper.
Re:A Server Naming Scheme by btgeekboy on Thursday July 10, 2014 @12:24AM (#8013600)
The JVM is another one of those things - DNS lookups are, by default, cached for the life of the VM instance.
Re:A Server Naming Scheme by josho on Thursday July 10, 2014 @07:32PM (#8018001)
I remember when Java added this feature. It was because lookups in the JVM were atrociously slow, requiring a native layer to get out of the Java sandbox.

Speculating here, I suspect that an important Sun or IBM customer had an app that did lots of DNS lookups and the performance stunk. So, an engineer did a quick 'fix' to cache DNS lookups. Customer was happy, everyone moved on. Some time later this quick fix got ported into the mainline code base. But, it appears that nobody did a proper analysis of this quick fix, ie. respect TTL on DNS. Maybe supporting TTL wasn't important because this was back in the early days of Java when it was trying to win the desktop war and desktop apps weren't really expected to be long lived processes.

Re:A Server Naming Scheme by unethical_ban on Thursday July 10, 2014 @01:59AM (#8013837)
God, how awful. That's the point of TTL!
Re:A Server Naming Scheme by danudey on Thursday July 10, 2014 @09:58AM (#8014964)
Beyond that, my system has a perfectly functional resolver (and a daemon to manage name service lookups, using policies that our organization has chosen and assumes are being used).

I understand Java doing 'its own thing', because the goal is to provide consistent behaviour on all platforms, but it shouldn't be stupid behaviour.

Re:A Server Naming Scheme by tacticus on Wednesday July 09, 2014 @07:02PM (#8012693)
Cnames are really quite poor for this unless the cname information is being driven from some other tool that you can easily do lookups on.

Otherwise you won't be able to get that classifying information on the end host.

Re:A Server Naming Scheme by brugidou on Wednesday July 09, 2014 @05:00PM (#8012207)
Using a deterministic ID for machines is definitely the way to go.

We actually studied this for a while and MAC address is a pretty universal ID that works virtually anywhere. We use the smallest physical non-zero MAC address in case of multiple NICs. We considered using chassis or baseboard serial numbers but it gets too vendor specific.

Re:A Server Naming Scheme by ghshephard on Wednesday July 09, 2014 @06:03PM (#8012499)
The problem you run into with using the MAC address is what happens when you swap out the NIC?
Re:A Server Naming Scheme by lugg on Wednesday July 09, 2014 @06:57PM (#8012678)
You use the new one? Either that or dont. Doesn't really matter that should all be automated shouldn't it?
Re:A Server Naming Scheme by worklogin on Wednesday July 09, 2014 @05:55PM (#8012457)
I'm not following. The whole purpose of naming is to make it easy. I don't want to remember 000a43dbac72.example.com, it's easier to remember "pine" and "oak" and trust me, after working in the environment a while, everyone knows what every keyword is.
Re:A Server Naming Scheme by tacticus on Wednesday July 09, 2014 @07:07PM (#8012711)
Over a certain size you want your tooling to take care of that knowledge not you. You don't want your sysadmins or developers deriving information from records that can change.

if your developer or sysadmin assumes that the server named castle will always be something special instead of looking in the CMDB or other ENC for that information you will have less fun in the long run.

tl;dr random names with a central ENC forces you to only get meaning or facts from one central repo.

Re:A Server Naming Scheme by siliconc0w on Wednesday July 09, 2014 @07:14PM (#8012739)
The benefit here is mostly just with larger infrastructures where you're gonna run out of wood names and where agreeing on and enforcing naming standards is a futile and painful process.

With logical mappings, you just use chef/puppet/cmdb to do something like sshnode prod app 1 to connect to the first production app node or sshnode prod app to connect to all the production app nodes. CNAMES can do this too but then you run into potential DNS consistency issues. With this you get the human friendly abstraction and keep the machine friendly determinism.

Of course when your chef server goes down this can be a PITA (I recommend building in some knife search caching!)

Re:A Server Naming Scheme by unethical_ban on Thursday July 10, 2014 @01:58AM (#8013834)
This seems reasonable. I think the 'themed' naming works well for up to perhaps a 100 or so servers/devices managed by a single team, but with tons of automated provisioning, I suppose unfun naming is a requirement.
Re:A Server Naming Scheme by Shivetya on Thursday July 10, 2014 @09:38AM (#8014895)
I am still trying to understand their reasoning myself, unless you just have hundreds of servers I can see no reason to resort to numeric naming methods, that might be fine for arrays/sorts/computers but not people. It looks good on racks but for representation to humans, argh.

Ours are named for location and function. There are some large servers which have six character names as they so unique/important to the organization there is never a question. Usually though many fall into <owner+location+environment)

However I can see justifications made in either direction, its no worse than coding conventions that people come up with.

Re:A Server Naming Scheme by davidw on Thursday July 10, 2014 @09:28AM (#8014863)
That sounds like premature optimization for a lot of people.
Re:A Server Naming Scheme by danudey on Thursday July 10, 2014 @09:56AM (#8014960)
Part of the problem is that hostnames are so quickly ingrained into our workflows that when you only have a few servers there's no point, and when you have a bunch it's too late – unless you want to spend a lot of time changing every reference.

If you start building a small cluster which you know is going to grow into a big cluster, then these aren't really premature optimizations so much as laying a proper foundation. It's the difference between rewriting some of your Python in C and making sure all your python code is packaged into sensible objects and grouped into libraries.