Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
342 commits
Select commit Hold shift + click to select a range
6153740
PMM-7: Add pgsql
peterSirotnak May 7, 2025
ce1fe96
PMM-7: Add pgsql
peterSirotnak May 7, 2025
a1f2f54
PMM-7: Add pgsql
peterSirotnak May 7, 2025
03c4335
PMM-7: Add pgsql
peterSirotnak May 7, 2025
1a4239d
PMM-7: Add pgsql
peterSirotnak May 7, 2025
3f416c1
PMM-7: Add pgsql
peterSirotnak May 7, 2025
eb6b3f5
PMM-7: Add pgsql
peterSirotnak May 7, 2025
ad2624f
PMM-7: Add pgsql
peterSirotnak May 7, 2025
c3c0aa6
PMM-7: Add pgsql
peterSirotnak May 7, 2025
5d042b0
PMM-7: Add pgsql
peterSirotnak May 7, 2025
5ec2c4f
PMM-7: Add pgsql
peterSirotnak May 7, 2025
fb3f881
PMM-7: Add pgsql
peterSirotnak May 7, 2025
8fb6327
PMM-7: Add pgsql
peterSirotnak May 7, 2025
fb6d8e5
PMM-7: Add pgsql
peterSirotnak May 7, 2025
dcb76cb
PMM-7: Add pgsql
peterSirotnak May 7, 2025
0e28b22
PMM-7: Add pgsql
peterSirotnak May 7, 2025
6fa4c05
PMM-7: Add pgsql
peterSirotnak May 7, 2025
1574082
PMM-7: Add pgsql
peterSirotnak May 7, 2025
6a7f934
PMM-7: Add pgsql
peterSirotnak May 7, 2025
da7eec1
PMM-7: Add pgsql
peterSirotnak May 7, 2025
72614ce
PMM-7: Add pgsql
peterSirotnak May 7, 2025
9b1f1f5
PMM-7: Add pgsql
peterSirotnak May 7, 2025
6ca638e
PMM-7: Add pgsql
peterSirotnak May 7, 2025
a5eab05
PMM-7: Add pgsql
peterSirotnak May 7, 2025
fc63082
PMM-7: Add pgsql
peterSirotnak May 7, 2025
ca8c0ef
PMM-7: Add pgsql
peterSirotnak May 7, 2025
0f576cc
PMM-7: Add pgsql
peterSirotnak May 7, 2025
4de0d0d
PMM-7: Add pgsql
peterSirotnak May 7, 2025
bae176a
PMM-7: Add pgsql
peterSirotnak May 7, 2025
9e954a5
PMM-7: Add pgsql
peterSirotnak May 7, 2025
677ed0e
PMM-7: Add pgsql
peterSirotnak May 7, 2025
b9d598d
PMM-7: Add pgsql
peterSirotnak May 7, 2025
b3deee0
PMM-7: Add pgsql
peterSirotnak May 7, 2025
34c72e8
PMM-7: Add pgsql
peterSirotnak May 7, 2025
31434a2
PMM-7: Add pgsql
peterSirotnak May 7, 2025
16a2a01
PMM-7: Add pgsql
peterSirotnak May 7, 2025
50ab9a9
PMM-7: Add pgsql
peterSirotnak May 7, 2025
481e919
PMM-7: Add pgsql
peterSirotnak May 7, 2025
442deef
PMM-7: Add pgsql
peterSirotnak May 7, 2025
5cc107f
PMM-7: Add pgsql
peterSirotnak May 7, 2025
9008c7f
PMM-7: Add pgsql
peterSirotnak May 7, 2025
1cdacdf
PMM-7: Add pgsql
peterSirotnak May 7, 2025
12c31e9
PMM-7: Add pgsql
peterSirotnak May 7, 2025
752426a
PMM-7: Add pgsql
peterSirotnak May 7, 2025
3807955
PMM-7: Add pgsql
peterSirotnak May 7, 2025
26ecacb
PMM-7: Add pgsql
peterSirotnak May 7, 2025
f3211c1
PMM-7: Add pgsql
peterSirotnak May 7, 2025
74bd536
PMM-7: Add pgsql
peterSirotnak May 7, 2025
39d0709
PMM-7: Add pgsql
peterSirotnak May 7, 2025
2e4d827
PMM-7: Add pgsql
peterSirotnak May 7, 2025
6f5caa5
PMM-7: Add pgsql
peterSirotnak May 7, 2025
d9bcbfc
PMM-7: Add pgsql
peterSirotnak May 7, 2025
3799375
PMM-7: Add pgsql
peterSirotnak May 7, 2025
a484f82
PMM-7: Add pgsql
peterSirotnak May 7, 2025
8bc5b0c
PMM-7: Add pgsql
peterSirotnak May 7, 2025
2dfd916
PMM-7: Add pgsql
peterSirotnak May 7, 2025
82e01f6
PMM-7: Add pgsql
peterSirotnak May 7, 2025
7b40c52
PMM-7: Add pgsql
peterSirotnak May 7, 2025
694f858
PMM-7: Add pgsql
peterSirotnak May 7, 2025
d119cf7
PMM-7: Add pgsql
peterSirotnak May 7, 2025
c227fb3
PMM-7: Add pgsql
peterSirotnak May 7, 2025
4cea3f7
PMM-7: Add pgsql
peterSirotnak May 7, 2025
c49bbda
PMM-7: Add pgsql
peterSirotnak May 7, 2025
50a0478
PMM-7: Add pgsql
peterSirotnak May 7, 2025
ce640ad
PMM-7: Add pgsql
peterSirotnak May 7, 2025
aa7d972
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
40d71e2
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
33bc5ae
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
7e36402
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
25ab540
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
6f3ab43
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
d4176ca
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
69b6d8d
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
99dfb96
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
f2fea7b
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
f2db672
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
be23729
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
2c03315
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
6d7e6fc
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
7dea9c0
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
a7e24e8
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
13413d8
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
2162494
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
247afaa
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
04f0dca
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
50c1529
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
da17ac3
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
e5a7b58
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
cd01e5b
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
8242e64
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
c259d60
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
0613806
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
f62049b
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
1387f04
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
1f48633
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
f69fbb7
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
5e8600b
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
ed4f4f4
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
470337f
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
0863f91
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
c0033d0
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
a75c5ae
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
3570db1
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
6536c6e
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
d7c71b6
PMM-7: Add pdpgsql
peterSirotnak May 7, 2025
bc5fb3b
PMM-7: Add pgsql
peterSirotnak May 7, 2025
48b7a7c
PMM-7: Add pgsql
peterSirotnak May 7, 2025
2904027
PMM-7: Add pgsql
peterSirotnak May 7, 2025
116ee76
PMM-7: Add pgsql
peterSirotnak May 7, 2025
4931238
PMM-7: Add pgsql
peterSirotnak May 7, 2025
f388423
PMM-7: Add pgsql
peterSirotnak May 7, 2025
dfaa222
PMM-7: Add pgsql
peterSirotnak May 7, 2025
3c69fdb
PMM-7: Add pgsql
peterSirotnak May 7, 2025
50178ea
PMM-7: Add pgsql
peterSirotnak May 7, 2025
d803857
PMM-7: Add pgsql
peterSirotnak May 7, 2025
7219ebc
PMM-7: Add pgsql
peterSirotnak May 7, 2025
d162867
PMM-7: Add pgsql
peterSirotnak May 7, 2025
077cb4d
PMM-7: Add pgsql
peterSirotnak May 7, 2025
80f921e
PMM-7: Add pgsql
peterSirotnak May 7, 2025
9b23a41
PMM-7: Add pgsql
peterSirotnak May 7, 2025
7c85d02
PMM-7: Add pgsql
peterSirotnak May 7, 2025
948d3e3
PMM-7: Add pgsql
peterSirotnak May 7, 2025
75c4ecf
PMM-7: Add pgsql
peterSirotnak May 7, 2025
fb96bf6
PMM-7: Add pgsql
peterSirotnak May 7, 2025
2997265
PMM-7: Add pgsql
peterSirotnak May 8, 2025
4576eae
PMM-7: Add pgsql
peterSirotnak May 8, 2025
c18e6eb
PMM-7: Add pgsql
peterSirotnak May 8, 2025
173132a
PMM-7: Add pgsql
peterSirotnak May 8, 2025
7187264
PMM-7: Add pgsql
peterSirotnak May 8, 2025
1201574
PMM-7: Add pgsql
peterSirotnak May 8, 2025
8a529e9
PMM-7: Add pgsql
peterSirotnak May 8, 2025
9b04d9c
PMM-7: Add pgsql
peterSirotnak May 8, 2025
b954a96
PMM-7: Add pgsql
peterSirotnak May 8, 2025
4e25f6a
PMM-7: Add pgsql
peterSirotnak May 8, 2025
3f4ea3f
PMM-7: Add pgsql
peterSirotnak May 8, 2025
85bfcc8
PMM-7: Add pgsql
peterSirotnak May 8, 2025
a68117e
PMM-7: Add pgsql
peterSirotnak May 8, 2025
6882e19
PMM-7: Add pgsql
peterSirotnak May 8, 2025
0e249cc
PMM-7: Add pgsql
peterSirotnak May 8, 2025
263eb16
PMM-7: Fix pmm client install
peterSirotnak May 12, 2025
f0fda84
PMM-7: Fix pmm client install
peterSirotnak May 12, 2025
93c8559
PMM-7: New MySQL setup
peterSirotnak May 12, 2025
d4ff70e
PMM-7: New MySQL setup
peterSirotnak May 13, 2025
ff1dfb4
PMM-7: New MySQL setup
peterSirotnak May 13, 2025
3ad1d88
PMM-7: New MySQL setup
peterSirotnak May 13, 2025
57b47d0
PMM-7: New MySQL setup
peterSirotnak May 13, 2025
d5aa656
PMM-7: New MySQL setup
peterSirotnak May 13, 2025
b0f4292
PMM-7: New MySQL setup
peterSirotnak May 13, 2025
46e1a6a
PMM-7: New MySQL setup
peterSirotnak May 13, 2025
a8dab65
PMM-7: New MySQL setup
peterSirotnak May 13, 2025
b1a8184
PMM-7: New MySQL setup
peterSirotnak May 13, 2025
4fbe2f8
PMM-7: New MySQL setup
peterSirotnak May 13, 2025
a556fe6
PMM-7: New MySQL setup
peterSirotnak May 13, 2025
44b1a47
PMM-7: New MySQL setup
peterSirotnak May 13, 2025
f11debd
PMM-7: New MySQL setup
peterSirotnak May 13, 2025
4862ed8
PMM-7: New MySQL setup
peterSirotnak May 13, 2025
6a670ee
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
17d2118
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
943a98b
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
8c31fab
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
f503958
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
dc26cc7
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
9942ecc
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
95c8550
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
f15d09c
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
8353470
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
744b875
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
538ccb8
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
6b315ab
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
d212263
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
e7caad9
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
6cf6ccc
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
7d5d9e4
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
578b3ca
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
73e449a
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
740c401
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
c8fe7b1
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
4ec5fd9
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
1cda843
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
f536f7c
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
8e56f67
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
7f87fdb
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
7356cd8
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
3a07ebf
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
939c218
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
3413d85
PMM-7: New MySQL setup
peterSirotnak May 14, 2025
ccef85e
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
dd725e9
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
d8de015
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
a75de6d
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
c33535c
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
7037d8d
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
fdf64ef
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
219b793
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
4be5b51
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
e6e806a
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
21b16f5
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
f840033
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
efc12a8
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
cfea1b3
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
1bb7208
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
43b81d9
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
aa07775
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
5f6cbe0
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
95b83f0
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
cf4b6fa
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
54c4b3d
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
63c3f17
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
48f07d4
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
e8f774f
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
734cd72
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
61e60f0
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
2efd110
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
ce84f66
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
3e9c713
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
2d67cd9
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
2be0964
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
d51e145
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
ddc3360
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
8e55e2e
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
4ba95e5
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
9d261b1
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
c6439ad
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
fad3bc8
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
ab82c00
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
5adc502
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
6e83772
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
e21de74
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
65058bb
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
84e3265
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
2f12317
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
caee574
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
9e7b746
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
fafdef0
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
b43bfc6
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
b175148
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
2dd5cef
PMM-7: PDPGSQL
peterSirotnak Jun 3, 2025
4cd3893
PMM-7: PDPGSQL
peterSirotnak Jun 4, 2025
8111a1f
PMM-7: PDPGSQL
peterSirotnak Jun 4, 2025
2ebead2
PMM-7: PDPGSQL
peterSirotnak Jun 4, 2025
18e1783
PMM-7: PDPGSQL
peterSirotnak Jun 4, 2025
d9b5b75
PMM-7: PDPGSQL
peterSirotnak Jun 4, 2025
52ff3c9
PMM-7: PDPGSQL
peterSirotnak Jun 4, 2025
7fa26b5
PMM-7: PDPGSQL
peterSirotnak Jun 4, 2025
8f29f1d
PMM-7: PDPGSQL
peterSirotnak Jun 4, 2025
8289c87
PMM-7: PDPGSQL
peterSirotnak Jun 4, 2025
ecc6d61
PMM-7: PDPGSQL
peterSirotnak Jun 4, 2025
677497b
PMM-7: PDPGSQL
peterSirotnak Jun 4, 2025
da7d02c
PMM-7: PDPGSQL
peterSirotnak Jun 4, 2025
876b568
PMM-7: PDPGSQL
peterSirotnak Jun 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added pmm_qa/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions pmm_qa/percona-distribution-postgresql/data/pg_hba.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
host replication {{ replication_user }} 0.0.0.0/0 md5
host all all 0.0.0.0/0 md5
local all postgres trust
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
host replication {{ replication_user }} 0.0.0.0/0 md5
host all all 0.0.0.0/0 md5
local all postgres trust
14 changes: 14 additions & 0 deletions pmm_qa/percona-distribution-postgresql/data/postgres-replica.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
hba_file = '/etc/postgresql/pg_hba.conf'
shared_preload_libraries = 'pg_stat_monitor'
track_activity_query_size=2048
track_io_timing=ON
max_connections=1000
listen_addresses = '*'
pg_stat_monitor.pgsm_enable_query_plan = 'yes'
pg_stat_monitor.pgsm_query_max_len = 2048
pg_stat_monitor.pgsm_normalized_query=1
pg_stat_monitor.pgsm_enable_query_plan=1
log_connections = on
log_disconnections = on
log_replication_commands = on
log_statement = 'all'
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
wal_level = replica
max_wal_senders = 10
wal_keep_size = 64MB
hot_standby = on
listen_addresses = '*'
hba_file = '/etc/postgresql/pg_hba.conf'
shared_preload_libraries = 'pg_stat_monitor'
track_activity_query_size=2048
track_io_timing=ON
max_connections=1000
listen_addresses = '*'
pg_stat_monitor.pgsm_enable_query_plan = 'yes'
log_connections = on
log_disconnections = on
log_replication_commands = on
log_statement = 'all'
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
---
# Percona Distribution Postgresql Replication
- name: Setup Postgresql replication
hosts: localhost
connection: local
gather_facts: yes
vars:
pg_version: "{{ lookup('env', 'PGSQL_VERSION') | default('17', true) }}"
replication_user: "repl_user"
replication_password: "GRgrO9301RuF"
root_password: "GRgrO9301RuF"
pdpgsql_port: 5432
nodes_count: "{{ (lookup('env', 'NODES_COUNT') | default('2', true)) | int }}"
network_name: "pmm-qa"
data_dir: "{{ lookup('env', 'HOME') }}/pgsql_cluster_data"
pmm_server_ip: "{{ lookup('vars', 'extra_pmm_server_ip', default=lookup('env','PMM_SERVER_IP') | default('127.0.0.1', true) ) }}"
client_version: "{{ lookup('vars', 'extra_client_version', default=lookup('env','CLIENT_VERSION') | default('3-dev-latest', true) ) }}"
admin_password: "{{ lookup('vars', 'extra_admin_password', default=lookup('env','ADMIN_PASSWORD') | default('admin', true) ) }}"
query_source: "{{ lookup('env', 'QUERY_SOURCE') | default('pgstatements', true) }}"
metrics_mode: "auto"
setup_type: "{{ lookup('env', 'SETUP_TYPE') }}"
random_service_name_value: ""
docker_repo: "percona/percona-distribution-postgresql"

