axfr2rbldnsd – Converting Bind (or anything really) to rbldnsd.

I could not find a script to do this anywhere, so I wrote one; it was meant to convert Bind style zone files to Rbldnsd style zone files, but since it first does an AXFR, it can be used to generate rbldnsd zones from any source that supports DNS transfers.

Here is a direct link to the file, feel free to download it: http://schwer.us/files/axfr2rbldnsd.pl; and here’s the code:


#!/usr/bin/perl

# Author: Augie Schwer
# $Id: axfr2rbldnsd.pl 1274 2007-09-23 20:30:17Z augie $
# Purpose: Convert a transfered zone files to rbldnsd style and
# prints to STDOUT.

use strict;

unless ( defined $ARGV[0] ) { print “USAGE : $0 zone_to_transfer (host)\n”; exit; }

my $zone = $ARGV[0];
my $host = $ARGV[1] || ‘localhost’;
my $time = time();
my $tmp_file = “/tmp/$zone.$time”;
my $found_ns = 0;
my $found_soa = 0;

`dig \@$host axfr $zone > $tmp_file`;

open FILE , “$tmp_file” or die “Could not open $tmp_file : $!”;

while ()
{
# Ignore comments
next if /^;/;

# remove everything in front of SOA, but keep the TTL.
if (!$found_soa) # we only need one SOA.
{
if ( /(\d+)\s+IN\s+SOA\s+(.+)$/ )
{
print “\$SOA $1 $2″;
$found_soa = 1;
next;
}
}

# remove everything in front of NS, but keep the TTL.
# concat all NS records together.
if (!$found_ns and /(\d+)\s+IN\s+NS\s+(.+)$/)
{
print “\n\$NS $1 $2 “;
$found_ns = 1;
next;
}
if ( /IN\s+NS\s+(.+)$/ ) { print “$1 “; next; }

# anything that’s not a sub-domain gets an ‘@’ in
# front followed by the type and record.
if ( /^$zone\.\s+(\d+)\s+IN\s+(A|MX)\s+(.+)$/ ) { print “\n@ $1 $2 $3\n”; next; }
# print the rest of the A records.
if ( /^(.+)\.$zone\.\s+(\d+)\s+IN\s+A\s+(.+)$/ ) { print “$1 $2 IN A $3\n”; next; }
}

# clean up after myself.
`rm -f $tmp_file`;

My new Internet Addictions

I am hooked on DI.fm and SKY.fm; both offering Internet Radio for free with commercials and premium services sans the commercials and at a higher sound quality. The House music is great background music for work, and Angela and I have a ton of fun with the 80′s channel. Other favorites are: Roots Reggae, DaTempo Lounge, and Classic Rap.

My other Internet Addiction these days is Twitter; an Internet SMS (Text Message) Gateway. I subscribe to friends feeds and get updates via my phone though out the day; I also let people who are subscribed to my feed know what I am up to. Mostly I’ve been using it to organize lunch and coffee runs, but my hope is that at some point I can send something like “At Oktoberfest.” and have group of people show up and hang out that normally would be hard to gather up.

innobackup and MySQL Replication

When using InnoDB‘s Hot Backup code to take a snapshot of your production database and use that snapshot to populate a new slave you may run into an error about not being able to drop the ibbackup_binlog_marker table and all replication bombs out.

The problem is that the innobackup tool deletes the temporary table ibbackup_binlog_marker but the .frm file does not get removed, so your new slave sees the ibbackup_binlog_marker.frm and thinks the table should exist, but the binary log says you are trying to replay says it’s already been deleted; the result is an inconsistent state that causes MySQL replication to fail.

The solution is to remove the ibbackup_binlog_marker.frm file in the mysql data directory; after that is done, then slave replication should continue as expected.

Official developer for the “mon” monitoring project.

I have been doing quite a bit of work with mon, an Open Source software project that is used to monitor the health of the services and systems on your network; which is a very handy thing when you are in charge of hundreds of machines that all need to offer different levels of service. I started submitting quite a few updates to the software for our own internal use and ended up getting on the CVS commiter’s list; which makes me an official developer of the mon project; which is pretty cool in a nerdy kind of way.

Positive Feedback for me! – Fwd: [Pdns-dev] Now is the time to test the 2.9.21 snapshots + release notes. ]

PowerDNS is Open Source software that I have been helping bug fix and develop, and the other day I received a nice little public thank you on the various PowerDNS public mailing lists. I’ve trimmed the message a bit; the original can be found here:

http://mailman.powerdns.com/pipermail/pdns-dev/2007-April/000590.html

———- Forwarded message ———-
From: bert hubert
Date: Apr 9, 2007 5:39 AM
Subject: [Pdns-dev] Now is the time to test the 2.9.21 snapshots +
release notes.
To: pdns-users@mailman.powerdns.com,
pdns-announce@mailman.powerdns.com, pdns-dev@mailman.powerdns.com

Hi everybody,

Somewhere in the coming 2 weeks, we will release the PowerDNS Authoritative
Server version 2.9.21.

This release would not have been possible without large amounts of help
and support from the PowerDNS Community. We specifically want to thank
Massimo Bandinelli of Italy’s Register.it, Dave Aaldering of Aaldering
ICT, True BV, XS4ALL, Daniel Bilik of Neosystem, EasyDNS, Augie Schwer,
Mark Bergsma, Marcus Rueckert of OpenSUSE, Andre Muraro of Locaweb, Antony
Lesuisse, Norbert Sendetzky, Marco Chiavacci, and Ruben Kerkhof.

