For this test I decided to start with a clean MariaDB install and initialize it with a backup from a current ZCS server. In the steps that follow:
ubuntu-test-1
will be the service that has a full ZCS install.ubuntu-test-2
will be the database server.
Do a basic single-node install. Follow the instructions in MySQL Backup and Restore to enable binary logging and running a backup. They are summarized below.
Install and initialize MariaDB. Make note of the root
password that you assign; however, it will change once we import the data from the ZCS backup.
sudo apt install mariadb-server
sudo /usr/bin/mysql_secure_installation
Update the following in /etc/mysql/mariadb.conf.d/50-server.cnf
- Change
port
to7306
- Comment out
bind-address
A note regarding starting and stopping MariaDB with a standard Ubuntu install. By default it will start MariaDB via the mysqld_safe
command. This will require the use of the mysqladmin shutdown
command to stop it, which the mysql
script in /etc/init.d
does do. However, the mysqladmin
script requires the (MariaDB) root
password to work. If you want this to work properly, update /etc/mysql/debian.cnf
and add the root
password, remembering that it will change once we restore from the backup of the ZCS database.
Restart the database.
Stop ZCS and copy the log-bin
directory (/opt/zimbra/backup
in our example) to the database server. I unpacked it to the same location on ubuntu-test-2
.
Update localconfig to point to the new database server.
zmlocalconfig -e mysql_bind_address=ubuntu-test-2.local
Edit /opt/zimbra/bin/zmstorectl
and remove mysql.server
from START_ORDER
and STOP_ORDER
.
Restore the backup from the ZCS server:
sudo chmod -R a+r /opt/zimbra/backup
sudo mysql --user=root --password=ROOT-PW < /opt/zimbra/backup/full-backup.sql
Restart MariaDb. Remember that the root password is now the same as it was on the ZCS server.
Start ZCS.
Add the following config to /opt/zimbra/conf/my.conf
. You can choose a different log-bin
path if you like.
log-bin = /opt/zimbra/backup/mariadb
binlog-format = MIXED
Restart the store (zmstorectrl restart
) and verify that binary logs are being created by listing the contents of the log-bin
directory:
ls -l /opt/zimbra/backup
-rw-rw---- 1 zimbra zimbra 311 Jul 10 13:34 mariadb.000001
-rw-rw---- 1 zimbra zimbra 34 Jul 10 13:34 mariadb.index
Now run a full backup of the database:
source /opt/zimbra/bin/zmshutil
zmsetvars
/opt/zimbra/common/bin/mysqldump --user=root \
--password=$mysql_root_password \
--socket=$mysql_socket --all-databases \
--single-transaction --master-data \
--flush-logs > /opt/zimbra/backup/full-backup.sql