tasks:
- name: Create Docker network
community.docker.docker_network:
name: "{{ network_name }}"
state: present
ignore_errors: yes

- name: Remove old data folders
shell: 'rm -fr {{ data_dir }}'

- name: Create data directories
file:
path: "{{ data_dir }}/node{{ item }}/data"
state: directory
mode: '0755'
loop: "{{ range(1, nodes_count | int + 1) | list }}"

- name: Generate pg_hba.conf for primary node
template:
src: data/pg_hba.conf.j2
dest: "{{ data_dir }}/node1/pg_hba.conf"

- name: Generate pg_hba.conf for replica node
template:
src: data/pg_hba_replica.conf.j2
dest: "{{ data_dir }}/node{{ item }}/pg_hba.conf"
loop: "{{ range(2, nodes_count | int + 1) | list }}"

- name: Fix permissions on data directory
file:
path: "{{ data_dir }}/node{{ item }}/data"
owner: 1001
group: 1001
recurse: yes
loop: "{{ range(1, nodes_count | int + 1) | list }}"

- name: Remove old PostgreSQL primary container
community.docker.docker_container:
name: "pdpgsql_pmm_{{ pg_version }}_1"
image: "{{ docker_repo }}:{{ pg_version }}"
restart_policy: always
state: absent
ignore_errors: yes

