Advanced Replication Guide : Getting started with data synchronization - evaluation setup : Configuring the servers and creating the publications : Configuring the replica database
  
Configuring the replica database
Configuring the replica database for the evaluation setup includes the following steps: creating a catalog and registering the replica to the master using the system stored procedure SYNC_REGISTER_REPLICA, creating a table to hold the replicated data, and registering the replica database to the publication using the system stored procedure SYNC_REGISTER_PUBLICATION.
The SQL statements that are needed to configure the replica database are provided in the replica1.sql sample script below.
Fast path: If you are using the working directories and sample scripts in the samples\replication\ directory, go the solidDB® installation root directory and issue the following command:
./bin/solsql -O eval.out "tcp 1316" dba dba_password ./samples/ replication/eval_setup/replica1.sql
where:
-O eval.out is an optional parameter that defines the output file for results.
"tcp 1316" is the network protocol and address of the master server. You may have to customize this part of the command.
dba and dba_password are username and password respectively.
replica1.sql is the executed SQL script.
You can view the results in eval.out with any text editor.
You might need to make changes to the following areas in the script:
In the call to SYNC_REGISTER_REPLICA() you might have to specify a different user id and password for connecting to the master database for the first time.
In the call to SYNC_REGISTER_REPLICA() you might have to set the master database's connection string to a different value from 'tcp localhost 1315'.
Note When you execute the advanced replication scripts, you must set the autocommit mode OFF. If you are using the solidDB® SQL Editor (solsql), the autocommit mode is set OFF by default.
Sample script: replica1.sql
--*******************************************************
-- replica1.sql
-- Initialize a replica database with node name
-- "replica_node_01".
-- (Each replica must have a unique node name.)
-- Execute this script in the REPLICA database.
-- NOTE: AUTOCOMMIT must be set off for MESSAGE handling!
--*******************************************************
-- Create a replica catalog named ’sync_demo_catalog’ and
-- register it with the master database server called
-- ’master_node’. Also, specify the network address and name of the
-- master node, and specify the user ID and password to use.
CALL SYNC_REGISTER_REPLICA (
  ’replica_node_01’,
  ’sync_demo_catalog’,
  ’tcp localhost 1315’, -- Master’s net address. CUSTOMIZE
  ’master_node’, -- Node name of master.
  ’dba’,
  ’dba_password’);
COMMIT WORK;

SET CATALOG sync_demo_catalog;
COMMIT WORK;

-- Create the table.
CREATE TABLE SYNCDEMO (
  REPLICAID INTEGER NOT NULL,
  ID INTEGER NOT NULL,
  STATUS INTEGER NOT NULL,
  INTDATA INTEGER,
  TEXTDATA CHAR(30),
  UPDATETIME TIMESTAMP,
  PRIMARY KEY (REPLICAID, ID, STATUS)
);
-- Enable the use of incremental publications for this table.
ALTER TABLE SYNCDEMO SET SYNCHISTORY;
COMMIT WORK;
-- Register a publication that is already defined in the master.
CALL SYNC_REGISTER_PUBLICATION (
  ’sync_demo_catalog’,
  ’pub_demo’);
COMMIT WORK;
For more information about the stored procedures SYNC_REGISTER_REPLICA and SYNC_REGISTER_PUBLICATION, see the solidDB® SQL Guide.
See also
Configuring the servers and creating the publications