/[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.1 - (hide annotations)
Tue Aug 5 09:52:38 2003 UTC (20 years, 9 months ago) by dpavlin
Branch: MAIN
rserv 0.2 changes by Nélio Alves Pereira Filho

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

  ViewVC Help
Powered by ViewVC 1.1.26