- name: Start PostgreSQL primary container
community.docker.docker_container:
name: "pdpgsql_pmm_{{ pg_version }}_1"
image: "{{ docker_repo }}:{{ pg_version }}"
restart_policy: always
state: started
recreate: true
networks:
- name: "{{ network_name }}"
env:
POSTGRES_PASSWORD: "{{ root_password }}"
volumes:
- "{{ data_dir }}/node1/data:/data/db"
- "./data/postgresql-primary.conf:/etc/postgresql/postgresql.conf:ro"
- "{{ data_dir }}/node1/pg_hba.conf:/etc/postgresql/pg_hba.conf:ro"
command: -c config_file=/etc/postgresql/postgresql.conf
ports:
- "{{ pdpgsql_port }}:5432"

- name: Wait for PgSQL to be available
wait_for:
host: localhost
port: "{{ pdpgsql_port }}"
delay: 10
timeout: 300

- name: Create replication user
community.docker.docker_container_exec:
container: "pdpgsql_pmm_{{ pg_version }}_1"
user: postgres
command: >
psql -c "
CREATE ROLE {{ replication_user }} WITH REPLICATION LOGIN ENCRYPTED PASSWORD '{{ replication_password }}';
"

- name: Stop and remove replica if exists
community.docker.docker_container:
name: "pdpgsql_pmm_{{ pg_version }}_{{ item }}"
state: absent
loop: "{{ range(2, nodes_count | int + 1) | list }}"
ignore_errors: yes

