Archive

Archive for the ‘Sys Admin’ Category

MySQL Replication skip record

August 28th, 2010 No comments

SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
SHOW SLAVE STATUS;

[Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log ‘server-bin.000001′ at postion

July 20th, 2010 No comments

I’ve got this on one of my mysql powerdns replication slaves. I restored the server from another slave and forgot to change the server-id in my.cnf.
hope it saves someone sometime …

Issues with FTP on CentOS 5.4

April 7th, 2010 2 comments

If you’re getting “data connection refused errors” when trying to ftp onto a CentOS box, make sure your ip_conntrack_ftp is loaded.
The default RH/CentOS iptables script includes a conntrack statement :

-A RH-Firewall-1-INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT

but does not load the ftp module.
to fix on the fly run :

modprove ip_conntrack_ftp

to make sure it happens again on boot modify your /etc/sysconfig/iptables-config modules list :

IPTABLES_MODULES=”ip_conntrack_netbios_ns ip_conntrack_ftp”

ldap_add: Invalid syntax (21) – fix

January 21st, 2010 No comments

This error was driving me nuts:

ldap_add: Invalid syntax (21)
additional info: objectClass: value #0 invalid per syntax

despite looking at my ldif a hundred times, until I relized my perl script added white space at the end of the line ….

print "objectClass: top\n";
print "objectClass: person \n";
print "objectClass: organizationalPerson \n";
print "objectClass: inetOrgPerson \n";
print "objectClass: mozillaOrgPerson \n";
print "objectClass: evolutionPerson \n";
print "objectClass: simpleSecurityObject \n";

once changed to :

print "objectClass: top\n";
print "objectClass: person\n";
print "objectClass: organizationalPerson\n";
print "objectClass: inetOrgPerson\n";
print "objectClass: mozillaOrgPerson\n";
print "objectClass: evolutionPerson\n";
print "objectClass: simpleSecurityObject\n";

The ldap gods were smiling again, hope this saves someone some time.

Parse a csv file using perl

January 21st, 2010 No comments

While parsing and converting some CSV files to ldif’s I needed a perl script, the Test::CSV module is helpful :

#!/usr/bin/perl
use strict;
use warnings;
use Text::CSV;

my $file = ‘prospects.csv’;

my $csv = Text::CSV->new();

open (CSV, “< ", $file) or die $!;

while () {
if ($csv->parse($_)) {
my @columns = $csv->fields();
print “@columns\n”;
} else {
my $err = $csv->error_input;
print “Failed to parse line: $err”;
}
}
close CSV;