Slony-i Dual-machine backup

Source: Internet
Author: User

Test environment: PostgreSQL 9.3.5,slony-i2.2.3 (Application stack Builder provides) the following reference online tutorials for your own test summary

--------------------------------------------------------------------------------------------------------------- --------

Main machine: 192.168.19.1 slave: 192.168.19.2

(Master and Slave) database name: postgres, user name: Postgres, Password: admin

-----------------------------------------------------ensure communication----------------------------------------------------------

1. Shut down the host and slave firewalls (or get through to 5432 ports, allowing through the firewall)

2. Modify the master-slave pg_hba.conf file, both of which are to ensure normal communication

# IPV4 Local connections:host    all             127.0.0.1/32            md5host all             192.168.19.0/24         trust//new Add Line

-----------------------------------------------------Configuring the Slave----------------------------------------------------------

1. Installing the slony-i2.2.3 on the slave machine

2. Enter%pg%/bin Run command slon-regservice to register the Slony-i service, which is visible in the Service column in Task Manager.

3. Under Add profile slony_slave.conf from the on-machine bin, go to%pg%/bin Run command slon-addengine slony_slave.conf

='user=postgres password=admin'

4. Open the Slony-i service in the Service column in Task Manager.

-----------------------------------------------------Configuring the Host----------------------------------------------------------

The first four steps are the same as the slave machine.

1. Install slony-i2.2.3 on the host

2. Enter%pg%/bin Run command slon-regservice to register the Slony-i service, which is visible in the Service column in Task Manager.

3. Under the host on the bin to add the configuration file slony_master.conf, enter the%pg%/bin Run command slon-addengine slony_master.conf

='dbname=postgres host=192.168.19.1 user=postgres password=admin'

4. Open the Slony-i service in the Service column in Task Manager.

5. Under the host on the bin to add the configuration file Master.script, enter the%pg%/bin Run command Slonik master.script

Cluster name = cluster; #指明要定义的Cluster名 Node 1 admin conninfo = ' dbname=postgres host=192.168.19.1 user=postgres password=admin '; Node 2 admin conninfo = ' dbname=postgres host=192.168.19.2 user=postgres password=admin '; init cluster (id = 1, comment = ' Master cluster '); #初始化Cluster, the ID starts from 1 in store node (id = 2, comment = ' Slave node ', event node=1); #定义从库节点 #定义路由路径 # Main node store path (Server=1, client=2, conninfo = ' dbname=postgres host=192.168.19.1 user=postgres password= Admin '); store path (server=2, client=1, conninfo = ' dbname=postgres host=192.168.19.2 user=postgres password=admin '); Add Event Listener # Sets the listening event and the subscription direction, replication in the role, the primary node is the original provider, the slave node is the recipient store listen (origin = 1, Provider = 1, receiver = 2); Store Listen (origin = 2, Provider = 2, receiver = 1); Create set (id = 1, origin = 1, comment = ' Data Provider '); #定义复制集, Origin indicates the main library set add table (Set id = 1, origin = 1, id = 1, fully qualified name = ' public. Point ', comment= ' point table '); #为复制集合中增加表, fully qualified name indicates the name of the table to be copied. SUBSCRIBE SET (ID = 1, PROVIDER = 1, RECEIVER = 2, FORWARD = YES); 

-----------------------------------------------------Configuration Complete----------------------------------------------------------

PgAdmin3 under the host can see, from the machine is similar to these things. Any changes made to the point table on the host now are also changed from the machine.

Note: The structure of the master-slave backup table is consistent, and the backup table must have a primary key or else an error occurs.

Slony-i Dual-machine backup

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.