Re: Monitoring hot standby replication for failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I use a shell script which ask primary wal value and compare to slave wal  value and flag it on web management page.





-------------------------start of script---------------------------------

BASE=( base_to_test )
journal=/home/sigdreal/log/journal_suivi_replication.log
ST=${journal:0:${#journal}-3}"st"
tp=0
usr="youruser"

pg_source="psql -d ${BASE[i]} -U $usr -h localhost -p 5432"
pg_destination="psql -d ${BASE[i]} -U $usr -h remotehost -p 5432"
if [ -e $journal ]; then mv $journal /home/user/log/sauv_n1/
fi

if [ -e $ST ]; then mv $ST /home/user/log/sauv_n1/
fi
date>>$journal
date>>$ST
valeur_wal_source=`$pg_source -t -c "select pg_current_xlog_location();"`
valeur_wal_destination=`$pg_destination -t -c "select pg_last_xlog_receive_location();"`

echo "test du wal emis dans le maitre à Lyon  : $valeur_wal_source">>$journal
echo "test du wal recu dans l'esclave à Clermont-ferrand  : $valeur_wal_destination">>$journal
echo " ">>$journal

echo "taille de  postgres a lyon">>$journal
df -h /var/lib/postgresql/9.6/main/>>$journal

echo " ">>$journal


if [[ $valeur_wal_source == *$valeur_wal_destination ]] ; then echo "la replication fonctionne">>$journal
else  tp=$((tp+`echo $?`))+1
      echo "la replication est interrompue"
fi

tp=$((tp+`echo $?`))

echo $tp>>$ST
date>>$ST
date>>$journal

--------------------------end of script-----------------------------

regards


Yann Convers
Gestionnaire de l'infrastructure, des référentiels et des outils




DREAL Auvergne-Rhône-Alpes

Service Connaissance, Information, Développement Durable, Autorité Environnementale - Pole Système d Information Géographique
Tél : 04 26 28 67 89
courriel : yann.convers@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
adresse de la boite d’unité : boite unité

Pour toute commande interne de prestations, merci d utilisez le formulaire suivant : http://postgis-aura.projets.appli.i2/projects/demandes-de-prestations/issues/new

Adresse postale : DREAL Auvergne-Rhône-Alpes, CIDDAE - SIG 69453 LYON CEDEX 06 Adresse physique : 5 place Jules Ferry (immeuble Lugdunum - métro Brotteaux) - 69006 Lyon Standard : 04 26 28 60 00 Liens :Site Intranet  Site Internet

Yann Convers
Gestionnaire de l'infrastructure, des référentiels et des outils

DREAL Auvergne-Rhône-Alpes

Service Connaissance, Information, Développement Durable, Autorité Environnementale - Pole Système d Information Géographique
Tél : 04 26 28 67 89
courriel : yann.convers@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
adresse de la boite d’unité : boite unité

Pour toute commande interne de prestations, merci d utilisez le formulaire suivant : http://postgis-aura.projets.appli.i2/projects/demandes-de-prestations/issues/new

Adresse postale : DREAL Auvergne-Rhône-Alpes, CIDDAE - SIG 69453 LYON CEDEX 06 Adresse physique : 5 place Jules Ferry (immeuble Lugdunum - métro Brotteaux) - 69006 Lyon Standard : 04 26 28 60 00 Liens :Site Intranet  Site Internet

Le 26/03/2019 à 03:14, > Shreeyansh Dba (par Internet, dépôt pgsql-admin-owner+m63745-136297@xxxxxxxxxxxxxxxxxxxx) a écrit :
Hi Mark,

You can used pglookout for PostgreSQL replication monitoring and failover daemon. go with below link hopes this will help you.
https://github.com/aiven/pglookout

Thanks & Regards,
Shreeyansh DBA Team
www.shreeyansh.com


On Mon, Mar 25, 2019 at 11:21 PM Mark Steben <mark.steben@xxxxxxxxxxxxxxxxx> wrote:
Good afternoon,

We are running postgres 9.4.  We are outsourcing our databases to another datacenter owned by a third party company.  The methodology we are using to move the database is hot standby log shipping replication.  We will run streaming replication for several days then, when the time comes to pull the trigger and make the move, I will complete recovery, bring in a 'production' version of postgresql.conf, restart the database, and hand it over to the apps.  

We want to make sure that during the several days of replication we are immediately notified if a problem arises - a missing log, a production outage, etc.  Is there a monitor or an 'in-the-box' procedure, or perhaps a condition to check during hot standby or streaming replication to ensure things are still running as planned, or if there is a problem?  

Thanks for any insights. 

--
Mark Steben
 Database Administrator
@utoRevenue | Autobase 
  CRM division of Dominion Dealer Solutions 
95D Ashley Ave.
West Springfield, MA 01089

t: 413.327-3045
f: 413.383-9567

www.fb.com/DominionDealerSolutions
www.twitter.com/DominionDealer
 www.drivedominion.com







[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux