/[rserv]/doc/eRserver.HOWTO
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /doc/eRserver.HOWTO

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Tue Aug 5 13:34:03 2003 UTC (20 years, 10 months ago) by dpavlin
Branch: MAIN
Changes since 1.1: +8 -1 lines
added author and full URL

1 dpavlin 1.1
2     Nélio Alves Pereira Filho
3     nelio@ime.usp.br
4    
5     +-------------------------------------------------------------------------+
6     | Como Criar um ambiente de replicação rserv |
7     +-------------------------------------------------------------------------+
8    
9     Antes de qualquer coisa, os arquivos contidos no pacote do rserv desta
10     desta documentação devem ser copiados para seus respectivos lugares. Por
11     exemplo,
12     /bin/* -> /usr/lib/postgresql/bin/
13     /share/RServ.pm -> /usr/lib/postgresql/share/contrib/
14     /lib/rserv.so -> /usr/lib/postgresql/lib/
15    
16     A documentação dos programas extras criados encontram-se no arquivo
17     eRserver.Changelog.
18    
19    
20    
21 dpavlin 1.2 from: http://techdocs.postgresql.org/
22    
23     HOWTO: Setting up RServ with PostgreSQL 7.0.3
24     Last updated 13th September 2001
25     by S.Gopi
26    
27     http://techdocs.postgresql.org/techdocs/settinguprserv.php
28    
29 dpavlin 1.1
30    
31     *** Creating the Master Database
32     (You can skip this if you already have one)
33    
34     createdb master
35    
36     Then create whatever tables you want in this Master database (required),
37     and any records you want (optional).
38    
39     Let us go with pg_dump because Replication will happen only if table
40     structures and record entries (if any) are similar for both master and
41     slave databases at initial stage, otherwise it gives error while Replicating.
42    
43     pg_dump -d master -f master.dump
44    
45    
46     *** Creating the Slave Database
47    
48     First we create the slave database then restore the table structures
49     and records from the dump we created in the previous step.
50     createdb slave
51     psql slave
52    
53     slave=$ \i master.dump
54     slave=$ \q (quit from psql)
55    
56     After setting up both the Master and Slave Databases lets get into setting
57     up the Replication process.
58    
59    
60     *** Setting up Replication Process
61    
62     There are Four Steps you must carry out before starting Replication
63    
64     + Step 1: Initializing Master Database for Replication
65     + Step 2: Initializing Slave Database for Replication
66     + Step 3: Adding Tables and Columns that needs to be Replicated in
67     Master Database
68     + Step 4: Adding Tables and Columns that needs to be Replicated in
69     Slave Database
70     These must be same as Master Database.
71    
72    
73     Step 1: Initializing Master Database for Replication
74    
75     From the Command line execute :
76    
77     /usr/lib/postgresql/bin/MasterInit master
78    
79     This Process will create necessary tables and sequences used by Replication
80     process in Master database. These tables are used by the Replication process
81     for keeping track of replication.
82    
83    
84     Step 2: Initializing Slave Database for Replication
85    
86     From the Command line execute :
87    
88     /usr/lib/postgresql/bin/SlaveInit slave
89    
90     This process will create necessary tables in slave database, according to the
91     author of RServ these are used for book keeping information (I don't know for
92     what purpose these are used).
93    
94    
95     Step 3: Adding Tables and Columns that needs to be Replicated in Master
96     Database
97    
98     From the Command line execute :
99    
100     /usr/lib/postgresql/bin/MasterAddTable master table_name column_name
101    
102     This will add necessary entries in rserv tables in master database. Only
103     tables which are added in this way will be replicated into mirror database.
104    
105     You can give a specific column name in the table, there is no restriction
106     on this in this version (0.1), athough the author's document says only this
107     column will be replicated. Useful Bug !!! :-) Any column changed in the
108     table will be properly updated in the master database.
109    
110     Repeat the above step for all the tables in master for which you want
111     mirroring (real painful job)
112    
113    
114     Step 4: Adding Tables and Columns that needs to be Replicated in Slave Database
115    
116     From the Command line execute :
117    
118     /usr/lib/postgresql/bin/SlaveAddTable slave table_name column_name
119    
120     These tables and columns must be same as you did for master database (I don't
121     know what will happen if you change something, you can test this functionality
122     if you have time. Just remember this is version 0.1 ;-))
123    
124     Repeat the above step for all the tables in slave for which you want
125     mirroring (another painful work)
126    
127    
128     Then what?......
129    
130     You can start doing the replication now,
131    
132     /usr/lib/postgresql/bin/Replicate master slave
133    
134     That's it! You have done it... As a test, update some records in the master
135     database (add, modify, delete), then do the replication and check the Slave
136     database, it must be a mirror of the Master. If not check all the above
137     process again and still nothing works out just email me.
138    
139     Whenever You want to replicate just execute the command :
140    
141     Replicate master slave
142    
143     Note:
144     After executing the Replicate command just ensure a "__Snapshot" file of 0
145     bytes doesn't exist either in /usr/local/pgsql/bin/ or in your current
146     directory.
147    
148     When I checked, this file gets created only if the replication process fails
149     for some reason (even if the program didn't show up any error messages,
150     remember this is version 0.1)
151    
152     P.S.
153    
154     RServ is very easy to use once you have created the appropriate structures
155     (that is the big task).RServ is just in its infancy and it may be buggy, so
156     use it at your own risk. For example, just try this :
157     Without doing MasterAddTable and SlaveAddTable try doing Replicate it will
158     return without any error messages with no actual mirroring.
159    
160     Now, do the MasterAddTable and SlaveAddTable process then try with Replicate
161     this time it does replication but original entries in slave database
162     (before SlaveAddTable entries) will never get updated, or some other crap
163     will happen!! Try updating some entries in master database and then
164     replication you will go with surprises...
165    
166     Enjoy...

  ViewVC Help
Powered by ViewVC 1.1.26