/[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

Contents of /doc/eRserver.HOWTO

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations)
Tue Aug 5 13:35:58 2003 UTC (20 years, 8 months ago) by dpavlin
Branch: MAIN
CVS Tags: before_onlytables, before_multmaster, r_0_3, HEAD
Changes since 1.2: +4 -1 lines
warning about accuracy of this document

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

  ViewVC Help
Powered by ViewVC 1.1.26