Last time I wrote about the installation and configuration of confluence, and today I will write about how to backup and migrate. OS :
Centos 5.5, confluence version: 3.2, mysql: 5.0 Official
document: http://confluence.atlassian.com/display/CONF32/Migrating+Confluence+Between+Servers It is to back up two directories, namely the installation directory and the home directory, and the backup database:
cd /usr/local zip -r /usr/local/confluence-3.2-std.zip /usr/local/confluence-3.2-std sz confluence-3.2-std.zip --Download it locally, and then upload it to another server later cd / var zip -r confluence3.2.zip confluence3.2 sz confluence3.2.zip mysqldump -u root -p confluence >/home/hdt/confluence.sql cd /home/hdt sz confluence.sql
To restore on the server 192.168.9.53:
First, install Mysql, and make sure that it is the same version as the original server. Here, both servers are installed using Yum.
mysql -u root -p
create database confluence; --Create the same database as the original server
grant all on confluence.* to 'test'@”%” identified by 'test'; --Add the same account and password as the original server
mysql -u test -p -- test the local connection cd /usr/local rz confluence-3.2-std.zip -- upload the backup just downloaded to the local server to the server unzip confluence-3.2-std.zip cd / var rz confluence3.2.zip unzip confluence3.2.zip rz confluence.sql mysql -u root -p confluence <confluence.sql Startup program: /usr/local/confluence-3.2-std/bin/startup.sh Test access: http://192.168.9.53:8080
The script has been made, no need to manually back up! As follows:
On server 192.168.9.45:
Script directory: cd /root/shells
directory Backup script zip.sh:
#!/bin/bash # 2011-01-18 by qinshan.li # /usr/bin/zip -r /opt/confluence-3.2-std-$(date +%F).zip /usr/local/confluence-3.2-std /usr/bin/zip -r /opt/confluence3.2-$(date +%F).zip /var/confluence3.2 for FILE in $(find /opt -name "confluence*.zip" -print) do /usr/bin/zip -T ${FILE} if [[ $? == 0 ]]; then scp ${FILE} [email protected]:/home/hdt && rm -f ${FILE} be done be Database backup script dump.sh: #!/bin/bash # 2011-01-18 by qinshan.li # mysqldump -uroot -p"12345" confluence >/opt/confluence-$(date +%F).sql scp /opt/confluence-$(date +%F).sql [email protected]:/home/hdt && rm -f /opt/confluence-$(date +%F).sql cron task script: 10 3 * * * /root/shells/dump.sh & 15 3 * * * /root/shells/zip.sh >>/root/shells/log 2>&1 &
Recovery strategy:
On server 192.168.9.53:
Recovery installation directory:
unzip /home/hdt/confluence-3.2-std-$(date +%F).zip -d /
Recovery home directory:
unzip /home/hdt/confluence3. 2-$(date +%F).zip -d
to restore the database:
mysql -u root -p confluence </home/hdt/confluence-$(date +%F).zip
Note: put $(date in the above command +%F) with the date you want to restore. If you want to restore today's backup, you can directly execute it without modification.