Pages

Search

Loading

Friday, February 9, 2007

Database Replication ~ Slony-I Configuration in Windows XP

Describing database replication, postgresql replication, replication configuration, Slony-I configuration, Slony-I windows xp, replication performance, master slave replication, database performance, Slony-I in pgAdmin, asynchronous replication, replication and synchronization
Replication is a common thing for databases that require more performance. One of open source solution that can be used in replication is Slony-I. This system works with the concept of asynchronous data thus inconsistency between master and slave database. That is the consequences that must be accepted, but the positive thing is the performance of these systems can be inherently better for the data transmission process performed on a periodic basis so as not to burden the system as a whole (there is a choice between functionality and performance, it is difficult to get both).
 
Thus the terms of its function in replication or synchronization better way synchronous (real time), but on the other hand it brings the performance can be worse than asynchronous (all clusters should have the same status, thereby monitoring can be done simultaneously so that any system as a whole).
 
In this process we will use PostgreSQL 8.3.3.1 equipped with the Application Stack Builder for Slony-I. The assumption is that we are able to run PostgreSQL and Slony-I applications can already properly installed on the computer. The next step is:
 
1. Decide who will be creating a database replication, eg database 'master_replikasi'.
 
2. Backup database and extract it on a computer database that will be used as a slave. If we want just a test, the extract can be performed on the same computer with a different database name, if so advised to use an easier way is to create a new database using the template 'master_replikasi'. In this way we can create a new database with the scheme and the exact same content with 'master_replikasi'.
 
3. Check the status of Slony-I path to the pgAdmin, this can be done by selecting File menu → Options → General, Slony-I should have been filled the path to the directory where Slony-I is installed. As a suggestion, Slony-I should be installed in the same directory with the PostgreSQL database. If the path Slony-I is not configured then you'll need to set the path in accordance with Slony-I is installed. If not then the pc can only join the existing cluster, but can not be used as the master node from a replication. For example, PostgreSQL is installed in the directory C: \ PostgreSQL and I install Slony-I in the same directory so I configure Slony-I path in C: \ PostgreSQL \ 8.3 \ share.
 
4. Select the database to be used as a master in the replication.
 
5. In the Replication, right-click and select New Slony-I cluster ...
 
6. Today we will make a master of the replication, so we must fill Cluster cluster name with the name we will create a cluster of replication, for example ReplDB. Then we fill the node with Local 1, Master (the first field is numeric, the second field is the character / comments on these nodes). Then we fill all the Admin nodes with 9999, pgAdmin (maximum is 9999 nodes, is used as a node for pgAdmin). Then click OK.
 
7. Slony-I configuration with the command line to the directory where Slony-I is installed, eg C: \ PostgreSQL \ 8.3 \ bin. Enable service Slony-I with the command: slon-regservice Slony-I, the Slony-I service will be at the service that can be run by the operating system. Then create a file, for example master.repl.conf, and edit the file and fill with data as follows:
 
cluster_name='ReplDB'
conn_info='host=127.0.0.1 port=5432 user=postgres dbname=master_replikasi'
 
Data on the cluster means is the name that will be made 'ReplDB' and the connection information for these clusters. Since we will make the replication to 1 master and 1 slave then we have to make 1 piece of configuration files for the slave, for example slave.repl.conf, and edit the file and fill with data as follows:
 
cluster_name='ReplDB'
conn_info='host=127.0.0.1 port=5432 user=postgres dbname=slave_replikasi'
 
Here Slony-I will walk in 1 computer (for testing) so that the host to the slave using the same address with the master. For the name of the database we use slave_replikasi.
 
8. Then we register each and every engine to be used in accordance with the replication of configuration files that we created earlier.
 
slon -addengine Slony-I C:\PostgreSQL\8.3\data\master.repl.conf
slon -addengine Slony-I C:\PostgreSQL\8.3\data\slave.repl.conf
 
At this time engine has been registered but not activated.
 
9. Then the slave database, the Replication section for a replication configuration for the slave, to slave you must select Join existing cluster sign, then comes the choice of all the servers listed in pgAdmin. Select a location server and database, when you've selected the database in question will display the name of the cluster (see cluster name). Fill in the Local node with 2, First Slave (first field second field 1 and First slave).
 
10. Then fill the path for each node on each database involved in the replication cluster. For example for the Master node, create a path to the Server name is 'First Slave' and Connect info is 'host = 127.0.0.1 port = 5432 user = postgres dbname = slave_replikasi'. Repeat this for all nodes in the cluster replication.
 
11. Replication Configuration Sets to choose the objects that will be included in the replication.
 
12. In addition, make sure that Slony-I service running as Administrator and give pgpass.conf in the folder Application Data \ PostgreSQL for the user. In previous experiments, the use of Slony-I is not using the administrator will have obstacles.
 
13. Run slony service and the database and see the results. Should any change in the input table (set) in the replication can be copied into the table of his slave.
Describing database replication, postgresql replication, replication configuration, Slony-I configuration, Slony-I windows xp, replication performance, master slave replication, database performance, Slony-I in pgAdmin, asynchronous replication, replication and synchronization

No comments: