Archive for July, 2009

configuring dbmail

No Comments »

So, in my last post, I mentioned that I’m running out of inodes with Maildir.  I’ve decided to try out dbmail to see if I can get decent performance putting my email into MySQL, then.  Hopefully it’ll work. :)

I built dbmail pretty normally:

./configure --prefix=/opt/dbmail/2.2.11 --sysconfdir=/etc/dbmail \
  --mandir=/usr/local/man/ --with-mysql --with-sieve

and, after creating the database + setting grants and whatnot, created the tables.

[root@myhost dbmail-2.2.11]# mysql dbmail < sql/mysql/create_tables.mysql

Then, tried to create myself:

[root@myhost dbmail-2.2.11]# dbmail-users -a sauer -P
Jul 23 15:46:43 myhost dbmail-users[24347]: Error:[sql] dbmysql.c,db_mysql_check_collations(+138): collation mismatch, your MySQL configuration specifies a different charset than the data currently in your DBMail database.
Failed. Could not connect to database (check log)
Command failed.

Well, that sucks.  After some investigation, I found that the default collation on the dbmail database was latin-1, but the tables were being created in utf8-general.  So, I had to change the default collation on the database to match the tables for the command to work (which is weird, but whatever).  This is where I admit that I’m not sure how to do it with the mysql command line.  It’d be easy to find with Google, but I just fired up PHPMyAdmin, went to the dbmail database, clicked on “operations”, and changed the default collation to match the one the tables were using.  Sometimes the pointie-clickie thing is actually useful. :)

[root@myhost dbmail-2.2.11]# dbmail-users -a sauer -P
Adding INBOX for new user... ok.

Hooray!  On to further configuration.

Sorting by socket usage

No Comments »

So, I’ve got hosting by the overly-restrictive people, and one of the problems I have is that I’m constantly running out of Unix sockets (running out of inodes is the other problem: medium-volume Maildir + limited inode ext2 filesystem = problems). The limit is a ridiculously low 360 sockets. Running Postfix, with all those sub processes that communicate with each other, I’ve had to cut the maximum number of processes down from the default of 100 to 15, which is still hitting problems under periods of high load.

Anyway, I thought this command would be handy to share. It lists all of the processes on your system using Unix sockets, and counts how many there are for each process.

lsof -U | awk '$0=$1' | sort | uniq -c | sort -k1n

Here’s the top 15 on my machine:

[root@themachine ~]# lsof -U | awk '$0=$1' | sort | uniq -c | sort -k1n | tail -n15
      2 qmgr
      4 dovecot
      5 proxymap
      5 verify
      8 perl
      8 spawn
     11 dovecot-a
     13 tlsmgr
     15 mysqld
     16 trivial-r
     18 anvil
     18 imap
     23 imap-logi
     74 smtpd
     76 master

Note that dovecot (the green ones) and MySQL take up several, but most are taken up by Postfix and friends (the blue ones).  Sigh.  This is really a good architecture, but just not something is set up to handle on their VPS plans.  I guess that’s a fair tradeoff for unlimited bandwidth, but it sure is inconvenient.