Skip to content

Commit a39b774

Browse files
authored
docs: fix order of installation instructions (#14)
1 parent 54ada0e commit a39b774

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,14 @@ make install
3030
CREATE EXTENSION dblink;
3131
```
3232

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.
3439

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.
3641

3742
```
3843
CREATE SERVER pgbouncer FOREIGN DATA WRAPPER dblink_fdw OPTIONS (host 'localhost',
@@ -56,7 +61,7 @@ CREATE EXTENSION dblink;
5661
UPDATE pgbouncer_fdw_targets SET active = false WHERE target_host = 'pgbouncer';
5762
```
5863
59-
4. Create user mappings
64+
5. Create user mapping(s) with your preferred credentials in the same database as the FDW(s).
6065
```
6166
CREATE USER MAPPING FOR PUBLIC SERVER pgbouncer OPTIONS (user 'ccp_monitoring', password 'mypassword');
6267
```
@@ -67,11 +72,6 @@ Optionally create a separate user mapping to allow admin command access. The exa
6772
CREATE USER MAPPING FOR pgb_admin SERVER pgbouncer OPTIONS (user 'pgb_admin', password 'supersecretpassword');
6873
```
6974
70-
5. Create the extension in the monitoring database
71-
```
72-
CREATE EXTENSION pgbouncer_fdw;
73-
```
74-
7575
6. Grant necessary permissions on extension objects to the user mapping role
7676
```
7777
GRANT USAGE ON FOREIGN SERVER pgbouncer TO ccp_monitoring;
@@ -120,7 +120,7 @@ GRANT SELECT ON pgbouncer_users TO pgb_admin;
120120
```
121121
122122
## 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).
124124
125125
```
126126
postgres=# select * from pgbouncer_pools;

0 commit comments

Comments
 (0)