|
-- Jorge Urdaneta dotCMS Developer |
--
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To view this discussion on the web visit https://groups.google.com/d/msg/dotcms/-/hZTP8hZD2xUJ.
To post to this group, send email to dot...@googlegroups.com.
To unsubscribe from this group, send email to dotcms+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/dotcms?hl=en.
Kiran,
We run Linux/PostGreSQL for our dotCMS setup. Below is our backup and recovery scripts for dotCMS system.
For Backup:
From a remote Linux server, we created Password-less SSH sessions between the “backup” server to the dotCMS server and to the PostGreSQL server. We also use PGPass to the PostGreSQL server.
We initiate a RSync over SSH copy to get the dotCMS assets, etc. We also get a dump of the database. Here is the scripts I use that is initiaged on the backup server:
#!/bin/bash
exec &> capture.txt
echo Running daily.sh: $(date)
echo ==================================================================================
echo
echo Updating Search Database: $(date)
echo ==================================================================================
/usr/bin/updatedb
echo ===COMPLETE: Updated search database
echo
echo Dumping Postgres dotCMS Databases: $(date)
echo ==================================================================================
echo === template1: $(date)
pg_dump -o -O -i -h db-postgres -U postgres template1 > /opt/backup/ db-postgres /template1.sql
echo === dotcms_dcprod: $(date)
pg_dump -o -O -i -h db-postgres -U postgres dotcms_dcprod > /opt/backup/ db-postgres /dotcms_dcprod.sql
echo === postgres: $(date)
pg_dump -o -O -i -h db-postgres -U postgres postgres > /opt/backup/ db-postgres /postgres.sql
echo
echo ==COMPLETE: Postgresql Database Dump
echo
echo Downloading backup from dc-prod: $(date)
echo ===================================================================================
rsync -avz --delete -e"ssh -i /root/.ssh/id_rsa" backupagent@dc-prod:/opt/ /opt/backup/ dc-prod --bwlimit=1581
echo ===COMPLETE: RSYNC from dc-prod
echo
echo
echo Process Complete: $(date)
echo ==================================================================================
#Sending Status Report
mail -s "BACKUP REPORT: cvbackup " root@localhost < /root/capture.txt
To run a restore, this is what we do from the actual dotCMS host server:
#!/bin/bash
function progress(){
echo -n "Please wait..."
while true
do
echo -n "."
sleep 2
done
}
# Starting Scripts
echo "Stopping dotCMS"
/etc/init.d/dotCMS stop
echo "RSyncing Database"
rsync -avz --delete service@cvbackup:/opt/backup/db-postgres/dotcms_dcprod.sql ~/dotcms_dcprod.sql
rsync -avz --delete service@cvbackup.:/opt/backup/dc-prod/dotcms/dotserver/dotCMS/assets /opt/dotcms/dotserver/dotCMS
rsync -avz --delete service@cvbackup.:/opt/backup/dc-prod/dotcms/dotserver/dotCMS/reports /opt/dotcms/dotserver/dotCMS
rsync -avz --delete service@cvbackup.:/opt/backup/dc-prod/dotcms/dotserver/dotCMS/dotsecure/dotlucene /opt/dotcms/dotserver/dotCMS/dotsecure
echo "Dropping old Database"
dropdb -h db-postgres -U postgres dotcms_dcprod
echo "Creating new Database and assigning permission"
createdb -h db-postgres -U postgres -O dcprod dotcms_dcprod
echo "Populating new database from Production Dump"
psql dotcms_dcprod -h db-postgres -U dcprod -f ~/dotcms_dcprod.sql
echo "Deleting Production SQL Temp File"
rm -rf ~/dotcms_dcprod.sql
echo "Purging existing dotCMS Cache"
rm -rf /opt/dotcms/dotserver/dotCMS/dotsecure/h2db/*
rm -rf /opt/dotcms/dotserver/dotCMS/dotsecure/dotlucene/*
rm -rf /opt/dotcms/dotserver/dotCMS/dotsecure/esdata/*
#echo "Deleting old log files"
rm -rf /opt/dotcms/dotserver/tomcat/logs/*
echo "Cleaning Up Database"
psql dotcms_dcprod -h db-postgres -U dcprod -c "DELETE FROM clickstream;"
psql dotcms_dcprod -h db-postgres -U dcprod -c "DELETE FROM clickstream_request;"
psql dotcms_dcprod -h db-postgres -U dcprod -c "DELETE FROM clickstream_404;"
vacuumdb -h db-postgres -U dcprod dotcms_dcprod
reindexdb -h db-postgres -U dcprod dotcms_dcprod
#echo "Starting dotCMS"
echo "dotCMS needs to be started manually"
#/etc/init.d/dotCMS start
sleep 2
#tail -f /opt/dotcms/dotserver/tomcat/logs/dotcms.log
echo "------------------------------------------------"
echo "Don't forget to run dotCMS Maintenance"
echo ""
~
~
--
|
-- Jorge Urdaneta dotCMS Developer |
Another question :) - As far as I understand from this is we can keep backups of dotcms export file and db backups. Can we somehow keep source in svn so we can maintain versions for templates.. check the differences, tag the source and make build etc? or that is not the way CMS servers work?
--
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To view this discussion on the web visit https://groups.google.com/d/msg/dotcms/-/6JNmjMgbEqUJ.