Simply say two words: Prerequisites: There is a source code of PostgreSQL and compile (not installed). Steps: 1, first download this: http://laser.dyndns.zhengmai.net.cn/download/slony1-1.0.2.tar.gz Decomposed, there is a Slony1-1.0.2 directory.
2, enter this directory, configure --with-pgsourcetree =
Public.history ', key = "column", comment =' table history '); # 存 主 主 从 从 信息 信息 #;;;;;;;;;;;;;;; (4 Is the main point of connection parameters Store Path (Server = 1, Client = 2, Conninfo = 'DBNAME = $ dbname1 host = $ host1 user = $ slony_user'); # below is the connection parameters of the node (Server = 2, Client = 1, connInfo = 'dbname = $ dbname2 host = $ host = $ pgbench_user'); # Settings the role in the copy, the main node is the original provider, from the node is the recipient Store Listen (Origin = 1, provider = 1 , Receiver = 2); Store Listen (ORIGIN = 2, provider = 2, receiver = 1); _ EOF_5, then execute this script, can get the authentication problem under any database users. 6. Run commands on the source library (primary server): SLON "Your Cluster" "DBNAME =" Source Database Required Copy "User =" Source Library Database Super User Name "& 7, in the destination library (from the server Run the command: SLON "Your cluster name" "DBNAME =" Destination database you need to copy "User =" Source Library Database Super User Name "& 8, submit the copy set, you can use the following script: #! / Bin / shcluster = "Your cluster name, free" DBNAME1 = "Source database you need to copy" DBNAME2 = "Destination database you need to copy" Host1 = "source library IP or host name" Host2 = "destination IP or host name" SLONY_USER = "Source Library Database Super User Name" pgbench_user = "Source Library User Name, Nothing Use" Slonik << _ EOF_ # ---- # this defines Which namespace the replication system users # ---- Cluster Name = $ cluster ; # supply connection parameters node 1 admin conninfo = 'dbname = $ DBNAME1 host = $ HOST1 user = $ SLONY_USER'; node 2 admin conninfo = 'dbname = $ DBNAME2 host = $ HOST2 user = $ PGBENCH_USER'; # submitted copy sets subscribe Set (id = 1, provider = 1, receiver = 2, forward = no); _ EOF_SLONY1 is a replication technology made based on PostgreSQL's asynchronous notification mechanism, which is very fast, and the result I test is near real. At present, my BBS uses this replication technology to make backups, huh, in addition to the conflict, very easy to use! Because of the time relationship, more complex hierarchy copies we will talk later. Slony's own document is not old. I've been busy recently.