Getting More Out of Your Rechargeable Batteries.

Being a parent means building lots of toys and being the “some assembly required” on the side of a lot of boxes; and all those toys, swings, and bouncers need batteries, so obviously after you go through your first sixteen packs of AA batteries you start to think there has to be a better way. Rechargeable batteries are the solution and to get more out of my batteries I use these neat little sleeves that can turn my AAs in to Ds; one AA battery fits into a single D sleeve, and can give dual purpose to your single purpose AA.

 LENMAR PROAA2D D size Batteries

They come from Lenmar but NewEgg sells them on the cheap.

Allow your program to bind to an address that doesn’t exist yet.

This is so cool:

http://www.linuxguruz.com/iptables/howto/2.4routing-13.html

/proc/sys/net/ipv4/ip_nonlocal_bind
Set this if you want your applications to be able to bind to an address which doesn’t belong to a device on your system. This can be useful when your machine is on a non-permanent (or even dynamic) link, so your services are able to start up and bind to a specific address when your link is down.

MySQL Replication – Creating Additional Slaves.

So you have MySQL Replication setup and working and now you want to create more slaves to your existing deployment; these are the steps that have worked for me:

Here Slave One is the slave that is currently in production and Slave Two is the new slave you want to populate and put in to production.

  • On Slave One issue the command STOP SLAVE;
  • In another terminal on Slave One tar up the MySQL data dir.; tar czf mysql.tgz /var/lib/mysql .
  • After the tar finishes go ahead and start the slave process back up on Slave One; START SLAVE;
  • On Slave Two un-tar the tarball; tar -C / -xzf mysql.tgz .
  • Edit Slave Two’s mysql.cnf to be similar to Slave One’s, but make sure to change the server-id variable.
  • Start the MySQL daemon on Slave Two, and issue the following commands: STOP SLAVE; RESET SLAVE;
  • Now issue a CHANGE MASTER filling in the correct values for your deployment; most of the info. can be found by issuing a SHOW SLAVE STATUS\G; on Slave One.

mysql> CHANGE MASTER TO
-> MASTER_HOST=’sql_host’,
-> MASTER_USER=’replication_user’,
-> MASTER_PASSWORD=’replication_password’,
-> MASTER_LOG_FILE=’update_log.000007′,
-> MASTER_LOG_POS=560;

  • Finally issue a START SLAVE; on Slave Two.

That’s it; you can issue a SHOW SLAVE STATUS\G; on your new slave and see how its health is. This has worked many times for me; the only time I had a problem was when the InnoDB files were in a weird state on the slave I was taring, in which case I waited a bit and re-tarred the MySQL data directory.

Blogroll – Friends’ Blogs Roundup.

A quick list of a few of my friends’ blogs that I try to read regularly:

  • Matt’s Blog – http://antigenius.net/blog/ .
    • Matt is the master of humor and sarcasm; you will find multimedia posts containing videos and cartoons along with Matt’s latest diatribe on what he saw on his way to work that day.
  • Jay’s Blog – http://godtoldmetokilltheenglish.com/ .
    • A glimpse at what the world looks like though the eyes of Jay; which is both scary and weird, but highly addictive.
  • Josh’s Blog – http://www.joshuaarcher.com/ .
    • Josh usually doesn’t have time to do too much blogging, but when he does you will find a great and thoughtful post.
  • Jared’s Blog – http://people.tribe.net/singe/blog .
    • Jared is a Bay Area guy traveling around the world; you will find all the dangerous and frightening things Jared likes to do when he is in a new country.
  • Dan’s Blog – http://kinon.us/blog .
    • Dan is new to the blog scene; he has a nice mix of Popular Culture posts and super nerdy technology centric posts.

    Four days in: an update.

    So far so good; my frisbee arms are going to be ripped from holding this 8 pounder all day, and I’m getting better at doing things with one hand; I even wrote a quick note today with my left hand. :)

    It’s only day four, but Angela and I are getting into a schedule of me
    taking him for the day and waking her every three hours or so for
    feedings and then she takes him during the night while I snooze; although I gotta say, there is some pretty kick ass Anime. on Cartoon Network in the freak ours of the night. :)

    Baby is happy; he sleeps eats and poops; he’s a pretty mellow baby so far; he puts up with our fumbling with complicated baby clothes and diapers without much fuss.

    Peaches is happy to be home with her family and is very curious about Davis; she’s always sniffing the places he’s been, and she gets very submissive when we bring Davis close to her; I think she’s making sure we know she’s not going to be messing with the Alpha female’s puppy.

    Momma is good; I’m making sure she gets plenty of rest and eats lots of good food. She won’t let me take any pictures of her yet, but I’m going to try and get some photos of her and baby soon.

    38 Weeks and counting.

    38 weeks and counting; we expect a brand new baby boy any time in the next 2-3 weeks.

    We bought or received a ton of baby gear, so much so we had to clean out a closet to fit it all in. We’ve put more furniture together in the last few weeks than we have in the last few years. This last weekend we finished our baby prep. by paiting the baby’s room.

    We are reading books like crazy, taking classes for newborn care, and childhood birth preperation, we even bought a DVD on childbirth prep.

    Click on the picture to see full size image and to check out the rest of our most recent photos.

    Execu-Mouse




    Execu-Mouse

    Originally uploaded by Augie Schwer.

    The classiest mouse around; the Execu-Mouse makes enterprise level decisions as easy as one click of the mouse. This model featuers the enhanced DB9 serial connector, which allows you to connect your Execu-Mouse to any computer or router in your enterprise, for full interoperability.