Versioner sammenlignet

Nøgle

  • Linjen blev tilføjet.
  • Denne linje blev fjernet.
  • Formatering blev ændret.

This article describes the way to make a Disaster Recovery Site of a Confluence Installation

Indholdsfortegnelse

There are a few steps involved:

Backing up MySQL and rsync'ing it to the DR Site

Rsync'ing Confluence Home And Confluence Data to the DR Site

 

 

 

...

rsyncing MySQL, Confluence Home and Files

The MySQL backup of the Confluence database and the files of the installation must be syncronised to the alternate server (called drserver.site.dk)

This should be run with cron in regular intervals

Kodeblok
#!/bin/bash
rsync -avz /backup/mysqlbackup/confluence.sql.gz drserver.site.dk:/mysqlbackup/ >/dev/null
rsync -avz /opt/confluence-data --exclude *.log drserver.site.dk:/opt/
rsync -avz /opt/confluence --exclude catalina.out drserver.site.dk:/opt/

 

Scripts and files

Script for dropping and creating a new database

Kodeblok
title/scripts/CreateConfluenceDatabase.sql
drop database confluence;
create database confluence CHARACTER SET utf8 COLLATE utf8_bin;
grant all privileges on confluence.* to confluence@localhost identified by 'confconf';
flush privileges;
Kodeblok
 

 

Restore Confluence script

Kodeblok
#!/bin/bash

if [ `id | grep "uid=0(root)" | wc -l` -lt 1 ]
then
	echo "must be executed as root"
	exit 1
fi


if [ -f /mysqlbackup/confluence.sql ]
then
	rm /mysqlbackup/confluence.sql
fi


echo "Unpacking Confluence database backup"
gunzip -c /mysqlbackup/confluence.sql.gz > /mysqlbackup/confluence.sql
 
echo "Dropping and Creating Confluence and JIRA databases"
mysql -uroot -password < /scripts/CreateConfluenceDatabase.sql


echo "Importing Confluence database backup into MySQL - This takes a while..."
mysql -uroot -password < /mysqlbackup/confluence.sql


if [ $? -eq 0 ]
then
	echo "Import finished ok"
else
	echo "mysql client ended with exit code different from 0. Stopping script"
	exit 1
fi

echo "Copying server.xml and setenv.sh to Confluence configuration"
cp /scripts/server.xml.confluence /opt/confluence/conf/server.xml
cp /scripts/setenv.sh.confluence /opt/confluence/bin/setenv.sh
rm /opt/confluence/logs/catalina.out

echo "Ready for Starting Confluence for http://drserver.site.dk"
echo "Start with: /opt/confluence/bin/startup.sh;tail -f /opt/confluence/logs/catalina.out"