Hi all, Now I have a new problem about slony-i and network failure.
I setup master node in PC1 with NIC1 = 192.168.1.226, NIC2 = 192.168.1.227 NIC1 is Microsoft Loopback Adapter and cannot access internet (no gateway) NIC2 is Realtek RTL8169/8110 Family Gigabit Ethernet NIC, and I access internet thought NIC2. Then I setup slave node in PC2 with NIC1 = 192.168.1.5 (only one nic) On PC1, I use pgAdminIII connect to 192.168.1.226 and 192.168.1.5. Next I configure slony-i for db_master and db_slave on master node and slave node. Create table "staff" in two databases. And they work well, no problem happen. I restart PC1 many time and no problem happen too. Next, I disable NIC2 = 192.168.1.227 and insert some record in db_master. And wait for minute. Next, I enable NIC2 = 192.168.1.227, using pgAdmin on PC1 to view table "staff" on slave node, but slave node cannot update data from master node. Then I wait 1 hours later, and I has the same error. Next I restart slony service but cannot fix this error. Next I restart computer and cannot fix this error too. Here is pg log files: http://www.nabble.com/file/p25676756/postgresql-2009-09-30_000000.log postgresql-2009-09-30_000000.log http://www.nabble.com/file/p25676756/postgresql-2009-09-30_103703.log postgresql-2009-09-30_103703.log http://www.nabble.com/file/p25676756/postgresql-2009-09-30_105055.log postgresql-2009-09-30_105055.log http://www.nabble.com/file/p25676756/postgresql-2009-09-30_135154.log postgresql-2009-09-30_135154.log http://www.nabble.com/file/p25676756/postgresql-2009-09-30_135449.log postgresql-2009-09-30_135449.log Please help me to solve this problem Thank you very much Bao Luc [email protected] Filip Rembiałkowski-3 wrote: > > 2009/9/28 Airbus380 <[email protected]> > >> >> Hi all, >> >> I used two databse with slony-i, they work well. db_master1 is a master >> node, and db_slave1 is a slave. >> >> In the both databse, I have a table call staff with following structure: >> >> CREATE TABLE staff >> ( >> id text NOT NULL, >> "name" text, >> age integer, >> CONSTRAINT staff_pkey PRIMARY KEY (id) >> ) >> WITH (OIDS=FALSE); >> ALTER TABLE staff OWNER TO postgres; >> >> > >> I test on windows xp, it is ok. >> >> Then I created one more databse, its name is db_center. >> >> My idea is: when slave have an operation - insert or update or delete >> then >> the operated record must be updated to db_center, so i create a trigger >> function as following: >> >> CREATE OR REPLACE FUNCTION process_staff_audit() RETURNS TRIGGER AS >> $staff_audit$ >> BEGIN >> IF (TG_OP = 'DELETE') THEN >> PERFORM dblink_exec('dbname=db_center port=5432 >> host=192.168.1.226 user=user1 password=user1', >> 'DELETE FROM staff WHERE id = ''' || >> OLD.id >> || ''';',false); >> RETURN OLD; >> ELSIF (TG_OP = 'UPDATE') THEN >> PERFORM dblink_exec('dbname=db_center port=5432 >> host=192.168.1.226 user=user1 password=user1', >> 'UPDATE staff SET "name" = ''' || NEW.name >> || ''', age = ''' || NEW.age >> || ''' WHERE id = ''' || NEW.id || ''';',false); >> RETURN NEW; >> ELSIF (TG_OP = 'INSERT') THEN >> PERFORM dblink_exec('dbname=db_center port=5432 >> host=192.168.1.226 user=user1 password=user1', >> 'INSERT INTO staff VALUES( ''' || NEW.id >> ||''', ''' || NEW.name ||''', >> ''' || NEW.age ||''');',false); >> RETURN NEW; >> END IF; >> RETURN NULL; -- result is ignored since this is an AFTER trigger >> END; >> $staff_audit$ LANGUAGE plpgsql; >> >> CREATE TRIGGER staff_audit >> AFTER INSERT OR UPDATE OR DELETE ON staff >> FOR EACH ROW EXECUTE PROCEDURE process_staff_audit(); >> >> I tested this trigger function on two database without slony-i, it worked >> well. >> But I used this trigger function on db_slave1 (using slony-i), it didn't >> work. >> >> >> > Triggers on replicated tables are disabled by Slony-I for slave nodes. > You would have to enable selected trigger explicitely, with STORE TRIGGER. > http://www.slony.info/documentation/stmtstoretrigger.html > > > > -- > Filip Rembiałkowski > JID,mailto:[email protected] > http://filip.rembialkowski.net/ > > _______________________________________________ > Slony1-general mailing list > [email protected] > http://lists.slony.info/mailman/listinfo/slony1-general > > -- View this message in context: http://www.nabble.com/Slony-I%2C-Slave-node-and-trigger-function-tp25639915p25676756.html Sent from the Slony-I -- General mailing list archive at Nabble.com. _______________________________________________ Slony1-general mailing list [email protected] http://lists.slony.info/mailman/listinfo/slony1-general
