SlideShare a Scribd company logo
Presented by
Cameron Nicholson, Systems Engineer
What's in a name?
•
Using DNS, Facter, and Hiera to scale node classification
Two Hard Problems
• Naming things

- today!
• Cache invalidation

- also today, but not as much
Names Have Power
• Embody taxonomies
Names Have Power
• Embody taxonomies
• Shape thinking
Names Have Power
• Embody taxonomies
• Shape thinking
• Potentially limiting
- Misnomers!
Source: openstreetmap.org
Rhode Island
Honey Badger Mountain Chicken Koala Bear
Mantis Shrimp Red Panda
image source: wikipedia
• Static nodes.pp

node srv1.dc1.foo.com { include bar::baz }

node default { }
- Hardware swaps required manual intervention

hand-edit nodes.pp

- node srv1.site.foo.com { include bar::baz }

+ node srv2.site.foo.com { include bar::baz }
• Generated nodes.pp
- Manage class assignments in inventory
- Long generation runs (20+ mins for 5k nodes)
- Required puppet code push
The bad old days
Wherefore art thou, Rolename?
Bad times
Wherefore art thou, Rolename?
source https://www.flickr.com/photos/versageek/493800514
• Abolish nodes.pp
- Inventory system cannot handle query volume
• DNS is performant. Use that!
- Generate zone files from inventory data
- Use Hiera with custom Puppet facts to assign classes
- DNS easily handles incremental updates
- Scaling DNS for query volume is a solved problem
Better days: Using DNS for ENC
Wherefore art thou, Rolename?
Much better
Wherefore art thou, Rolename?
source https://commons.wikimedia.org/wiki/File:Sdtpa_wmf-6.jpg
Designing better names
Wherefore art thou, Rolename?
• RFC2100 - machines have many names

https://tools.ietf.org/html/rfc2100
• Nodes are interchangeable - therefore disposable
- nobody is special
- cattle, not pets 

http://cloudscaling.com/blog/cloud-computing/the-history-of-pets-vs-cattle/
• Rolenames should be regular and descriptive
Good: api0005, web1020, db-redis2004

Bad: srv3502, andromeda, hermes
Wherefore art thou, Rolename?
• Primary key / counter - srv#### - srv3287

(-) not inherently meaningful

(+) easy for automated inventory
• Encoded location - {DC ID}{Room/Hall}{Rack}{Slot} - SFO1H5R13U30

(-) difficult to remember

(-) physical location often not relevant to assignment - network gear may
be forgiven
• Assignment - lb0005, api2231

(-) changes / moves with hw changes

(+) easy to understand, human friendly
Common naming schemes
The best of both
• Indelible static names - one name per server, forever

easy audit

names can be arbitrary (AWS, for example)
• Descriptive, portable rolenames

CNAMES are easily moved

Human-friendly name scheme

REGEX-parseable
- Example: api0005 -> srv1234
• Cloud-like flexibility on bare metal
Wherefore art thou, Rolename?
Anatomy of a rolename
Types
rolename
cluster name
node type node
number
memc-a0001
grouped type
[a-z]+-[a-z][0-9]*
rolename
node type
node
number
api0001
simple type
[a-z]+[0-9]*
rolename
node type
cluster
name
node
number
lb-web0001
cluster
[a-z]+d*-[a-z]+d*
Anatomy of a rolename
Example rolenames
simple type

api0001 - api0050 : api logical group 1

api1001 - api1150 : api logical group 2
grouped type

memc-a0001 - memc-a0050 : memcache cluster memc-a

zk-w0001 - zk-w0003 : zookeeper cluster zk-web
cluster

lb-web0001 - lb-web0010 : load balancers for a web service

db-redis0001 - db-redis0050 : redis db cluster
hadoop1-nn0001 - hadoop1-nn0002 : namenodes

hadoop1-zk0001 - hadoop1-zk0003 : zookeepers

hadoop1-dn0001 - hadoop1-dn1500 : datanodes
The other hard problem
Cache invalidation
• Rolename TTLs should be short

1h is good
• Static name TTLs should be long

1w works
• Danger! Carriers/Telcos/Public resolvers often ignore short TTLs!
• DevOps writes ‘glue’ to bind products together
• Inventory control + DevOps tools
- Use inventory APIs to write zone files and monitoring configs
• DNS update publishes name change
• DNS is “eventual consistency”
- Nuke local caches if necessary
Implementing rolenames
Running the glue factory
Implementing rolenames
Ready your adhesives!
source https://commons.wikimedia.org/wiki/File:FiveMinEpoxy.jpg
Monitoring
Monitoring
gen script
Puppet
server
Facter
Inventory
DNS
generate git publish
DNS gen
script
Implementing rolenames
Running the glue factory
Monitoring
Implementing rolenames
• Run checks against rolenames
- zk0001, NOT srv1234
• Assign checks based on cluster names and node types
- Example: zk* and *-zk* hosts should get zookeeper checks
• Enumerate via inventory API, or parse DNS files
- Can use puppet exec to auto generate on run
- Notify monitoring service resource to reload on change
site.pp
Implementing rolenames
Hiera3: hiera_include(‘classes’)
Hiera5: lookup('classes', {merge => unique}).include
DNS
site.foo.zone

SOA

include /var/bind/foo.main

include /var/bind/foo.roles

include /var/bind/foo.extra
site.foo.main

srv1234.site.foo.com. A 10.9.8.7
site.foo.roles

api0001.site.foo.com. CNAME srv1234.foo.com.

