solidDB Help : Replication : Advanced Replication : Getting started with Advanced Replication: an evaluation setup : Configuring the replica database
  
Configuring the replica database
Configuring the replica database for the evaluation setup involves the following steps:
creating a catalog by using the system stored procedure SYNC_SETUP_CATALOG, see SYNC_SETUP_CATALOG,
registering the replica database to the master database by using the system stored procedure SYNC_REGISTER_REPLICA, see SYNC_REGISTER_REPLICA,
creating the table (as created in the master database) to hold the replicated data,
registering the replica database to the publication by using the system stored procedure SYNC_REGISTER_PUBLICATION, see SYNC_REGISTER_PUBLICATION.
The SQL statements that are needed to configure the replica database are provided in the following sample script.
Sample script: replica1.sql
If you are using the working directories and sample scripts in the samples\smartflow\ directory, go the solidDB installation root directory and run the following command:
./bin/solsql -O eval.out "tcp 1316" dba dba_password ./samples/ smartflow/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 database server. You might have to customize this part of the command,
dba and dba_password are user name 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 connection string to a different value from 'tcp localhost 1315'.
Note When you execute the Advanced Replication scripts, you must set the autocommit mode to OFF. If you are using the solidDB SQL Editor (solsql), the autocommit mode is set to OFF by default.
--*******************************************************
-- replica1.sql
-- Initialize a replica database with server name
-- "replica_server_01".
-- (Each replica must have a unique server 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_server'. Also, specify the network address and name of
-- the master server, and specify the user ID and password to use.
CALL SYNC_REGISTER_REPLICA (
  'replica_server_01',
  'sync_demo_catalog',
  'tcp localhost 1315', -- Master's net address. CUSTOMIZE
  'master_server', -- Server 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;
Go up to
Getting started with Advanced Replication: an evaluation setup