Une raison particulière à ça ? Le dns pointe sur 95.142.160.131
postgresql.conf
(archive_command + éventuellement le listen_addresses)recovery.conf
(primary_conninfo)A priori instance non utilisée, pas de précaution à prendre.
Mise à jour via pg_dumpall.
deb http://apt.postgresql.org/pub/repos/apt/ squeeze-pgdg main
archive_mode = on archive_command = 'rsync -a %p postgres@tantor.postgresql.fr:/data/backups/postgresql/xlog/%f' wal_level = hot_standby # au cas où on veuille passer en hot_standby checkpoint_completion_target = 0.9 ssl = true log_checkpoints = on log_disconnections = on log_connections = on log_line_prefix = '%t [%p]: [%l-1] db=%d,user=%u ' shared_buffers = 128MB wal_buffers = -1 max_wal_senders = 3 port = 5432 max_connections = 100 listen_addresses = 'localhost,217.70.189.115' # ip de celeste lc_messages = 'C' default_text_search_config = 'pg_catalog.french'
archive_mode = on archive_command = 'rsync -a %p postgres@celeste.postgresql.fr:/data/backups/postgresql/xlog/%f' wal_level = hot_standby # au cas où on veuille passer en hot_standby checkpoint_completion_target = 0.9 ssl = true log_checkpoints = on log_disconnections = on log_connections = on log_line_prefix = '%t [%p]: [%l-1] db=%d,user=%u ' shared_buffers = 128MB wal_buffers = -1 max_wal_senders = 3 port = 5432 max_connections = 100 listen_addresses = 'localhost,95.142.160.131' # ip de tantor lc_messages = 'C' default_text_search_config = 'pg_catalog.french'
#connexions locales local all all peer host all all 127.0.0.1/32 md5 host all all ::1/128 md5 # pas de connexion sans ssl hostnossl all all 0.0.0.0/0 reject # on autorise celese et tantor hostssl all postgres 217.70.189.115/32 md5 hostssl all postgres 95.142.160.131/32 md5 # on autorise celeste et tantor à se connecter pour la réplication hostssl replication repli 217.70.189.115/32 md5 hostssl replication repli 95.142.160.131/32 md5 # on rejette tout le reste hostssl all all 0.0.0.0/0 reject
standby_mode = on primary_conninfo = 'host=celeste.postgresql.fr port=5432 user=repli' restore_command = 'cp /data/backups/postgresql/xlog/%f %p' # pas de cleanup comme on a une sauvegarde pitr, ils seront purgés par le cron PITR # pas de trigger file
mkdir -p /data/backups/postgresql mkdir -p /data/backups/postgresql-tantor
mkdir -p /data/backups/postgresql mkdir -p /data/backups/postgresql-celeste
mv /var/backups/postgresql/* /data/backups/postgresql rmdir /var/backups/postgresql
mv /var/backups/postgresql-celeste/* /data/backups/postgresql-celeste rmdir /var/backups/postgresql-celeste
postgres
:0 1 * * * pg_dumpall | gzip -c > /data/backups/postgresql/pgsql.daily.sql.gz 0 2 * * 1 pg_dumpall | gzip -c > /data/backups/postgresql/pgsql.weekly.sql.gz 0 3 1 * * pg_dumpall | gzip -c > /data/backups/postgresql/pgsql.monthly.sql.gz 0 4 * 1 * pg_dumpall | gzip -c > /data/backups/postgresql/pgsql.yearly.sql.gz # export vers Tantor 0 6 * * * rsync -av --delete /data/backups/postgresql/* tantor.postgresql.fr:/data/backups/postgres-celeste/
postgres
:#0 1 * * * pg_dumpall | gzip -c > /data/backups/postgresql/pgsql.daily.sql.gz #0 2 * * 1 pg_dumpall | gzip -c > /data/backups/postgresql/pgsql.weekly.sql.gz #0 3 1 * * pg_dumpall | gzip -c > /data/backups/postgresql/pgsql.monthly.sql.gz #0 4 * 1 * pg_dumpall | gzip -c > /data/backups/postgresql/pgsql.yearly.sql.gz # export vers Celeste #0 6 * * * rsync -av --delete /data/backups/postgresql/* celeste.postgresql.fr:/data/backups/postgres-tantor/
#!/bin/bash SRVDEST="tantor.postgresql.fr" VERSION="9.3" INST="main" SNAPNAME="snapshot_$(date '+%Y_%m_%d_%H_%M_%S')" PGDIR="/var/lib/postgresql/${VERSION}/${INST}/" DESTDIR="/data/backups/postgresql/snapshot/${SNAPNAME}/" rc=0 psql --cluster ${VERSION}/${INST} -c "SELECT pg_start_backup('${SNAPNAME}')" if [ $? -ne 0 ]; then echo "Unable to start backup !" exit 1 fi rsync -avp --exclude "pg_xlog/*" ${PGDIR} postgres@${SRVDEST}:${DESTDIR} if [ $? -ne 0 ]; then echo "Error during rsync of ${PGDIR} to postgres@${SRVDEST}:${DESTDIR} !" rc=1 fi psql --cluster ${VERSION}/${INST} -c "SELECT pg_stop_backup()" if [ $? -ne 0 ]; then echo "Unable to stop backup !" rc=1 fi exit ${rc}
#!/bin/bash SRVDEST="celeste.postgresql.fr" INST="main" SNAPNAME="snapshot_$(date '+%Y_%m_%d_%H_%M_%S')" PGDIR="/var/lib/postgresql/${VERSION}/${INST}/" DESTDIR="/data/backups/postgresql/snapshot/${SNAPNAME}/" rc=0 psql --cluster ${VERSION}/${INST} -c "SELECT pg_start_backup('${SNAPNAME}')" if [ $? -ne 0 ]; then echo "Unable to start backup !" exit 1 fi rsync -avp --exclude "pg_xlog/*" ${PGDIR} postgres@${SRVDEST}:${DESTDIR} if [ $? -ne 0 ]; then echo "Error during rsync of ${PGDIR} to postgres@${SRVDEST}:${DESTDIR} !" rc=1 fi psql --cluster ${VERSION}/${INST} -c "SELECT pg_stop_backup()" if [ $? -ne 0 ]; then echo "Unable to stop backup !" rc=1 fi exit ${rc}
#!/bin/bash RETENTION=5 # Suppression des snapshots de plus de $RETENTION jours find /data/backups/postgresql/snapshot/ -maxdepth 1 -type d -name "snapshot_*" -mtime +${RETENTION} -print -exec rm -rf {} \; # Suppression des WAL de plus de $RETENTION jours find /data/backups/postgresql/xlog -type f -mtime +${RETENTION} -print -delete
sudo apt-get install sysstat