- name: Start Percona Distribution PostgreSQL replica container
community.docker.docker_container:
name: "pdpgsql_pmm_{{ pg_version }}_{{ item }}"
image: "{{ docker_repo }}:{{ pg_version }}"
restart_policy: "no"
state: started
command: sleep infinity
networks:
- name: "{{ network_name }}"
env:
POSTGRES_INITDB_SKIP: "yes"
POSTGRES_PASSWORD: "{{ root_password }}"
volumes:
- "{{ data_dir }}/node{{ item }}/data:/data/db"
- "./data/postgres-replica.conf:/etc/postgresql/postgresql.conf:ro"
- "{{ data_dir }}/node{{ item }}/pg_hba.conf:/etc/postgresql/pg_hba.conf:ro"
loop: "{{ range(2, nodes_count | int + 1) | list }}"

- name: Wipe replica data directory before basebackup
community.docker.docker_container_exec:
container: "pdpgsql_pmm_{{ pg_version }}_{{ item }}"
user: root
command: rm -rf /data/db/*
loop: "{{ range(2, nodes_count | int + 1) | list }}"

- name: Create PostgreSQL user 'pmm' with password
community.docker.docker_container_exec:
container: "pdpgsql_pmm_{{ pg_version }}_1"
user: postgres
command: >
bash -c '
psql -U postgres -d {{ db_name | default("postgres") }} -c "
CREATE USER pmm WITH PASSWORD '\''pmm'\'';
GRANT pg_monitor TO pmm;
"
'

- name: Create custom database for pgbench
community.docker.docker_container_exec:
container: "pdpgsql_pmm_{{ pg_version }}_1"
user: postgres
command: >
bash -c "
echo \"
CREATE DATABASE pgbench;
\\c pgbench
GRANT CONNECT ON DATABASE pgbench TO pmm;
GRANT USAGE ON SCHEMA public TO pmm;
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO pmm;
ALTER DEFAULT PRIVILEGES IN SCHEMA public
GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO pmm;
\" | psql -U postgres -v ON_ERROR_STOP=1
"

- name: Run pg_basebackup from primary to replica
community.docker.docker_container_exec:
container: "pdpgsql_pmm_{{ pg_version }}_{{ item }}"
user: root
command: >
bash -c "
export PGPASSWORD='{{ replication_password }}' && \
timeout 120s \
pg_basebackup --pgdata=/data/db -R -v -Fp -Xs -P \
--host=pdpgsql_pmm_{{ pg_version }}_1 --port=5432 -U {{ replication_user }} > /tmp/pg_basebackup.log 2>&1
"
loop: "{{ range(2, nodes_count | int + 1) | list }}"

- name: Remove temporary backup container
docker_container:
name: "pdpgsql_pmm_{{ pg_version }}_{{ item }}"
state: absent
loop: "{{ range(2, nodes_count | int + 1) | list }}"

- name: Fix permissions on data directory
file:
path: "{{ data_dir }}/node{{ item }}/data"
owner: 1001
group: 1001
recurse: yes
loop: "{{ range(2, nodes_count | int + 1) | list }}"

- name: Restart Percona Distribution PostgreSQL container with custom command
community.docker.docker_container:
name: "pdpgsql_pmm_{{ pg_version }}_{{ item }}"
image: "{{ docker_repo }}:{{ pg_version }}"
restart: true
state: started
command: -c config_file=/etc/postgresql/postgresql.conf
networks:
- name: "{{ network_name }}"
env:
POSTGRES_PASSWORD: "{{ root_password }}"
volumes:
- "{{ data_dir }}/node{{ item }}/data:/data/db"
- "./data/postgres-replica.conf:/etc/postgresql/postgresql.conf:ro"
- "{{ data_dir }}/node1/pg_hba.conf:/etc/postgresql/pg_hba.conf:ro"
ports:
- "{{ pdpgsql_port + item - 1}}:5432"
loop: "{{ range(2, nodes_count | int + 1) | list }}"

- name: Install pg stat monitor.
include_tasks: ./tasks/install_pg_stat-monitor.yml

- name: Install and add pmm client.
include_tasks: ../tasks/install_pmm_client.yml
vars:
container_name: "pdpgsql_pmm_{{ pg_version }}_{{ item }}"
loop: "{{ range(1, nodes_count | int + 1) | list }}"

- name: Get already connected services to pmm server
community.docker.docker_container_exec:
container: "pdpgsql_pmm_{{ pg_version }}_1"
command: >
sh -c 'curl --location --insecure -u"admin:{{ admin_password }}" -s --request GET "http://{{ pmm_server_ip }}:{{ '80' if pmm_server_ip is ansible.utils.ipv4 else '8080' }}/v1/management/services" | jq -r ".services[].service_name"'
register: pmm_server_services

- name: Display already connected services to pmm server
debug:
msg: "{{ pmm_server_services.stdout | split('\n') }}"

- name: Find out if service is already connected to pmm server
block:
- name: Loop through percona servers
set_fact:
random_service_name_value: "_{{ 9999 | random + 1 }}"
loop: "{{ range(1, nodes_count | int + 1) | list }}"
when: "('pdpgsql_pmm_' ~ pg_version ~ '_' ~ item) in pmm_server_services.stdout"

- name: Add service to pmm server
community.docker.docker_container_exec:
container: "pdpgsql_pmm_{{ pg_version }}_{{ item }}"
command: pmm-admin add postgresql --username=pmm --password=pmm --query-source=pgstatmonitor pdpgsql_pmm_{{ pg_version }}_{{ item }}{{ random_service_name_value }} --debug 127.0.0.1:5432
loop: "{{ range(1, nodes_count | int + 1) | list }}"

- name: Run load on primary node.
include_tasks: ../postgresql/tasks/run_load_pgsql.yml
vars:
node_name: "pdpgsql_pmm_{{ pg_version }}_1"
pgbench_clients: 10
pgbench_time: 120
pgbench_scale: 1000

- name: Check replication status on primary
community.docker.docker_container_exec:
container: "pdpgsql_pmm_{{ pg_version }}_1"
user: postgres
command: psql -c "SELECT * FROM pg_stat_replication;"
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
- name: Detect OS inside the container
community.docker.docker_container_exec:
container: "pdpgsql_pmm_{{ pg_version }}_1"
command: cat /etc/os-release
register: container_os_info

- name: Set distro family (debian/rhel)
set_fact:
distro_family: >-
{{
(
'debian' if 'debian' in container_os_info.stdout | lower else
'rhel' if 'rhel' in container_os_info.stdout | lower or 'centos' in container_os_info.stdout | lower or 'fedora' in container_os_info.stdout | lower
else 'unknown'
) | trim
}}

- name: Install dependencies inside Debian-family container
community.docker.docker_container_exec:
container: "pdpgsql_pmm_{{ pg_version }}_{{ item }}"
command: >
sh -c '
apt-get update &&
apt-get install percona-pg-stat-monitor{{ pg_version }}
'
user: "root"
when: distro_family == "debian"
loop: "{{ range(1, nodes_count | int + 1) | list }}"

- name: Install dependencies inside RHEL-family container
community.docker.docker_container_exec:
container: "pdpgsql_pmm_{{ pg_version }}_{{ item }}"
command: >
sh -c '
microdnf install percona-pg-stat-monitor{{ pg_version }}
'
user: "root"
when: distro_family == "rhel"
loop: "{{ range(1, nodes_count | int + 1) | list }}"

- name: Create pg_stat_statements extension
community.docker.docker_container_exec:
container: "pdpgsql_pmm_{{ pg_version }}_1"
user: postgres
command: >
psql -U postgres -d 'postgres' -c "
CREATE EXTENSION IF NOT EXISTS pg_stat_monitor;
SELECT pg_stat_monitor_version();
"
9 changes: 5 additions & 4 deletions pmm_qa/percona_server/percona-server-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
client_version: "{{ lookup('vars', 'extra_client_version', default=lookup('env','CLIENT_VERSION') | default('3-dev-latest', true) ) }}"
admin_password: "{{ lookup('vars', 'extra_admin_password', default=lookup('env','ADMIN_PASSWORD') | default('admin', true) ) }}"
query_source: "{{ lookup('env', 'QUERY_SOURCE') | default('perfschema', true) }}"
metrics_mode: "{{ lookup('env', 'metrics_mode') }}"
setup_type: "{{ lookup('env', 'SETUP_TYPE') }}"
random_service_name_value: ""

Expand All @@ -40,7 +41,7 @@
name: "{{ network_name }}"
state: present

- name: "Remove old data folders"
- name: Remove old data folders
shell: 'rm -fr {{ data_dir }}'
loop: "{{ range(1, nodes_count | int + 1) | list }}"

Expand Down Expand Up @@ -73,7 +74,7 @@
when: setup_type == "replication"

- name: Setup Percona Server
include_tasks: ./tasks/percona-server-setup.yml
include_tasks: tasks/percona-server-setup-single.yml
when: setup_type != "gr" and setup_type != "replication"

- name: Create slowlog configuration for mysql nodes
Expand All @@ -90,7 +91,7 @@
when: query_source == "slowlog"

- name: Install and add pmm client.
include_tasks: ../tasks/install_pmm_client_centos.yml
include_tasks: ../tasks/install_pmm_client.yml
vars:
container_name: "ps_pmm_{{ ps_version }}_{{ item }}"
loop: "{{ range(1, nodes_count | int + 1) | list }}"
Expand Down Expand Up @@ -230,6 +231,6 @@
--tables=10
--table-size=100000
--threads=16
--time=60
--time=60
run
loop: "{{ range(1, nodes_count | int + 1) | list }}"
Loading
Loading