Create a Virtuoso RDF Graph Replication slave Subscriber node from a master Publisher node.
If the master Publisher node is known to contain the current state of the database, Subscriber nodes can be created from a copy of it such that they start from this known good state and keep in sync from that point forward. This could be in the cases of a subscriber failing and needing to be rebuilt or if a new Subscriber node needs to be added the Farm (note this could also be done from a copy of a subscriber node if know to be in sync with the master Publisher).
rm virtuoso.db virtuoso.trx virtuoso.log virtuoso.pxa
delete from sys_repl_accounts; delete from sys_repl_subscribers; registry_remove ('DB.DBA.RDF_REPL'); shutdown();
repl_server ('MASTER', 'MASTER_DSN'); repl_subscribe ('MASTER', '__rdf_repl', 'dav', 'dav', 'dba', 'dba'); shutdown();
repl_sync_all (); DB.DBA.SUB_SCHEDULE ('MASTER', '__rdf_repl', 1);
status(); repl_stat();
There maybe occasions when Subscriber nodes are failing to sync with the master Publisher with errors of the following form being reported:
rep_stat()
command on it:
SQL> repl_stat(); server account level stat VARCHAR VARCHAR INTEGER INTEGER _______________________________________________________________________________ MASTER __rdf_repl 939 SYNCING SLAVE-1 SLAVE-1 0 OFF SQL>
__rdf_repl' is not valid ...
error in the database log file:
14:19:20 Subscriber 'SLAVE-1' for '__rdf_repl' is not valid (level 2, requested level 662)
Thus the replication level on the master Publisher needs to be verified and the Subscriber set to be one less than it using the database sequence_set() function as follows:
SQL> select repl_this_server(); repl_this_server VARCHAR _______________________________________________________________________________ MASTER 1 Rows. -- 1 msec. SQL>
SQL> select concat ('repl_', repl_this_server(), '_', '__rdf_repl'); concat VARCHAR _______________________________________________________________________________ repl_MASTER___rdf_repl 1 Rows. -- 1 msec. SQL>
SQL> select sequence_set ('repl_MASTER___rdf_repl', 0, 2); sequence_set VARCHAR _______________________________________________________________________________ 1685 1 Rows. -- 0 msec. SQL>
SQL> select sequence_set ('repl_MASTER___rdf_repl', 0, 2); sequence_set VARCHAR _______________________________________________________________________________ 939 1 Rows. -- 0 msec. SQL>
SQL> sequence_set ('repl_MASTER___rdf_repl', 1684, 0); Done. -- 0 msec. SQL>
SQL> select sequence_set ('repl_MASTER___rdf_repl', 0, 2); sequence_set VARCHAR _______________________________________________________________________________ 1684 1 Rows. -- 0 msec. SQL>
RS_VALID
column of the SYS_REPL_SUBSCRIBERS
table is set "1" and the RS_LEVEL
column is set to one less than the replication level of the subscriber:
SQL> select * from SYS_REPL_SUBSCRIBERS; RS_SERVER RS_ACCOUNT RS_SUBSCRIBER RS_LEVEL RS_VALID VARCHAR NOT NULL VARCHAR NOT NULL VARCHAR NOT NULL INTEGER INTEGER _______________________________________________________________________________ MASTER __rdf_repl SLAVE-1 939 0 1 Rows. -- 49 msec. SQL>
RS_VALID
is "0" then set it to "1" and set the RS_LEVEL
column to one less than the replication level of the master Publisher as follows to activate replication from the slave subscriber node:
SQL> update SYS_REPL_SUBSCRIBERS set RS_LEVEL = 1684 , RS_VALID = 1 ; 0 Rows. -- 2 msec. SQL> SQL> select * from SYS_REPL_SUBSCRIBERS; RS_SERVER RS_ACCOUNT RS_SUBSCRIBER RS_LEVEL RS_VALID VARCHAR NOT NULL VARCHAR NOT NULL VARCHAR NOT NULL INTEGER INTEGER _______________________________________________________________________________ MASTER __rdf_repl SLAVE-1 1684 1 1 Rows. -- 49 msec. SQL>
repl_sync_all ();
IN SYNC
and that there are no occurrences of the __rdf_repl' is not valid ...
errors in the master Publisher database log.