15.19. EDB-Replication Support

EDB Studio also has built in support for the following EDB-Replication specific tasks.

Let us walk through an example showing this functionality. Before you can proceed with the example you need to start up instances of edb-postmaster on both the master and slave nodes.

15.19.1. Step 1 - Start up and connect to EDB instances

Please start instances of edb-postmaster on both the master and slave nodes(s). Once this is done start up EDB-Studio and connect to both the master and slave nodes.

15.19.2. Creating an EDB-Replication Cluster on Master and Slave Node(s)

In order to create a new EDB-Replication cluster right click on the Replication node as shown in the screenshot below.

Carry out this step first on the Replication node on the master (with "Join existing cluster" option unchecked) and then on the Replication node on the slave (with "Join existing cluster" option checked). Once you click on the "New EDB-Replication cluster" option you will be presented with the following screenshot:

Type in a name for the cluster you wish to create under the "Cluster Name" textbox. Make sure for each node that you create a cluster under you assign a unique Node For each slave node please choose the "Join existing cluster" option. This will automatically determine the Server, Database and Cluster Name. You will just need to assign a unique Node ID against all nodes within a cluster. This step is shown in the following screenshot.

Here the Admin Node is typically used to specify the master node, and is optional to fill out.

15.19.3. Creating Replication Set

Once an EDB-Replication cluster is in place we need to create replication set(s) on the master node. A replication set specifies a set of tables and sequences that we wish to make part of our replication process. Please note that a replication set is always specified on the Master Node. In order to create it right click on the replication node under which you wish to create this set. After which you would be presented with the following options:

Choose the "New Replication Set" option and fill out the options in the dialog box that opens up. This step is shown in the screenshot below:

Once this is done, you are ready to add tables and sequences to this replication set. This is shown in the following step.

15.19.4. Adding Tables and Sequences to your Replication Set

In order to add tables and sequences to an existing replication set, right click on the node of that replication set where you should scroll down to the following option:

For this example let us add the sample edb tables of emp, dept and jobhist by choosing the "Add Table" option. You will be presented with the following screenshot, where all the user tables not part of the current replication set in the current database are pre-populated in the tables dropdown.

15.19.5. Specifying Path/Connectivity Information

Next you need to specify the path/connectivity information on both the master and slave nodes. In order to do this right click on the "Path" node and choose the "New Path" option to specify a path from the master to all slaves and from all slaves to the master.

On the master specify the connectivity information for each of the slaves. The following screenshot shows the addition of one slave node to a master.

On each of the slaves specify the connectivity information for each of the other cluster nodes that this node will be connected with. The following screenshot shows the path information through which a slave node will be connected to a master node.

15.19.6. Start up EDB-Replication Instances

Now start up instances of "edb-replication" on both the master and slave node(s). Start up the master node with the following information:

	  
	--
	edb-replication $CLUSTERNAME "dbname=$MASTERDBNAME host=$MASTERHOST port=$MASTERDBPORT user=$REPLICATIONUSER"
	
	

And start up the slave node with the following command arguments:

	  
	--
	edb-replication $CLUSTERNAME "dbname=$SLAVEDBNAME host=$SLAVEHOST port=$SLAVEDBPORT user=$REPLICATIONUSER"
	
	

Please note all the variables prepended with the $ are shell variables which you can specify in your

/etc/profile

file and where:

  
	--
$CLUSTERNAME = Name of the EDB-Replication cluster you wish to replicate against (_edb_replication_example for this example)

$MASTERDBNAME = Name of the database on the master node (edb_master in this examples)

$MASTERHOST = Name of master node

$MASTERDBPORT = Port on which the edb-postmaster instance on the master is running

$SLAVEDBNAME = Name of the database on the slave node (edb_slave in this examples)

$MASTERHOST = Name of slave node

$MASTERDBPORT = Port on which the edb-postmaster instance on the slave(s) is running
	

Please read the EDB-Replication chapter for more information on this.

Once edb-replication instances are running on the master and all the slave(s) nodes, we must create the subscription on the master node to specify what slave(s) are to subscribe to which set(s) on the master.

15.19.7. Creating a Subscription on the Master

You must create a subscription against one or more replication sets before data is replicated across all the slave node(s). You can create a new subscription in EDB-Studio by right clicking on the "Subscriptions" node and choosing the "New Subscription" option as shown in the following screenshot

Please note that you must only create the subscription on the master node and specify all the slave nodes that are to subscribe to this subscription. This is shown in the following screenshot:

Once the subscription is done, query the emp, dept and jobhist tables on the slave node(s), they should be populated with the data in the corresponding tables in the master node.