APPENDIX D
Quick Start Tutorial


D.1 Introduction

This appendix gives out an example, which shows how to quickly setup and run a Replication Master Server. The example in this appendix uses a simple configuration, and performs a basic Replication Synchronization. This is not a complete guide for using Empress Replication. Refer to other chapters in Replication User's Guide for complete information on Replication Concepts, commands, Usage, Utilities and Administration.

This chapter provides a quick start on the following operations:

  1. Defining Master Table.
  2. Configuring and starting the Replication Master Server.
  3. Configuring Master table to publish data.
  4. Creating Replicate Table.
  5. Synchronizing Replication Replicate Table.
  6. View the Replication Tables and Synchronization Status
  7. Testing
  8. Stopping Replication Master Server

D.2 Defining Master Table

The following operations create a database table and define it as a master table, and insert some data in the master table to be propagated later to the replicate tables.

D.2.1 Create a Database

Create an Empress database TorontoDB:
   empmkdb TorontoDB

D.2.2 Create a Table in the Database

Create a table TorontoPList in TorontoDB:
 empcmd TorontoDB "create TorontoPList (\
      prod_id integer not null,  \
      prod_name character(20,1) not null, \
      prod_price float,\
      prod_lang character(20,1))"

D.2.3 Defining Master table

Change the type of the table TorontoPList to MASTER:
  empcmd TorontoDB "ALTER TABLE TorontoPList CHANGE TABLE TYPE TO MASTER"

D.2.4 Insert data into Master Table

Insert data into Master Table TorontoPList. These data will later be propagated to replicas of TorontoPList:
 empcmd TorontoDB "insert into TorontoPList values \
    (1, 'DB1', 4000, 'english') "
 empcmd TorontoDB "insert into TorontoPList values \
    (3, 'DB2', 7000, 'english') "

D.3 Configuring and Starting Replication Master Server

The following operations configure and start a Replication Master Server.

D.3.1 Configure a Replication Master Server

Configuring a Replication Master Server is optional. You can stay with the default settings, and yet start a Replication Master Server named emprepsv without doing any changes to the default configuration files. If you need to change any of the defaults, do the following:

D.3.2 Start the Replication Server Process

Start a Replication Server process called emprepsv using the start function of Empress Server Administration Utility empsvadm:
empsvadm emprepsv start
If the command is successful, it will notify with a message that indicates start the server, the type of the server being activated (in this case, replication master server), the spooler Process ID, and the Server and Client IDs.
Note:
emprepsv is the default name of the replication master server. If you changed the name of the server in previous step, you should use the new name that you have assigned. Also you should remember to change the emprepsv in the next steps to the name that you have assigned here.

D.4 Configuring Master Table to publish Data

This is to specify the tables that will be authorized to be replication replicate tables of the master table. Authorized tables are specified with their "Replicate-Side Access Information", which is a combination of their hostname, their database name, and their table Name.

Give authorization to a table named NewYorkPList, in a database called NewYorkDB, in a host specified by environment variable ${HOSTNAME}, to be able to create a relationship with the table TorontoPList in the database TorontoDB

    empcmd TorontoDB "CREATE REPLICATION REPLICATE \
        '`localhost`' : '`pwd`/NewYorkDB' : NewYorkPList \
        ON TorontoPList;"

D.5 Creating Replicate Table

Create the Replicate Table, to replicate the data from the Master Table created in the previous steps.

D.5.1 Create a Database

Create a Database called NewYorkDB
    empmkdb NewYorkDB

D.5.2 Create Replicate Table

Create Replicate Table NewYorkPList in the database NewYorkDB. This is going to be the replicate of the Master Table TorontoPList, A Replication Master Table (RMT) is accessed by its "Master-Side Access Information", which is a combination of a running Replication Master Server, the full path and name of the database and the table name of the RMT.
    empcmd NewYorkDB "CREATE REPLICATE NewYorkPList FROM \
        emprepsv:'`pwd`/TorontoDB':TorontoPList;"

D.6 Synchronize Replicaion Replicate Table

To synchronize a replicate table with its RMT, use the Replication Synchronization utility emprepsync. In this case it synchronizes the table NewYorkPList from database NewYorkDB with its RMT:
   emprepsync NewYorkDB NewYorkPList

D.7 View the Replication Table and Synchronization Status

The following commands show the structure and data of the Replication Tables and the synchronization status.

D.7.1 View Synchronization Status

View the table structure and synchronization status of master table TorontoPList:
   empcmd TorontoDB "display table TorontoPList  all;"

View the table structure and synchronization status of replicate table NewYorkPList:

   empcmd NewYorkDB "display table NewYorkPList  all;"

D.7.2 Check the contents of Replication Table

Check the contents of the Master Table TorontoPList:
   empcmd  TorontoDB "select * from TorontoPList;"

Check the contents of the Replicate Table NewYorkPList

   empcmd  NewYorkDB "select * from NewYorkPList;"

D.8 Testing

We repeat some of the operations above to test updates to the master table and its propagation to the replicate table.
  1. Insert data into RMT
     empcmd TorontoDB "insert into TorontoPList values \
        (2, 'DB1', 4000, 'japanese') "
     empcmd TorontoDB "insert into TorontoPList values \
        (4, 'DB2', 7000, 'japanese') "
    
  2. Synchronize RRT
      emprepsync NewYorkDB NewYorkPList
    
  3. View Synchronization Status
       empcmd TorontoDB "display table TorontoPList  all;"
    
       empcmd NewYorkDB "display table NewYorkPList  all;"
    
  4. Check the contents of Replication Table
       empcmd  NewYorkDB "select * from NewYorkPList;"
    

D.9 Stop the Replication Master Server

Perform the stop function of empsvadm utility to stop the server.
   empsvadm emprepsv stop 


Last Modification: March 23, 2000