Par mxltx le 07/08/2008 - 18:07
Bonjour la communauté,
j'essaye de faire une replication simple (Master / Slave) avec slony-I (slon version 1.2.1-1).
J'ai deux serveurs identique sgmtest01 et sgmtest02 (tous les deux sous Debian Etch).
- J'ai installé via 'apt-get' la liste ci-dessous sur chaqu'un :
root@sgmtest01:~# dpkg -l
ii postgresql-8.1 8.1.11-0etch1 object-relational SQL database, version 8.1
ii postgresql-8.1-slony1 1.2.1-1 replication system for PostgreSQL
ii postgresql-client-8.1 8.1.11-0etch1 front-end programs for PostgreSQL 8.1
ii postgresql-client-common 71 manager for multiple PostgreSQL client versi
ii postgresql-common 71 manager for PostgreSQL database clusters
ii slony1-bin 1.2.1-1 replication system for PostgreSQL
ii slony1-doc 1.2.1-1 Slony-I documentation
***Configuration postgres***
- j'ai bien configuré mes fichiers 'pg_hba.conf', et 'postgresql.conf'
- créé des utilisateurs de replication sur les deux serveurs
- Création d'une base ( + plpgsql language)
- Dumper la base sur le slave
***Configuration slony***
Je me suis créé 3 fichiers : init_cluster.slnk :
##### INIT CLUSTER
cluster name = replication;
node 1 admin conninfo='host=172.16.1.93 dbname=contactdb user=contactuser port=5432 password=contactuser';
node 2 admin conninfo='host=172.16.1.94 dbname=contactdb_slave user=contactuser port=5432 password=contactuser';
init cluster (id = 1, comment = 'Node 1 - contactdb@172.16.1.93');
# STORE NODE
store node (id = 2, event node = 1, comment = 'Node 2 - contactdb_slave@172.16.1.94');
echo 'Set up replication nodes';
# STORE PATH
echo 'Next: configure paths for each node/origin';
echo 'Replication nodes prepared';
echo 'Please start a slon replication daemon for each node';
#####
un fichier : create_set.slnk :
#####cluster name = replication;
node 1 admin conninfo='host=172.16.1.93 dbname=contactdb user=contactuser port=5432 password=contactuser';
node 2 admin conninfo='host=172.16.1.94 dbname=contactdb_slave user=contactuser port=5432 password=contactuser';
# TABLE ADD KEY
# CREATE SET
try {
create set (id = 1, origin = 1, comment = 'Set 1 for replication');
} on error {
echo 'Could not create subscription set 1 for replication!';
exit -1;
}
# SET ADD TABLE
echo 'Subscription set 1 created';
echo 'Adding tables to the subscription set';
set add table (set id = 1, origin = 1, id = 1,
full qualified name = 'public.contact',
comment = 'Table public.contact with primary key');
echo 'Add primary keyed table public.contact';
# SET ADD SEQUENCE
echo 'Adding sequences to the subscription set';
set add sequence (set id = 1, origin = 1, id = 1,
full qualified name = 'public.contact_seq',
comment = 'Sequence public.contact_seq');
echo 'Add sequence public.contact_seq';
echo 'All tables added';
####
un fichier : subscribe_set.slnk
####
cluster name = replication;
node 1 admin conninfo='host=172.16.1.93 dbname=contactdb user=contactuser port=5432 password=contactuser';
node 2 admin conninfo='host=172.16.1.94 dbname=contactdb_slave user=contactuser port=5432 password=contactuser';
try {
subscribe set (id = 1, provider = 1, receiver = 2, forward = yes);
}
on error {
exit 1;
}
echo 'Subscribed nodes to set 1';
####
Je n'ai pas d'erreur quand je passe ces trois fichier en argument a slonik.
1)
root@sgmtest01:/etc/slony1/toolkit# slonik < init_cluster.slnk
:10: Set up replication nodes
:13: Next: configure paths for each node/origin
:14: Replication nodes prepared
:15: Please start a slon replication daemon for each node
2)
root@sgmtest01:/etc/slony1/toolkit# slonik < create_set.slnk
:16: Subscription set 1 created
:17: Adding tables to the subscription set
:21: Add primary keyed table public.contact
:24: Adding sequences to the subscription set
:28: Add sequence public.contact_seq
:29: All tables added
3)
root@sgmtest01:/etc/slony1/toolkit# slonik < subscribe_set.slnk
:10: Subscribed nodes to set 1
Mais je n'arrive pas a starter le process de replication :
lorsque je start le process sur le Master :
root@sgmtest01:/etc/slony1/toolkit# slon_start --config /usr/local/etc/slon_tools.conf 1
Invoke slon for node 1 - /usr/bin/slon -p /var/run/slony1/node1.pid -s 1000 -d2 replication 'host=172.16.1.93 dbname=contactdb user=contactuser port=5432 password=contactuser' >>/var/log/slony1/node1-contactdb.log 2>&1
Slon successfully started for cluster replication, node node1
PID [23807]
Start the watchdog process as well...
root@sgmtest01:/etc/slony1/toolkit# Invoke slon for node 1 - /usr/bin/slon -p /var/run/slony1/node1.pid -s 1000 -d2 replication 'host=172.16.1.93 dbname=contactdb user=contactuser port=5432 password=contactuser' >>/var/log/slony1/node1-contactdb.log 2>&1
Mais voici les log qui demontrent que le service n'est pas up :
root@sgmtest01:/# tail -f /var/log/slony1/node1-contactdb.log
HINT: No function matches the given name and argument types. You may need to add explicit type casts.
2008-08-07 17:24:12 CEST ERROR please upgrade Slony-I shared module to version 1.2.1
2008-08-07 17:24:12 CEST FATAL main: Node has wrong Slony-I schema or module version loaded
2008-08-07 17:24:12 CEST DEBUG2 slon_abort() from pid=24007
2008-08-07 17:24:12 CEST DEBUG1 slon: shutdown requested
2008-08-07 17:24:12 CEST DEBUG2 slon: notify worker process to shutdown
2008-08-07 17:24:12 CEST DEBUG2 slon: child terminated status: 0; pid: 24007, current worker pid: 24007
2008-08-07 17:24:12 CEST DEBUG1 slon: done
2008-08-07 17:24:12 CEST DEBUG2 slon: remove pid file
2008-08-07 17:24:12 CEST DEBUG2 slon: exit(0)
root@sgmtest01:~# tail -f /var/log/slony1/slon-contactdb-node1.err
WATCHDOG: You ought to check the postmaster and slon for evidence of a crash!
WATCHDOG: I'm going to restart slon for node1...
WATCHDOG: Restarted slon for the replication cluster, PID
WATCHDOG: No Slon is running for node node1!
WATCHDOG: You ought to check the postmaster and slon for evidence of a crash!
WATCHDOG: I'm going to restart slon for node1...
WATCHDOG: Restarted slon for the replication cluster, PID 23932
WATCHDOG: No Slon is running for node node1!
WATCHDOG: You ought to check the postmaster and slon for evidence of a crash!
WATCHDOG: I'm going to restart slon for node1...
WATCHDOG: Restarted slon for the replication cluster, PID
WATCHDOG: No Slon is running for node node1!
WATCHDOG: You ought to check the postmaster and slon for evidence of a crash!
WATCHDOG: I'm going to restart slon for node1...
WATCHDOG: Restarted slon for the replication cluster, PID 23983
WATCHDOG: No Slon is running for node node1!
WATCHDOG: You ought to check the postmaster and slon for evidence of a crash!
WATCHDOG: I'm going to restart slon for node1...
slon_kill
slon_kill.pl... Killing all slon and slon_watchdog instances for the cluster replication
1. Kill slon watchdogs
slon_watchdog for cluster replication killed - PID [23818]
2. Kill slon processes
No slon processes found
lorsque je start le process sur le Master avec :
root@sgmtest01:/etc/slony1/toolkit# slon replication "dbname=contactdb user=contactuser password=contactuser host=172.16.1.93"
2008-08-07 17:35:53 CEST CONFIG main: slon version 1.2.1 starting up
2008-08-07 17:35:53 CEST DEBUG2 slon: watchdog process started
2008-08-07 17:35:53 CEST DEBUG2 slon: watchdog ready - pid = 28470
2008-08-07 17:35:53 CEST DEBUG2 slon: worker process created - pid = 28471
2008-08-07 17:35:53 CEST ERROR cannot get Slony-I module version - ERROR: function _replication.getmoduleversion() does not exist
HINT: No function matches the given name and argument types. You may need to add explicit type casts.
2008-08-07 17:35:53 CEST ERROR please upgrade Slony-I shared module to version 1.2.1
2008-08-07 17:35:53 CEST FATAL main: Node has wrong Slony-I schema or module version loaded
2008-08-07 17:35:53 CEST DEBUG2 slon_abort() from pid=28471
2008-08-07 17:35:53 CEST DEBUG1 slon: shutdown requested
2008-08-07 17:35:53 CEST DEBUG2 slon: notify worker process to shutdown
2008-08-07 17:35:53 CEST DEBUG2 slon: child terminated status: 0; pid: 28471, current worker pid: 28471
2008-08-07 17:35:53 CEST DEBUG1 slon: done
2008-08-07 17:35:53 CEST DEBUG2 slon: exit(0)
Sur le slave c'est la meme chose :
slon_start --config /usr/local/etc/slon_tools.conf 2
me genere les memes erreurs.
Avez-vous deja eu ce probleme avec une config similaire ??
Comment resoudre ce problme ??
Peut-on mettre a jour slony, sans toucher a postgres 8.1 (packagé debain - Etch).
Mes fichiers 'slon_tools.conf' sont identiques sur les deux serveurs (Master & Slave) est ce normal ??
Bref, il faut que cette solution libre de replication fonctionne.
Ca ne peut pas se passer autrement...
Bien a vous,
Mxltx