I prepared a fresh new server (Xserve 3GHz Xeon, 8GB RAM, OS X10.4, Zimbra 6.0.1 Network Edition) to become our new mailserver. And as I want to switch over the service from the current (mac mini) zimbra server, I was following the docs for switching servers, and restoring its contents from backups.
The (empty) server is running fine, I can log into the web frontend and zmcontrol reports everything as running.
To prepare the server for restore, I followed
Backup and Restore and when it comes to re-initialising the mysql database, zmmyinit cannot connect to the re-created mysql, giving errors:
mail:~ zimbra$ /opt/zimbra/libexec/zmmyinit
* Creating required directories
* Generating mysql config /opt/zimbra/conf/my.cnf
* Creating database in /opt/zimbra/db/data
* Starting mysql server
* Failed to connect to mysql...retrying
* Failed to connect to mysql...retrying
(repeated until I hit CTRL-C)
Because my.cnf is created by the zmmyinitwith a ridiculously big innodb_buffer_pool_size of 2576980377 bytes. The mysql in 10.4 server is only a 32bit version (yes, that's how Apple does it, and to make matters worse, it's a Power PC version in a Xeon server), thus mysql of course has to fail (log(mysql_error.log):
mysqld(11372) malloc: *** set a breakpoint in szone_error to debug
mysqld(11372) malloc: *** vm_allocate(size=2576371712) failed (error code=3)
mysqld(11372) malloc: *** error: can't allocate region
mysqld(11372) malloc: *** set a breakpoint in szone_error to debug
mysqld(11372) malloc: *** vm_allocate(size=2576371712) failed (error code=3)
mysqld(11372) malloc: *** error: can't allocate region
mysqld(11372) malloc: *** set a breakpoint in szone_error to debug
InnoDB: Fatal error: cannot allocate the memory for the buffer pool
The culprit is line 73 in /opt/zimbra/libexec/zmmyinit:
mysql_memory_percent=${mysql_memory_percent:=30}
It uses 30% of available mem for mysql, which is not entirely a bad idea, but with 8GB RAM and only a 32Bit mysql ...
I just edited the number down to 5 and now it works.