Wednesday, December 27, 2006

Zimbra and the art of mail troubleshooting

Things I learned today about the Zimbra mail server I inherited that could send me over the edge. Zimbra is an open source mail server that wraps itself around postfix, tomcat, and mysql. It seemed to be working just fine until there was a power blink in my office and I realized the mail server wasn't on a UPS.

Login to mail server and 'su - zimbra'

Useful commands to figure out what is happening with Zimbra.

zmcontrol status
zmcontrol start
This will start tomcat, mysql, AND zimbra. You don't start these solo, in fact, they don't even live in normal places, they live in /opt/zimbra, even the bin files. Por que? I ask, in unaccented spanish, por que?

zmcontrol stop
Stops everything, including mysql and tomcat.

Mysql is installed in zimbra's home directory, also /opt/zimbra/mysql
Check logfile in /opt/zimbra/log/mysql.log
Also check /var/log/zimbra.log and /opt/zimbra/log/zimbra.log.

Today my issue was that when starting zimbra mysql didn't start also.
Tried zmcontrol stop and start - didn't change

Checked logfile and saw:
[zimbra@mail log]$ more mysqld.log
061227 11:17:19 mysqld started
061227 11:17:20 [ERROR] Can't start server: cannot resolve hostname!: Success
061227 11:17:20 mysqld ended

Found this on google search: http://bugs.mysql.com/bug.php?id=1200

Checked /opt/zimbra/conf/my.cnf file - saw
[mysqld]

basedir = /opt/zimbra/mysql
datadir = /opt/zimbra/db/data
socket = /opt/zimbra/db/mysql.sock
pid-file = /opt/zimbra/db/mysql.pid
bind-address = localhost
port = 7306
user = zmbra

But localhost wasn't listed in /etc/hosts - must have been removed prior.

Added this to /etc/hosts:

127.0.0.1 localhost.localdomain localhost
192.168.1.17 mail.omn.org mail # this was already there

Zmcontrol stop
Zmcontrol start

Zimbra started just fine. Then I figured out that I couldn't receive mail. The server was receiving mail and storing it in /opt/zimbra/store/0/ with a numeric folder for each user (if you know what date you created the user account, that date stamp will give you a clue to the folder for your mail).

That problem got nailed down to DNS - I guess the server wanted DNS to spit back it's private IP address when it asked, which it wouldn't, and so it got upset about the whole thing. this is not the first time I wondered how the darned thing was working in the first place.

Mail and DNS, they are like a divorced couple with kids - never to be separated no matter how hard you try.

Something else that was useful:
http://www.zimbra.com/forums/showthread.php?t=340

p.s. turned out the very big little issue was that named didn't start when the box rebooted. Started named, which was needed by zimbra to resolve the IP correctly, and life got better. Still kept the localhost entry in /etc/hosts because heaven knows why my coworker thought it was a good idea to take it out. Sheesh.

Reference: zimbra mail mysql mysql.server tomcat

2 comments:

Anonymous said...

Hi,

Thank you very much for your documents. Is really very useful for me.

Mohamed Ashiff

Anonymous said...

Thanks Julie for posting this. Googled all over, but this was crisp and solved my problem.