You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,9 +30,14 @@ make install
30
30
CREATE EXTENSION dblink;
31
31
```
32
32
33
-
3. Create one or more FDW servers and a user mapping manually with your preferred credentials.
33
+
3. Create the extension in the monitoring database. PgBouncer statistics are global so it only needs to be monitored from a single database. If you have multiple databases in your cluster, it is recommended to just install it to the default `postgres` database, or whichever one is being used as a global database that will never be dropped.
34
+
```
35
+
CREATE EXTENSION pgbouncer_fdw;
36
+
```
37
+
38
+
4. Create one or more FDW servers in the same database where the extension was installed.
34
39
35
-
a. If only a single PgBouncer server is the target, leave FDW the server name as `pgbouncer` to use the default configuration. This avoids needing to use the configuration table at all. Set the port(s) to whichever one PgBouncer itself is running on, NOT the postgres database. PgBouncer statistics are global so it only needs to be monitored from a single database. If you have multiple databases in your cluster, it is recommended to just install it to the default `postgres` database, or whichever one is being used as a global database that will never be dropped.
40
+
a. If only a single PgBouncer server is the target, leave FDW the server name as `pgbouncer` to use the default configuration. This avoids needing to use the configuration table at all. Set the port(s) to whichever one PgBouncer itself is running on, NOT the postgres database.
36
41
37
42
```
38
43
CREATE SERVER pgbouncer FOREIGN DATA WRAPPER dblink_fdw OPTIONS (host 'localhost',
@@ -56,7 +61,7 @@ CREATE EXTENSION dblink;
56
61
UPDATE pgbouncer_fdw_targets SET active = false WHERE target_host = 'pgbouncer';
57
62
```
58
63
59
-
4. Create user mappings
64
+
5. Create user mapping(s) with your preferred credentials in the same database as the FDW(s).
60
65
```
61
66
CREATE USER MAPPING FOR PUBLIC SERVER pgbouncer OPTIONS (user 'ccp_monitoring', password 'mypassword');
62
67
```
@@ -67,11 +72,6 @@ Optionally create a separate user mapping to allow admin command access. The exa
67
72
CREATE USER MAPPING FOR pgb_admin SERVER pgbouncer OPTIONS (user 'pgb_admin', password 'supersecretpassword');
68
73
```
69
74
70
-
5. Create the extension in the monitoring database
71
-
```
72
-
CREATE EXTENSION pgbouncer_fdw;
73
-
```
74
-
75
75
6. Grant necessary permissions on extension objects to the user mapping role
76
76
```
77
77
GRANT USAGE ON FOREIGN SERVER pgbouncer TO ccp_monitoring;
@@ -120,7 +120,7 @@ GRANT SELECT ON pgbouncer_users TO pgb_admin;
120
120
```
121
121
122
122
## Usage
123
-
You should be able to query any of the PgBouncer views provided. For the meaning of the views, see the PgBouncer documentation (linked above). Not all views are provided due to recommendations from author (FDS) or duplication of data already provided by other views (STATS_TOTALS, STATS_AVERAGES, etc).
123
+
You should be able to query any of the PgBouncer views provided. For the meaning of the views, see the PgBouncer documentation (linked above). Not all views are provided due to recommendations from upstream author (FDS) or duplication of data already provided by other views (STATS_TOTALS, STATS_AVERAGES, etc).
0 commit comments