srv1234.site.foo.com. TXT rolename=api0001
site.foo.extra
puppet.site.foo.com. CNAME puppet0001.site.foo.com.
graphite.site.foo.com. CNAME graphite0001.site.foo.com.
Implementing rolenames
Facter
Implementing rolenames
lib/facter/rolename.rb
# use hostname to generate facts
require 'facter'
require 'resolv'
['rolename', 'cluster_name', 'node_type'].each do |fact|
Facter.add(fact) do
setcode do
begin
dns = Resolv::DNS.new()
rec = dns.getresource(Facter.value('fqdn'), Resolv::DNS::Resource::IN::TXT)
txt = rec.data.split('=').pop
rx1 = /(?<rolename>(?<cluster_name>(?<node_type>[a-z]+)-[a-z])d+)$/
rx2 = /(?<rolename>(?:(?<cluster_name>[a-z]+d*)-)?(?<node_type>[a-z]+)d*)$/
data = (rx1.match(txt) or rx2.match(txt))
data[fact]
rescue
fact == 'rolename' ? Facter.value('fqdn').split('.').shift : nil
end
end
end
end
Facter.add(:rolenumber) do
setcode do
Facter.value(:rolename)[/d+$/].to_i
end
end
Hiera
:hierarchy:
- '%{::site}/%{::rolename}'
- '%{::site}/%{::cluster_name}/%{::rolename}'
- '%{::site}/%{::cluster_name}/%{::node_type}'
- '%{::site}/%{::cluster_name}'
- '%{::site}/%{::node_type}'
- '%{::site}'
- 'common/%{::rolename}'
- 'common/%{::cluster_name}/%{::rolename}'
- 'common/%{::cluster_name}/%{::node_type}'
- 'common/%{::cluster_name}'
- 'common/%{::node_type}'
- common
Implementing rolenames
CLI
Implementing rolenames
bin/rolename
#!/bin/bash
OPT=`getopt -o a:lfx -n rolename -- "$@"`
if [ $? != 0 ] ; then
exit 1
fi
eval set -- "$OPT"
ATTR="rolename"
while true; do
case "$1" in
-a) ATTR=$2; shift 2;;
-l) LONG=1; shift;;
-f) FAIL=1; shift;;
-x) TESTFAIL=1; shift;;
--) shift; break;;
*) shift;;
esac
done
HOST=${1:-`/bin/hostname -f`}
OUT=`/usr/bin/host -t txt $HOST 2>&1`
if [ $? -ne 0 ] || [ -n "$TESTFAIL" ]; then
if [ -n "$FAIL" ]; then
echo "dns error"
exit 1
fi
if [ -n "$LONG" ] || [ `expr $HOST : "[1-9]"` -ne 0 ]; then
echo $HOST
else
echo ${HOST%%.*}
fi
exit 0
fi
IFS="
"
for line in $OUT; do
case $line in
*" descriptive text "$ATTR="*)
if [ -n "$LONG" ]; then
N=`echo $line | cut -d" " -f 1`
FULL=.${N#*.}
fi
echo ${line:$((47+${#ATTR})):-1}${FULL}
exit 0
;;
*" has no TXT record")
if [ -n "$LONG" ]; then
echo $HOST
else
echo ${HOST%%.*}
fi
exit 0
;;
*"domain name pointer "*)
eval set -- "$OPT"
hostname=${line/* domain name pointer /}
exec ${@:0:$#} ${hostname%.}
;;
*)
continue
;;
esac
done
if [ -z "$found" ] && [ -n "$FAIL" ]; then
echo "$ATTR record not found"
exit 1
fi
echo ${HOST%%.*}${FULL}
exit 0
• Role-based naming
- Puppet facts / regex parse
• Portable DNS names
• Hiera hierarchy
Implementing rolenames
Modularity
Rolenames and profiles pattern
common/api.yaml - (api####.*.foo.com)
classes:
- profiles::api
common/db-redis.yaml - (db-redis####.*.foo.com)
- profiles::redis
Implementing rolenames
Rolenames and profiles
Rolenames as profiles pattern (don’t do this - that way lies madness!)
common/db-redis.yaml
- redis
- logrotate::redis
- internal::dbusers
- collectd::redis
simple keys
Examples
common.yaml (*.foo.com)
classes:
- ’profiles::java’
profiles::java::version: ‘8u131’
lab.yaml (*.lab.foo.com)
profiles::java::version: ‘8u144’
lab/hadoop1.yaml (hadoop1-*.lab.foo.com)
profiles::java::version: ‘8u131’
:hierarchy:
- '%{::site}/%{::cluster_name}'
- '%{::site}'
- common
hashed configs
Examples
common/lb.yaml (lb-*.*.foo.com)
classes:
- profiles::lb
profiles::lb::config:
anycast_ip: ’10.10.10.10/32’
listen_port: ‘443’
sfo/lb-a.yaml (lb-a####.sfo.foo.com)
profiles::lb::config:
anycast_ip: ‘172.10.10.10/32’
lab/lb-t0001.yaml (lb-t0001.lab.foo.com)
profiles::lb::config:
anycast_ip: ‘192.10.10.10/32’
listen_port: ‘8080’
Puppet3:
/etc/puppet/heira.yaml
:merge_behavior: deeper
profiles/lb.pp
conf = hiera_hash(‘profiles::lb::config’)
Puppet5:
profiles/lb.pp
conf = lookup(‘profiles::lb::config’, {merge =>
deep}).include
:hierarchy:
- '%{::site}/%{::rolename}'
- '%{::site}/%{::cluster_name}'
- 'common/%{::cluster_name}'
hadoop cluster
Examples
dc1.yaml (*.dc1.foo.com)
profiles::hadoop::client::cluster: ‘hadoop1’
dc1/worker.yaml (worker####.dc1.foo.com)
classes:
- profiles::hadoop::client
dc1/hadoop1.yaml (hadoop1-*.dc1.foo.com)
hadoop::version: ‘5.12.1’ #cdh version
hadoop::cluster::namenodes:
- “%{::cluster_name}-nn0001.%{::domain}”
- “%{::cluster_name}-nn0002.%{::domain}”
hadoop::cluster::zookeepers:
- “%{::cluster_name}-zk0001.%{::domain}”
- “%{::cluster_name}-zk0002.%{::domain}”
- “%{::cluster_name}-zk0003.%{::domain}”
hadoop::cluster::data_volumes: [‘0’, ‘1’, ‘2’]
common/nn.yaml (hadoop1-nn####.*.foo.com)
classes:
- profiles::hadoop::namenode
common/zk.yaml (hadoop1-zk####.*.foo.com)
classes:
- profiles::hadoop::zookeeper
common/dn.yaml (hadoop1-dn####.*.foo.com)
classes:
- profiles::hadoop::datanode
:hierarchy:
- '%{::site}/%{::cluster_name}'
- '%{::site}/%{::node_type}'
- '%{::site}'
- 'common/%{::node_type}'
memcache cluster
Examples
common/memc-a.yaml (memc-a*.*.foo.com)
classes:
- profiles::memcache
profiles::memcache::options:
listen_address: ‘0.0.0.0’
max_connections: 1000
common/memc-a/memc-a0001.yaml (memc-a0001.*.foo.com)
profiles::memcache::dashboard: enable
profiles::memcache::dashboard_url: “%{::rolename}”
lab/memc-a0001.yaml (memc-a0001.lab.foo.com)
profiles::memcache::debug: true
:hierarchy:
- '%{::site}/%{::rolename}'
- 'common/%{::cluster_name}/%{::rolename}'
- 'common/%{::cluster_name}'
TM and © 2017 Apple Inc. All rights reserved.

More Related Content

What's hot

Application Logging in the 21st century - 2014.key
Application Logging in the 21st century - 2014.keyApplication Logging in the 21st century - 2014.key
Application Logging in the 21st century - 2014.key
Tim Bunce
 
PHP 7 – What changed internally?
PHP 7 – What changed internally?PHP 7 – What changed internally?
PHP 7 – What changed internally?
Nikita Popov
 
Perl Memory Use - LPW2013
Perl Memory Use - LPW2013Perl Memory Use - LPW2013
Perl Memory Use - LPW2013
Tim Bunce
 
Mito, a successor of Integral
Mito, a successor of IntegralMito, a successor of Integral
Mito, a successor of Integral
fukamachi
 
Nodejs - A quick tour (v6)
Nodejs - A quick tour (v6)Nodejs - A quick tour (v6)
Nodejs - A quick tour (v6)
Felix Geisendörfer
 
Linux-Fu for PHP Developers
Linux-Fu for PHP DevelopersLinux-Fu for PHP Developers
Linux-Fu for PHP Developers
Lorna Mitchell
 
Perl at SkyCon'12
Perl at SkyCon'12Perl at SkyCon'12
Perl at SkyCon'12
Tim Bunce
 
Hashiconf EU 2019 - A Tour of Terraform 0.12
Hashiconf EU 2019 - A Tour of Terraform 0.12Hashiconf EU 2019 - A Tour of Terraform 0.12
Hashiconf EU 2019 - A Tour of Terraform 0.12
Mitchell Pronschinske
 
Introduction to JCR and Apache Jackrabbi
Introduction to JCR and Apache JackrabbiIntroduction to JCR and Apache Jackrabbi
Introduction to JCR and Apache Jackrabbi
Jukka Zitting
 
Bottom to Top Stack Optimization - CICON2011
Bottom to Top Stack Optimization - CICON2011Bottom to Top Stack Optimization - CICON2011
Bottom to Top Stack Optimization - CICON2011
CodeIgniter Conference
 
Performance Profiling in Rust
Performance Profiling in RustPerformance Profiling in Rust
Performance Profiling in Rust
InfluxData
 
Why your Spark Job is Failing
Why your Spark Job is FailingWhy your Spark Job is Failing
Why your Spark Job is Failing
DataWorks Summit
 
Using ngx_lua in UPYUN
Using ngx_lua in UPYUNUsing ngx_lua in UPYUN
Using ngx_lua in UPYUN
Cong Zhang
 
Perl Memory Use 201209
Perl Memory Use 201209Perl Memory Use 201209
Perl Memory Use 201209
Tim Bunce
 
New SPL Features in PHP 5.3
New SPL Features in PHP 5.3New SPL Features in PHP 5.3
New SPL Features in PHP 5.3
Matthew Turland
 
Lua tech talk
Lua tech talkLua tech talk
Lua tech talk
Locaweb
 
Roll Your Own API Management Platform with nginx and Lua
Roll Your Own API Management Platform with nginx and LuaRoll Your Own API Management Platform with nginx and Lua
Roll Your Own API Management Platform with nginx and Lua
Jon Moore
 
SFBay Area Solr Meetup - June 18th: Benchmarking Solr Performance
SFBay Area Solr Meetup - June 18th: Benchmarking Solr PerformanceSFBay Area Solr Meetup - June 18th: Benchmarking Solr Performance
SFBay Area Solr Meetup - June 18th: Benchmarking Solr Performance
Lucidworks (Archived)
 
Everything as Code with Terraform
Everything as Code with TerraformEverything as Code with Terraform
Everything as Code with Terraform
Mitchell Pronschinske
 
Pig_Presentation
Pig_PresentationPig_Presentation
Pig_Presentation
Arjun Shah
 

What's hot (20)

Application Logging in the 21st century - 2014.key
Application Logging in the 21st century - 2014.keyApplication Logging in the 21st century - 2014.key
Application Logging in the 21st century - 2014.key
 
PHP 7 – What changed internally?
PHP 7 – What changed internally?PHP 7 – What changed internally?
PHP 7 – What changed internally?
 
Perl Memory Use - LPW2013
Perl Memory Use - LPW2013Perl Memory Use - LPW2013
Perl Memory Use - LPW2013
 
Mito, a successor of Integral
Mito, a successor of IntegralMito, a successor of Integral
Mito, a successor of Integral
 
Nodejs - A quick tour (v6)
Nodejs - A quick tour (v6)Nodejs - A quick tour (v6)
Nodejs - A quick tour (v6)
 
Linux-Fu for PHP Developers
Linux-Fu for PHP DevelopersLinux-Fu for PHP Developers
Linux-Fu for PHP Developers
 
Perl at SkyCon'12
Perl at SkyCon'12Perl at SkyCon'12
Perl at SkyCon'12
 
Hashiconf EU 2019 - A Tour of Terraform 0.12
Hashiconf EU 2019 - A Tour of Terraform 0.12Hashiconf EU 2019 - A Tour of Terraform 0.12
Hashiconf EU 2019 - A Tour of Terraform 0.12
 
Introduction to JCR and Apache Jackrabbi
Introduction to JCR and Apache JackrabbiIntroduction to JCR and Apache Jackrabbi
Introduction to JCR and Apache Jackrabbi
 
Bottom to Top Stack Optimization - CICON2011
Bottom to Top Stack Optimization - CICON2011Bottom to Top Stack Optimization - CICON2011
Bottom to Top Stack Optimization - CICON2011
 
Performance Profiling in Rust
Performance Profiling in RustPerformance Profiling in Rust
Performance Profiling in Rust
 
Why your Spark Job is Failing
Why your Spark Job is FailingWhy your Spark Job is Failing
Why your Spark Job is Failing
 
Using ngx_lua in UPYUN
Using ngx_lua in UPYUNUsing ngx_lua in UPYUN
Using ngx_lua in UPYUN
 
Perl Memory Use 201209
Perl Memory Use 201209Perl Memory Use 201209
Perl Memory Use 201209
 
New SPL Features in PHP 5.3
New SPL Features in PHP 5.3New SPL Features in PHP 5.3
New SPL Features in PHP 5.3
 
Lua tech talk
Lua tech talkLua tech talk
Lua tech talk
 
Roll Your Own API Management Platform with nginx and Lua
Roll Your Own API Management Platform with nginx and LuaRoll Your Own API Management Platform with nginx and Lua
Roll Your Own API Management Platform with nginx and Lua
 
SFBay Area Solr Meetup - June 18th: Benchmarking Solr Performance
SFBay Area Solr Meetup - June 18th: Benchmarking Solr PerformanceSFBay Area Solr Meetup - June 18th: Benchmarking Solr Performance
SFBay Area Solr Meetup - June 18th: Benchmarking Solr Performance
 
Everything as Code with Terraform
Everything as Code with TerraformEverything as Code with Terraform
Everything as Code with Terraform
 
Pig_Presentation
Pig_PresentationPig_Presentation
Pig_Presentation
 

Similar to PuppetConf 2017: What's in a Name? Scaling ENC with DNS- Cameron Nicholson, Apple Inc.

You know, for search. Querying 24 Billion Documents in 900ms
You know, for search. Querying 24 Billion Documents in 900msYou know, for search. Querying 24 Billion Documents in 900ms
You know, for search. Querying 24 Billion Documents in 900ms
Jodok Batlogg
 
Functional Hostnames and Why they are Bad
Functional Hostnames and Why they are BadFunctional Hostnames and Why they are Bad
Functional Hostnames and Why they are Bad
Puppet
 
Scaling web applications with cassandra presentation
Scaling web applications with cassandra presentationScaling web applications with cassandra presentation
Scaling web applications with cassandra presentation
Murat Çakal
 
Learning Puppet basic thing
Learning Puppet basic thing Learning Puppet basic thing
Learning Puppet basic thing
DaeHyung Lee
 
DNS/DNSSEC by Nurul Islam
DNS/DNSSEC by Nurul IslamDNS/DNSSEC by Nurul Islam
DNS/DNSSEC by Nurul Islam
MyNOG
 
Keeping Spark on Track: Productionizing Spark for ETL
Keeping Spark on Track: Productionizing Spark for ETLKeeping Spark on Track: Productionizing Spark for ETL
Keeping Spark on Track: Productionizing Spark for ETL
Databricks
 
Scaling php applications with redis
Scaling php applications with redisScaling php applications with redis
Scaling php applications with redis
jimbojsb
 
Ruby is an Acceptable Lisp
Ruby is an Acceptable LispRuby is an Acceptable Lisp
Ruby is an Acceptable Lisp
Astrails
 
Managing Infrastructure as Code
Managing Infrastructure as CodeManaging Infrastructure as Code
Managing Infrastructure as Code
Allan Shone
 
DNS for Developers - NDC Oslo 2016
DNS for Developers - NDC Oslo 2016DNS for Developers - NDC Oslo 2016
DNS for Developers - NDC Oslo 2016
Maarten Balliauw
 
Stack kicker devopsdays-london-2013
Stack kicker devopsdays-london-2013Stack kicker devopsdays-london-2013
Stack kicker devopsdays-london-2013
Simon McCartney
 
Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto
Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto
Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto
Docker, Inc.
 
Living on the edge
Living on the edgeLiving on the edge
Living on the edge
Adrian Cole
 
Make BDD great again
Make BDD great againMake BDD great again
Make BDD great again
Yana Gusti
 
Mining Ruby Gem vulnerabilities for Fun and No Profit.
Mining Ruby Gem vulnerabilities for Fun and No Profit.Mining Ruby Gem vulnerabilities for Fun and No Profit.
Mining Ruby Gem vulnerabilities for Fun and No Profit.
Larry Cashdollar
 
SQL Track: Restoring databases with powershell
SQL Track: Restoring databases with powershellSQL Track: Restoring databases with powershell
SQL Track: Restoring databases with powershell
ITProceed
 
Important work-arounds for making ASS multi-lingual
Important work-arounds for making ASS multi-lingualImportant work-arounds for making ASS multi-lingual
Important work-arounds for making ASS multi-lingual
Axel Faust
 
Terraform at Scale - All Day DevOps 2017
Terraform at Scale - All Day DevOps 2017Terraform at Scale - All Day DevOps 2017
Terraform at Scale - All Day DevOps 2017
Jonathon Brouse
 
RHCSA EX200 - Summary
RHCSA EX200 - SummaryRHCSA EX200 - Summary
RHCSA EX200 - Summary
Nugroho Gito
 
DNS for Developers - ConFoo Montreal
DNS for Developers - ConFoo MontrealDNS for Developers - ConFoo Montreal
DNS for Developers - ConFoo Montreal
Maarten Balliauw
 

Similar to PuppetConf 2017: What's in a Name? Scaling ENC with DNS- Cameron Nicholson, Apple Inc. (20)

You know, for search. Querying 24 Billion Documents in 900ms
You know, for search. Querying 24 Billion Documents in 900msYou know, for search. Querying 24 Billion Documents in 900ms
You know, for search. Querying 24 Billion Documents in 900ms
 
Functional Hostnames and Why they are Bad
Functional Hostnames and Why they are BadFunctional Hostnames and Why they are Bad
Functional Hostnames and Why they are Bad
 
Scaling web applications with cassandra presentation
Scaling web applications with cassandra presentationScaling web applications with cassandra presentation
Scaling web applications with cassandra presentation
 
Learning Puppet basic thing
Learning Puppet basic thing Learning Puppet basic thing
Learning Puppet basic thing
 
DNS/DNSSEC by Nurul Islam
DNS/DNSSEC by Nurul IslamDNS/DNSSEC by Nurul Islam
DNS/DNSSEC by Nurul Islam
 
Keeping Spark on Track: Productionizing Spark for ETL
Keeping Spark on Track: Productionizing Spark for ETLKeeping Spark on Track: Productionizing Spark for ETL
Keeping Spark on Track: Productionizing Spark for ETL
 
Scaling php applications with redis
Scaling php applications with redisScaling php applications with redis
Scaling php applications with redis
 
Ruby is an Acceptable Lisp
Ruby is an Acceptable LispRuby is an Acceptable Lisp
Ruby is an Acceptable Lisp
 
Managing Infrastructure as Code
Managing Infrastructure as CodeManaging Infrastructure as Code
Managing Infrastructure as Code
 
DNS for Developers - NDC Oslo 2016
DNS for Developers - NDC Oslo 2016DNS for Developers - NDC Oslo 2016
DNS for Developers - NDC Oslo 2016
 
Stack kicker devopsdays-london-2013
Stack kicker devopsdays-london-2013Stack kicker devopsdays-london-2013
Stack kicker devopsdays-london-2013
 
Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto
Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto
Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto
 
Living on the edge
Living on the edgeLiving on the edge
Living on the edge
 
Make BDD great again
Make BDD great againMake BDD great again
Make BDD great again
 
Mining Ruby Gem vulnerabilities for Fun and No Profit.
Mining Ruby Gem vulnerabilities for Fun and No Profit.Mining Ruby Gem vulnerabilities for Fun and No Profit.
Mining Ruby Gem vulnerabilities for Fun and No Profit.
 
SQL Track: Restoring databases with powershell
SQL Track: Restoring databases with powershellSQL Track: Restoring databases with powershell
SQL Track: Restoring databases with powershell
 
Important work-arounds for making ASS multi-lingual
Important work-arounds for making ASS multi-lingualImportant work-arounds for making ASS multi-lingual
Important work-arounds for making ASS multi-lingual
 
Terraform at Scale - All Day DevOps 2017
Terraform at Scale - All Day DevOps 2017Terraform at Scale - All Day DevOps 2017
Terraform at Scale - All Day DevOps 2017
 
RHCSA EX200 - Summary
RHCSA EX200 - SummaryRHCSA EX200 - Summary
RHCSA EX200 - Summary
 
DNS for Developers - ConFoo Montreal
DNS for Developers - ConFoo MontrealDNS for Developers - ConFoo Montreal
DNS for Developers - ConFoo Montreal
 

More from Puppet

Puppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepoPuppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepo
Puppet
 
Puppetcamp r10kyaml
Puppetcamp r10kyamlPuppetcamp r10kyaml
Puppetcamp r10kyaml
Puppet
 
2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)
Puppet
 
Puppet camp vscode
Puppet camp vscodePuppet camp vscode
Puppet camp vscode
Puppet
 
Modules of the twenties
Modules of the twentiesModules of the twenties
Modules of the twenties
Puppet
 
Applying Roles and Profiles method to compliance code
Applying Roles and Profiles method to compliance codeApplying Roles and Profiles method to compliance code
Applying Roles and Profiles method to compliance code
Puppet
 
KGI compliance as-code approach
KGI compliance as-code approachKGI compliance as-code approach
KGI compliance as-code approach
Puppet
 
Enforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automationEnforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automation
Puppet
 
Keynote: Puppet camp compliance
Keynote: Puppet camp complianceKeynote: Puppet camp compliance
Keynote: Puppet camp compliance
Puppet
 
Automating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNowAutomating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNow
Puppet
 
Puppet: The best way to harden Windows
Puppet: The best way to harden WindowsPuppet: The best way to harden Windows
Puppet: The best way to harden Windows
Puppet
 
Simplified Patch Management with Puppet - Oct. 2020
Simplified Patch Management with Puppet - Oct. 2020Simplified Patch Management with Puppet - Oct. 2020
Simplified Patch Management with Puppet - Oct. 2020
Puppet
 
Accelerating azure adoption with puppet
Accelerating azure adoption with puppetAccelerating azure adoption with puppet
Accelerating azure adoption with puppet
Puppet
 
Puppet catalog Diff; Raphael Pinson
Puppet catalog Diff; Raphael PinsonPuppet catalog Diff; Raphael Pinson
Puppet catalog Diff; Raphael Pinson
Puppet
 
ServiceNow and Puppet- better together, Kevin Reeuwijk
ServiceNow and Puppet- better together, Kevin ReeuwijkServiceNow and Puppet- better together, Kevin Reeuwijk
ServiceNow and Puppet- better together, Kevin Reeuwijk
Puppet
 
Take control of your dev ops dumping ground
Take control of your  dev ops dumping groundTake control of your  dev ops dumping ground
Take control of your dev ops dumping ground
Puppet
 
100% Puppet Cloud Deployment of Legacy Software
100% Puppet Cloud Deployment of Legacy Software100% Puppet Cloud Deployment of Legacy Software
100% Puppet Cloud Deployment of Legacy Software
Puppet
 
Puppet User Group
Puppet User GroupPuppet User Group
Puppet User Group
Puppet
 
Continuous Compliance and DevSecOps
Continuous Compliance and DevSecOpsContinuous Compliance and DevSecOps
Continuous Compliance and DevSecOps
Puppet
 
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick MaludyThe Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
Puppet
 

More from Puppet (20)

Puppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepoPuppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepo
 
Puppetcamp r10kyaml
Puppetcamp r10kyamlPuppetcamp r10kyaml
Puppetcamp r10kyaml
 
2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)
 
Puppet camp vscode
Puppet camp vscodePuppet camp vscode
Puppet camp vscode
 
Modules of the twenties
Modules of the twentiesModules of the twenties
Modules of the twenties
 
Applying Roles and Profiles method to compliance code
Applying Roles and Profiles method to compliance codeApplying Roles and Profiles method to compliance code
Applying Roles and Profiles method to compliance code
 
KGI compliance as-code approach
KGI compliance as-code approachKGI compliance as-code approach
KGI compliance as-code approach
 
Enforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automationEnforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automation
 
Keynote: Puppet camp compliance
Keynote: Puppet camp complianceKeynote: Puppet camp compliance
Keynote: Puppet camp compliance
 
Automating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNowAutomating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNow
 
Puppet: The best way to harden Windows
Puppet: The best way to harden WindowsPuppet: The best way to harden Windows
Puppet: The best way to harden Windows
 
Simplified Patch Management with Puppet - Oct. 2020
Simplified Patch Management with Puppet - Oct. 2020Simplified Patch Management with Puppet - Oct. 2020
Simplified Patch Management with Puppet - Oct. 2020
 
Accelerating azure adoption with puppet
Accelerating azure adoption with puppetAccelerating azure adoption with puppet
Accelerating azure adoption with puppet
 
Puppet catalog Diff; Raphael Pinson
Puppet catalog Diff; Raphael PinsonPuppet catalog Diff; Raphael Pinson
Puppet catalog Diff; Raphael Pinson
 
ServiceNow and Puppet- better together, Kevin Reeuwijk
ServiceNow and Puppet- better together, Kevin ReeuwijkServiceNow and Puppet- better together, Kevin Reeuwijk
ServiceNow and Puppet- better together, Kevin Reeuwijk
 
Take control of your dev ops dumping ground
Take control of your  dev ops dumping groundTake control of your  dev ops dumping ground
Take control of your dev ops dumping ground
 
100% Puppet Cloud Deployment of Legacy Software
100% Puppet Cloud Deployment of Legacy Software100% Puppet Cloud Deployment of Legacy Software
100% Puppet Cloud Deployment of Legacy Software
 
Puppet User Group
Puppet User GroupPuppet User Group
Puppet User Group
 
Continuous Compliance and DevSecOps
Continuous Compliance and DevSecOpsContinuous Compliance and DevSecOps
Continuous Compliance and DevSecOps
 
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick MaludyThe Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
 

Recently uploaded

Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
fredae14
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Webinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data WarehouseWebinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data Warehouse
Federico Razzoli
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 

Recently uploaded (20)

Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Webinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data WarehouseWebinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data Warehouse
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 

PuppetConf 2017: What's in a Name? Scaling ENC with DNS- Cameron Nicholson, Apple Inc.

  • 1. Presented by Cameron Nicholson, Systems Engineer What's in a name? • Using DNS, Facter, and Hiera to scale node classification
  • 2. Two Hard Problems • Naming things
 - today! • Cache invalidation
 - also today, but not as much
  • 3. Names Have Power • Embody taxonomies
  • 4.
  • 5. Names Have Power • Embody taxonomies • Shape thinking
  • 6.
  • 7. Names Have Power • Embody taxonomies • Shape thinking • Potentially limiting - Misnomers!
  • 9. Honey Badger Mountain Chicken Koala Bear Mantis Shrimp Red Panda image source: wikipedia
  • 10. • Static nodes.pp
 node srv1.dc1.foo.com { include bar::baz }
 node default { } - Hardware swaps required manual intervention
 hand-edit nodes.pp
 - node srv1.site.foo.com { include bar::baz }
 + node srv2.site.foo.com { include bar::baz } • Generated nodes.pp - Manage class assignments in inventory - Long generation runs (20+ mins for 5k nodes) - Required puppet code push The bad old days Wherefore art thou, Rolename?
  • 11. Bad times Wherefore art thou, Rolename? source https://www.flickr.com/photos/versageek/493800514
  • 12. • Abolish nodes.pp - Inventory system cannot handle query volume • DNS is performant. Use that! - Generate zone files from inventory data - Use Hiera with custom Puppet facts to assign classes - DNS easily handles incremental updates - Scaling DNS for query volume is a solved problem Better days: Using DNS for ENC Wherefore art thou, Rolename?
  • 13. Much better Wherefore art thou, Rolename? source https://commons.wikimedia.org/wiki/File:Sdtpa_wmf-6.jpg
  • 14. Designing better names Wherefore art thou, Rolename? • RFC2100 - machines have many names
 https://tools.ietf.org/html/rfc2100 • Nodes are interchangeable - therefore disposable - nobody is special - cattle, not pets 
 http://cloudscaling.com/blog/cloud-computing/the-history-of-pets-vs-cattle/ • Rolenames should be regular and descriptive Good: api0005, web1020, db-redis2004
 Bad: srv3502, andromeda, hermes
  • 15. Wherefore art thou, Rolename? • Primary key / counter - srv#### - srv3287
 (-) not inherently meaningful
 (+) easy for automated inventory • Encoded location - {DC ID}{Room/Hall}{Rack}{Slot} - SFO1H5R13U30
 (-) difficult to remember
 (-) physical location often not relevant to assignment - network gear may be forgiven • Assignment - lb0005, api2231
 (-) changes / moves with hw changes
 (+) easy to understand, human friendly Common naming schemes
  • 16. The best of both • Indelible static names - one name per server, forever
 easy audit
 names can be arbitrary (AWS, for example) • Descriptive, portable rolenames
 CNAMES are easily moved
 Human-friendly name scheme
 REGEX-parseable - Example: api0005 -> srv1234 • Cloud-like flexibility on bare metal Wherefore art thou, Rolename?
  • 17. Anatomy of a rolename Types rolename cluster name node type node number memc-a0001 grouped type [a-z]+-[a-z][0-9]* rolename node type node number api0001 simple type [a-z]+[0-9]* rolename node type cluster name node number lb-web0001 cluster [a-z]+d*-[a-z]+d*
  • 18. Anatomy of a rolename Example rolenames simple type
 api0001 - api0050 : api logical group 1
 api1001 - api1150 : api logical group 2 grouped type
 memc-a0001 - memc-a0050 : memcache cluster memc-a
 zk-w0001 - zk-w0003 : zookeeper cluster zk-web cluster
 lb-web0001 - lb-web0010 : load balancers for a web service
 db-redis0001 - db-redis0050 : redis db cluster hadoop1-nn0001 - hadoop1-nn0002 : namenodes
 hadoop1-zk0001 - hadoop1-zk0003 : zookeepers
 hadoop1-dn0001 - hadoop1-dn1500 : datanodes
  • 19. The other hard problem Cache invalidation • Rolename TTLs should be short
 1h is good • Static name TTLs should be long
 1w works • Danger! Carriers/Telcos/Public resolvers often ignore short TTLs!
  • 20. • DevOps writes ‘glue’ to bind products together • Inventory control + DevOps tools - Use inventory APIs to write zone files and monitoring configs • DNS update publishes name change • DNS is “eventual consistency” - Nuke local caches if necessary Implementing rolenames Running the glue factory
  • 21. Implementing rolenames Ready your adhesives! source https://commons.wikimedia.org/wiki/File:FiveMinEpoxy.jpg
  • 22. Monitoring Monitoring gen script Puppet server Facter Inventory DNS generate git publish DNS gen script Implementing rolenames Running the glue factory
  • 23. Monitoring Implementing rolenames • Run checks against rolenames - zk0001, NOT srv1234 • Assign checks based on cluster names and node types - Example: zk* and *-zk* hosts should get zookeeper checks • Enumerate via inventory API, or parse DNS files - Can use puppet exec to auto generate on run - Notify monitoring service resource to reload on change
  • 25. DNS site.foo.zone
 SOA
 include /var/bind/foo.main
 include /var/bind/foo.roles
 include /var/bind/foo.extra site.foo.main
 srv1234.site.foo.com. A 10.9.8.7 site.foo.roles
 api0001.site.foo.com. CNAME srv1234.foo.com.
 srv1234.site.foo.com. TXT rolename=api0001 site.foo.extra puppet.site.foo.com. CNAME puppet0001.site.foo.com. graphite.site.foo.com. CNAME graphite0001.site.foo.com. Implementing rolenames
  • 26. Facter Implementing rolenames lib/facter/rolename.rb # use hostname to generate facts require 'facter' require 'resolv' ['rolename', 'cluster_name', 'node_type'].each do |fact| Facter.add(fact) do setcode do begin dns = Resolv::DNS.new() rec = dns.getresource(Facter.value('fqdn'), Resolv::DNS::Resource::IN::TXT) txt = rec.data.split('=').pop rx1 = /(?<rolename>(?<cluster_name>(?<node_type>[a-z]+)-[a-z])d+)$/ rx2 = /(?<rolename>(?:(?<cluster_name>[a-z]+d*)-)?(?<node_type>[a-z]+)d*)$/ data = (rx1.match(txt) or rx2.match(txt)) data[fact] rescue fact == 'rolename' ? Facter.value('fqdn').split('.').shift : nil end end end end Facter.add(:rolenumber) do setcode do Facter.value(:rolename)[/d+$/].to_i end end
  • 27. Hiera :hierarchy: - '%{::site}/%{::rolename}' - '%{::site}/%{::cluster_name}/%{::rolename}' - '%{::site}/%{::cluster_name}/%{::node_type}' - '%{::site}/%{::cluster_name}' - '%{::site}/%{::node_type}' - '%{::site}' - 'common/%{::rolename}' - 'common/%{::cluster_name}/%{::rolename}' - 'common/%{::cluster_name}/%{::node_type}' - 'common/%{::cluster_name}' - 'common/%{::node_type}' - common Implementing rolenames
  • 28. CLI Implementing rolenames bin/rolename #!/bin/bash OPT=`getopt -o a:lfx -n rolename -- "$@"` if [ $? != 0 ] ; then exit 1 fi eval set -- "$OPT" ATTR="rolename" while true; do case "$1" in -a) ATTR=$2; shift 2;; -l) LONG=1; shift;; -f) FAIL=1; shift;; -x) TESTFAIL=1; shift;; --) shift; break;; *) shift;; esac done HOST=${1:-`/bin/hostname -f`} OUT=`/usr/bin/host -t txt $HOST 2>&1` if [ $? -ne 0 ] || [ -n "$TESTFAIL" ]; then if [ -n "$FAIL" ]; then echo "dns error" exit 1 fi if [ -n "$LONG" ] || [ `expr $HOST : "[1-9]"` -ne 0 ]; then echo $HOST else echo ${HOST%%.*} fi exit 0 fi IFS=" " for line in $OUT; do case $line in *" descriptive text "$ATTR="*) if [ -n "$LONG" ]; then N=`echo $line | cut -d" " -f 1` FULL=.${N#*.} fi echo ${line:$((47+${#ATTR})):-1}${FULL} exit 0 ;; *" has no TXT record") if [ -n "$LONG" ]; then echo $HOST else echo ${HOST%%.*} fi exit 0 ;; *"domain name pointer "*) eval set -- "$OPT" hostname=${line/* domain name pointer /} exec ${@:0:$#} ${hostname%.} ;; *) continue ;; esac done if [ -z "$found" ] && [ -n "$FAIL" ]; then echo "$ATTR record not found" exit 1 fi echo ${HOST%%.*}${FULL} exit 0
  • 29. • Role-based naming - Puppet facts / regex parse • Portable DNS names • Hiera hierarchy Implementing rolenames Modularity
  • 30. Rolenames and profiles pattern common/api.yaml - (api####.*.foo.com) classes: - profiles::api common/db-redis.yaml - (db-redis####.*.foo.com) - profiles::redis Implementing rolenames Rolenames and profiles Rolenames as profiles pattern (don’t do this - that way lies madness!) common/db-redis.yaml - redis - logrotate::redis - internal::dbusers - collectd::redis
  • 31. simple keys Examples common.yaml (*.foo.com) classes: - ’profiles::java’ profiles::java::version: ‘8u131’ lab.yaml (*.lab.foo.com) profiles::java::version: ‘8u144’ lab/hadoop1.yaml (hadoop1-*.lab.foo.com) profiles::java::version: ‘8u131’ :hierarchy: - '%{::site}/%{::cluster_name}' - '%{::site}' - common
  • 32. hashed configs Examples common/lb.yaml (lb-*.*.foo.com) classes: - profiles::lb profiles::lb::config: anycast_ip: ’10.10.10.10/32’ listen_port: ‘443’ sfo/lb-a.yaml (lb-a####.sfo.foo.com) profiles::lb::config: anycast_ip: ‘172.10.10.10/32’ lab/lb-t0001.yaml (lb-t0001.lab.foo.com) profiles::lb::config: anycast_ip: ‘192.10.10.10/32’ listen_port: ‘8080’ Puppet3: /etc/puppet/heira.yaml :merge_behavior: deeper profiles/lb.pp conf = hiera_hash(‘profiles::lb::config’) Puppet5: profiles/lb.pp conf = lookup(‘profiles::lb::config’, {merge => deep}).include :hierarchy: - '%{::site}/%{::rolename}' - '%{::site}/%{::cluster_name}' - 'common/%{::cluster_name}'
  • 33. hadoop cluster Examples dc1.yaml (*.dc1.foo.com) profiles::hadoop::client::cluster: ‘hadoop1’ dc1/worker.yaml (worker####.dc1.foo.com) classes: - profiles::hadoop::client dc1/hadoop1.yaml (hadoop1-*.dc1.foo.com) hadoop::version: ‘5.12.1’ #cdh version hadoop::cluster::namenodes: - “%{::cluster_name}-nn0001.%{::domain}” - “%{::cluster_name}-nn0002.%{::domain}” hadoop::cluster::zookeepers: - “%{::cluster_name}-zk0001.%{::domain}” - “%{::cluster_name}-zk0002.%{::domain}” - “%{::cluster_name}-zk0003.%{::domain}” hadoop::cluster::data_volumes: [‘0’, ‘1’, ‘2’] common/nn.yaml (hadoop1-nn####.*.foo.com) classes: - profiles::hadoop::namenode common/zk.yaml (hadoop1-zk####.*.foo.com) classes: - profiles::hadoop::zookeeper common/dn.yaml (hadoop1-dn####.*.foo.com) classes: - profiles::hadoop::datanode :hierarchy: - '%{::site}/%{::cluster_name}' - '%{::site}/%{::node_type}' - '%{::site}' - 'common/%{::node_type}'
  • 34. memcache cluster Examples common/memc-a.yaml (memc-a*.*.foo.com) classes: - profiles::memcache profiles::memcache::options: listen_address: ‘0.0.0.0’ max_connections: 1000 common/memc-a/memc-a0001.yaml (memc-a0001.*.foo.com) profiles::memcache::dashboard: enable profiles::memcache::dashboard_url: “%{::rolename}” lab/memc-a0001.yaml (memc-a0001.lab.foo.com) profiles::memcache::debug: true :hierarchy: - '%{::site}/%{::rolename}' - 'common/%{::cluster_name}/%{::rolename}' - 'common/%{::cluster_name}'
  • 35. TM and © 2017 Apple Inc. All rights reserved.