PostgreSQL La base de donnees la plus sophistiquee au monde.

Forums PostgreSQL.fr

Le forum officiel de la communauté francophone de PostgreSQL

Vous n'êtes pas identifié(e).

#1 Re : Réplication » Standby serveur ne trouve pas le fichier wal : cp: cannot stat » 04/04/2014 14:06:46

Sébastien,

Effectivement l'erreur n'apparaît qu'une seule fois au démarrage du standby.
Pour ce projet, le PITR n'est pas nécessaire mais je retiens votre idée pour d'autres projets qui vont venir.
Je vous remercie beaucoup de votre aide et vous souhaite un bon weekend.

Cdt

#2 Re : Réplication » Standby serveur ne trouve pas le fichier wal : cp: cannot stat » 04/04/2014 12:17:04

Merci d'avoir répondu.
Je n'ai pas été très clair en fait.
J'ai nommé mon serveur master PG_MD1_DEV et mon standby PG_MD2_dev.
Du côté Master, j'ai configuré l'archive des xlog pour qu'elles aillent dans un répertoire sur la machine standbyhost :
archive_command = 'rsync -ahv %p standbyhost:/pgdata/PG_MD2_DEV/archive_xlog/%f'
Donc les archives des xlog du master vont dans standbyhost:/pgdata/PG_MD2_DEV/archive_xlog

Le standby trouve bien le fichier /pgdata/PG_MD2_DEV/archive_xlog/000000020000000000000011 pour le copier dans /pgdata/PG_MD2_DEV/data/pg_xlog (restore_command = 'cp -p /pgdata/PG_MD2_DEV/archive_xlog/%f "%p"') puisque le fichier existe bien dans ce dernier répertoire.

Mais alors pourquoi Postgres dit qu'il ne trouve pas le fichier dans /pgdata/PG_MD2_DEV/archive_xlog/000000020000000000000011 ?

#3 Réplication » Standby serveur ne trouve pas le fichier wal : cp: cannot stat » 04/04/2014 10:46:26

JeanL
Réponses : 5

Bonjour,

Mon serveur master et standby  est en 9.3.4 sous CentOS 6.5
La config du master est :
wal_level = hot_standby                 # minimal, archive, or hot_standby
archive_mode = on               # allows archiving to be done
archive_command = 'rsync -ahv %p standbyhost:/pgdata/PG_MD2_DEV/archive_xlog/%f'

La config du standby est :
wal_level = hot_standby                 # minimal, archive, or hot_standby
archive_mode = off               # allows archiving to be done
archive_command = 'rsync -ahv %p standbyhost:/pgdata/PG_MD2_DEV/archive_xlog/%f'

Le recovery.conf du standby est:
standby_mode = 'on'
primary_conninfo = 'host=masterhost port=5432 user=repliuser password=XXX'
trigger_file = '/pgdata/PG_MD2_DEV/data/trigger_failover.txt'
restore_command = 'cp -p /pgdata/PG_MD2_DEV/archive_xlog/%f "%p"'
archive_cleanup_command = 'pg_archivecleanup /pgdata/PG_MD2_DEV/archive_xlog %r'


Le rync fonctionne bien.

Quand je démarre mon standby, j'ai cette erreur dans la log
2014-04-04 10:24:47 CEST [8181]: [4-1] LOG:  database system is ready to accept read only connections
cp: cannot stat `/pgdata/PG_MD2_DEV/archive_xlog/000000020000000000000011': No such file or directory

Le fichier /pgdata/PG_MD2_DEV/archive_xlog/000000020000000000000011 n'existe pas :
ls: cannot access /pgdata/PG_MD2_DEV/archive_xlog/000000020000000000000011: No such file or directory

Puisqu'il a été copié dans /pgdata/PG_MD2_DEV/data/pg_xlog par la commande restore_command :
ls -l /pgdata/PG_MD2_DEV/data/pg_xlog/000000020000000000000011
-rw------- 1 postgres postgres 16777216 Apr  4 10:24 /pgdata/PG_MD2_DEV/data/pg_xlog/000000020000000000000011


Pouvez-vous m'aider à comprendre cette erreur et quelle action faut-il mener pour ne plus l'avoir ou alors on peut l'ignorer ?

Je vous remercie par avance de votre aide.

Jean

#4 Re : Optimisation » Utilisation PgBadger » 21/03/2014 15:56:06

J'ai téléchargé et installé la version 5.0. Elle arrive à lire les fichiers que pgbadger 2.2 n'arrivait pas à lire avant.

Merci beaucoup Julien.

Bon weekend.

#5 Re : Optimisation » Utilisation PgBadger » 21/03/2014 12:11:42

Bonjour,

J'utilise pgbadger 2.2.1. J'ai des logs qui passent bien et d'autres qui génèrent des erreurs.

Voici un exemple d'un fichier de log qui passe bien :
$PGBADGER_DIR/pgbadger postgresql-2014-03-20_000000.log
[========================>] Parsed 3634018 bytes of 3634018 (100.00%), queries: 312, events: 1659


Voici un exemple d'un fichier de log qui génère une erreur :
$PGBADGER_DIR/pgbadger postgresql-2014-03-19_000000.log
FATAL: unable to detect log file format from postgresql-2014-03-19_000000.log, please use -f option.

J'utilisais la version 9.3.3 jusqu'à ce matin où j'ai migré en 9.3.4.

Je vous remercie par avance de votre aide.

Pied de page des forums

Propulsé par FluxBB