- 4.7.8
- linux
- amd64
pgBadger
Performance analysis and insights for PostgreSQL queries
Step 1
Create a network so that the PostgreSQL and pgBadger containers can communicate with each other:
docker network create --driver bridge pgnetwork
Step 2
Set up key environmental variables for working with both of the containers. This creates a user named hippo
with a password of datalake
that has access to a database named hippo
:
cat << EOF > postgres-env.list
PG_MODE=primary
PG_PRIMARY_USER=postgres
PG_PRIMARY_PASSWORD=datalake
PG_DATABASE=hippo
PG_USER=hippo
PG_PASSWORD=datalake
PG_ROOT_PASSWORD=datalake
PG_PRIMARY_PORT=5432
EOF
Step 3
Run the containers:
docker run --publish 5432:5432 \
--volume=postgres:/pgdata \
--env-file=postgres-env.list \
--name="postgres" \
--hostname="postgres" \
--network="pgnetwork" \
--detach \
registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-13.9-4.7.8
docker run \
-p 10000:10000 \
-v postgres:/pgdata:ro \
-v report:/report \
--env=BADGER_TARGET='postgres' \
--env=BADGER_CUSTOM_OPTS='--incremental --prefix="%t [%p]: [%l-1] user=%u,db=%d,app=%a,client=%h"' \
--network=pgnetwork \
--name='pgbadger' \
--hostname='pgbadger' \
-d registry.developers.crunchydata.com/crunchydata/crunchy-pgbadger:ubi8-13.9-4.7.8
Step 4
Go to http://localhost:10000
in your local browser. You can view the pgBadger report here. As you perform more queries on your database, you will see more information in the report.
Tags
docker pull registry.developers.crunchydata.com/crunchydata/crunchy-pgbadger:ubi8-13.9-4.7.8
Compressed Size: 619.96