-
Notifications
You must be signed in to change notification settings - Fork 339
/
postgres-9.5_repmgr-3.2_pgpool-3.7_barman-2.4.yml
299 lines (282 loc) · 10.2 KB
/
postgres-9.5_repmgr-3.2_pgpool-3.7_barman-2.4.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
##########################################################################
## AUTO-GENERATED FILE ##
##########################################################################
version: '2'
networks:
cluster:
driver: bridge
volumes:
pgmaster:
pgslave1:
pgslave2:
pgslave3:
pgslave4:
backup:
services:
pgmaster:
build:
context: ../src
dockerfile: Postgres-9.5-Repmgr-3.2.Dockerfile
environment:
NODE_ID: 1 # Integer number of node (not required if can be extracted from NODE_NAME var, e.g. node-45 => 1045)
NODE_NAME: node1 # Node name
CLUSTER_NODE_NETWORK_NAME: pgmaster # (default: hostname of the node)
PARTNER_NODES: "pgmaster,pgslave1,pgslave3"
REPLICATION_PRIMARY_HOST: pgmaster # That should be ignored on the same node
NODE_PRIORITY: 100 # (default: 100)
SSH_ENABLE: 1
#database we want to use for application
POSTGRES_PASSWORD: monkey_pass
POSTGRES_USER: monkey_user
POSTGRES_DB: monkey_db
CLEAN_OVER_REWIND: 0
CONFIGS_DELIMITER_SYMBOL: ;
CONFIGS: "listen_addresses:'*';max_replication_slots:5"
# in format variable1:value1[,variable2:value2[,...]] if CONFIGS_DELIMITER_SYMBOL=, and CONFIGS_ASSIGNMENT_SYMBOL=:
# used for pgpool.conf file
#defaults:
CLUSTER_NAME: pg_cluster # default is pg_cluster
REPLICATION_DB: replication_db # default is replication_db
REPLICATION_USER: replication_user # default is replication_user
REPLICATION_PASSWORD: replication_pass # default is replication_pass
ports:
- 5422:5432
volumes:
- pgmaster:/var/lib/postgresql/data
- ./ssh/:/tmp/.ssh/keys
networks:
cluster:
aliases:
- pgmaster
#<<< Branch 1
pgslave1:
build:
context: ../src
dockerfile: Postgres-9.5-Repmgr-3.2.Dockerfile
environment:
NODE_ID: 2
NODE_NAME: node2
CLUSTER_NODE_NETWORK_NAME: pgslave1 # (default: hostname of the node)
SSH_ENABLE: 1
PARTNER_NODES: "pgmaster,pgslave1,pgslave3"
REPLICATION_PRIMARY_HOST: pgmaster
CLEAN_OVER_REWIND: 1
CONFIGS_DELIMITER_SYMBOL: ;
CONFIGS: "max_replication_slots:10" #some overrides
ports:
- 5441:5432
volumes:
- pgslave1:/var/lib/postgresql/data
- ./ssh:/tmp/.ssh/keys
networks:
cluster:
aliases:
- pgslave1
# Add more slaves if required
pgslave2:
build:
context: ../src
dockerfile: Postgres-9.5-Repmgr-3.2.Dockerfile
environment:
NODE_ID: 3
NODE_NAME: node3
CLUSTER_NODE_NETWORK_NAME: pgslave2 # (default: hostname of the node)
REPLICATION_PRIMARY_HOST: pgslave1 # I want to have cascade Streeming replication
#USE_REPLICATION_SLOTS: 0
CONFIGS_DELIMITER_SYMBOL: ;
CONFIGS: "listen_addresses:'*'"
ports:
- 5442:5432
volumes:
- pgslave2:/var/lib/postgresql/data
networks:
cluster:
aliases:
- pgslave2
#>>> Branch 1
#<<< Branch 2
pgslave3:
build:
context: ../src
dockerfile: Postgres-9.5-Repmgr-3.2.Dockerfile
environment:
NODE_ID: 4
NODE_NAME: node4
CLUSTER_NODE_NETWORK_NAME: pgslave3 # (default: hostname of the node)
SSH_ENABLE: 1
PARTNER_NODES: "pgmaster,pgslave1,pgslave3"
REPLICATION_PRIMARY_HOST: pgmaster
NODE_PRIORITY: 200 # (default: 100)
CLEAN_OVER_REWIND: 1
CONFIGS_DELIMITER_SYMBOL: ;
CONFIGS: "listen_addresses:'*'"
ports:
- 5443:5432
volumes:
- pgslave3:/var/lib/postgresql/data
- ./ssh:/tmp/.ssh/keys
networks:
cluster:
aliases:
- pgslave3
pgslave4:
build:
context: ../src
dockerfile: Postgres-9.5-Repmgr-3.2.Dockerfile
environment:
NODE_ID: 5
NODE_NAME: node5
CLUSTER_NODE_NETWORK_NAME: pgslave4 # (default: hostname of the node)
REPLICATION_PRIMARY_HOST: pgslave3
#USE_REPLICATION_SLOTS: 0
CONFIGS_DELIMITER_SYMBOL: ;
CONFIGS: "listen_addresses:'*'"
ports:
- 5444:5432
volumes:
- pgslave4:/var/lib/postgresql/data
networks:
cluster:
aliases:
- pgslave4
#>>> Branch 2
backup:
build:
context: ../src
dockerfile: Barman-2.4-Postgres-9.6.Dockerfile
environment:
REPLICATION_USER: replication_user # default is replication_user
REPLICATION_PASSWORD: replication_pass # default is replication_pass
REPLICATION_HOST: pgmaster
POSTGRES_PASSWORD: monkey_pass
POSTGRES_USER: monkey_user
POSTGRES_DB: monkey_db
SSH_ENABLE: 1
BACKUP_SCHEDULE: "*/30 */5 * * *"
volumes:
- backup:/var/backups
- ./ssh:/tmp/.ssh/keys
networks:
cluster:
aliases:
- backup
pgpool:
build:
context: ../src
dockerfile: Pgpool-3.7-Postgres-9.6.Dockerfile
environment:
PCP_USER: pcp_user
PCP_PASSWORD: pcp_pass
WAIT_BACKEND_TIMEOUT: 60
CHECK_USER: monkey_user
CHECK_PASSWORD: monkey_pass
CHECK_PGCONNECT_TIMEOUT: 3 #timout for checking if primary node is healthy
SSH_ENABLE: 1
DB_USERS: monkey_user:monkey_pass # in format user:password[,user:password[...]]
BACKENDS: "0:pgmaster:5432:1:/var/lib/postgresql/data:ALLOW_TO_FAILOVER,1:pgslave1::::,3:pgslave3::::,2:pgslave2::::" #,4:pgslaveDOES_NOT_EXIST::::
# in format num:host:port:weight:data_directory:flag[,...]
# defaults:
# port: 5432
# weight: 1
# data_directory: /var/lib/postgresql/data
# flag: ALLOW_TO_FAILOVER
REQUIRE_MIN_BACKENDS: 3 # minimal number of backends to start pgpool (some might be unreachable)
CONFIGS: "num_init_children:250,max_pool:4"
# in format variable1:value1[,variable2:value2[,...]] if CONFIGS_DELIMITER_SYMBOL=, and CONFIGS_ASSIGNMENT_SYMBOL=:
# used for pgpool.conf file
ports:
- 5430:5432
- 9898:9898 # PCP
volumes:
- ./ssh:/tmp/.ssh/keys
networks:
cluster:
aliases:
- pgpool
# the rest is for tests
postgres_ext:
build:
context: ../src
dockerfile: Postgres-extended-9.5-Repmgr-3.2.Dockerfile
environment:
NODE_ID: 101
NODE_NAME: node101 # Node name
CLUSTER_NODE_NETWORK_NAME: postgres_ext # (default: hostname of the node)
POSTGRES_PASSWORD: monkey_pass
POSTGRES_USER: monkey_user
POSTGRES_DB: monkey_db
CLEAN_OVER_REWIND: 0
CONFIGS_DELIMITER_SYMBOL: ;
CONFIGS: "listen_addresses:'*';shared_preload_libraries:'pglogical'"
postgres_conf:
build:
context: ../src/
dockerfile: Postgres-9.5-Repmgr-3.2.Dockerfile
environment:
NODE_NAME: node-102 # Node name
CLUSTER_NODE_NETWORK_NAME: postgres_conf # (default: hostname of the node)
POSTGRES_PASSWORD: monkey_pass
POSTGRES_USER: monkey_user
POSTGRES_DB: monkey_db
CLEAN_OVER_REWIND: 0
CONFIGS: "listen_addresses)'some_host'|max_replication_slots)55"
CONFIGS_DELIMITER_SYMBOL: "|"
CONFIGS_ASSIGNMENT_SYMBOL: ")"
pgpool_conf:
build:
context: ../src
dockerfile: Pgpool-3.7-Postgres-9.6.Dockerfile
environment:
PCP_USER: pcp_user
PCP_PASSWORD: pcp_pass
CHECK_USER: monkey_user
CHECK_PASSWORD: monkey_pass
CHECK_PGCONNECT_TIMEOUT: 3 #timout for checking if primary node is healthy
DB_USERS: monkey_user:monkey_pass # in format user:password[,user:password[...]]
CONFIGS: "num_init_children)12|max_pool)13"
CONFIGS_DELIMITER_SYMBOL: "|"
CONFIGS_ASSIGNMENT_SYMBOL: ")"
ports:
- 5440:5432
- 9897:9898 # PCP
pgmaster2:
build:
context: ../src
dockerfile: Postgres-9.5-Repmgr-3.2.Dockerfile
environment:
NODE_ID: 1
NODE_NAME: node1
CLUSTER_NODE_NETWORK_NAME: pgmaster2
POSTGRES_PASSWORD: monkey_pass
POSTGRES_USER: monkey_user
POSTGRES_DB: monkey_db
CONFIGS_DELIMITER_SYMBOL: ;
CONFIGS: "listen_addresses:'*'"
ports:
- 5439:5432
networks:
cluster:
aliases:
- pgmaster2
pgpool2:
build:
context: ../src
dockerfile: Pgpool-3.7-Postgres-9.6.Dockerfile
depends_on:
- pgmaster
- pgmaster2
environment:
PCP_USER: pcp_user
PCP_PASSWORD: pcp_pass
CHECK_USER: monkey_user
CHECK_PASSWORD: monkey_pass
CHECK_PGCONNECT_TIMEOUT: 3 #timout for checking if primary node is healthy
DB_USERS: monkey_user:monkey_pass # in format user:password[,user:password[...]]
BACKENDS: "0:pgmaster::::,1:pgmaster2::::"
ports:
- 5431:5432
- 9899:9898 # PCP
networks:
cluster:
aliases:
- pgpool2