Move the postgresql database out of the docker container

Description:

Hello,

Is it possible to move the postgresql database out of the docker container as we have estimated a volume of up to 1TB?

Thank you

Best regards

Version:

2.37

It is possible to do and details can be found here.

The postgres database will no longer be managed as a component of PMM so you’ll have to do your own upgrades and ensure you’re using a compatible version with PMM server (which shouldn’t be an issue unless you tried to jump to PG16 while PMM is still using 14.8)

I’m curious though…given the PG database only holds information about client registrations (and soon grafana configurations)…how are you calculating 1TB of data? I’d think you’d need billions of clients to get that database that big. Did you instead mean you expect 1TB of metrics data? In that case you may be looking to externalize VictoriaMetrics (which holds the Time Series metrics) and I’m not sure if that can be externalized yet.

Heard back on the ability to externalize VictoriaMetrics and it’s actually slated for the next release (2.40.0) that should be coming out in a few weeks. So if it’s more metrics you’re worried about hitting 1TB that could help!

Hello,

I read the documentation How much disk space should I allocate for Percona Monitoring and Management? “will push you above 230MB/host/day” so 7GB by host for one month

Thank you

Best regards

I’d have to take a look but that Blog was against PMM 1.x using prometheus for time-series data. We’ve since moved to VictoriaMetrics (a prometheus compatible database) and their compression cuts disk usage dramatically! Our QA Manager wrote a blog on his observations when we made the switch.

All that to say, externalizing the Postgres database won’t give you much help…the biggest database will be the VictoriaMetrics database for metrics (not yet externlizable) followed by Clickhouse for Query Analytics data (can be externalized).

One of the things I’ve done is switch from using a data container to maintain state to instead using a mapped volume in docker and then all my PMM data is stored on the hosts /srv (or whatever you map to) which is actually a NAS but could be DASD or whatever you want with high IOps.

Hello,

We try to use local db postgresql but we see that on docker postgresql image :
87ca272892e7 localhost/percona/pmm-server:2.37.0 postgres -c share… 7 hours ago Created external-postgres

On /root/.config/systemd/user/pmm-server.service
Environment=PERCONA_TEST_POSTGRES_ADDR=127.0.0.1
Environment=PERCONA_TEST_POSTGRES_PORT=5111
Environment=PERCONA_TEST_POSTGRES_DBNAME=postgres
Environment=PERCONA_TEST_POSTGRES_USERNAME=pmm
ExecStart=/usr/bin/podman run --rm --replace=true --name=%N -p ${PMM_PUBLIC_PORT}:443/tcp -e ${PERCONA_TEST_POSTGRES_ADDR} -e ${PERCONA_TEST_POSTGRES_ADDR} -e ${PERCONA_TEST_POSTGRES_PORT} -e ${PERCONA_TEST_POSTGRES_USERNAME} -e ${PERCONA_TEST_POSTGRES_DBPASSWORD} -e ${PERCONA_TEST_POSTGRES_DBNAME} --ulimit=host --volume=${PMM_VOLUME_NAME}:/pmm --env-file=${PMM_ENV_FILE} --health-cmd=none --health-interval=disable ${PMM_IMAGE}:${PMM_TAG}

Thank you

Regards

Hello,

We try to use external postgresql db, below ~/.config/systemd/user/pmm-server.service :
[Unit]
Description=pmm-server
Wants=network-online.target
After=network-online.target
After=nss-user-lookup.target nss-lookup.target
After=time-sync.target

[Service]
Type=simple

set environment for this unit

Environment=PMM_PUBLIC_PORT=443
Environment=PERCONA_TEST_POSTGRES_ADDR=127.0.0.1
Environment=PERCONA_TEST_POSTGRES_PORT=5000
Environment=PERCONA_TEST_POSTGRES_DBNAME=postgres
Environment=PERCONA_TEST_POSTGRES_USERNAME=pmm
Environment=PERCONA_TEST_POSTGRES_DBPASSWORD=test
Environment=PERCONA_TEST_POSTGRES_SSL_MODE=DISABLE
Environment=PMM_VOLUME_NAME=%N
Environment=PMM_TAG=2.37.0
Environment=PMM_IMAGE=localhost/percona/pmm-server
Environment=PMM_ENV_FILE=%h/.config/pmm-server/pmm-server.env

optional env file that could override previous env settings for this unit

EnvironmentFile=-%h/.config/pmm-server/env

ExecStart=/usr/bin/podman run --rm --network=host --replace=true --name=%N -p ${PMM_PUBLIC_PORT}:443/tcp -e ${PERCONA_TEST_POSTGRES_ADDR} -e ${PERCONA_TEST_POSTGRES_PORT} -e ${PERCONA_TEST_POSTGRES_USERNAME} -e ${PERCONA_TEST_POSTGRES_DBPASSWORD} -e ${PERCONA_TEST_POSTGRES_DBNAME} --ulimit=host --volume=${PMM_VOLUME_NAME}:/pmm --env-file=${PMM_ENV_FILE} --health-cmd=none --health-interval=disable ${PMM_IMAGE}:${PMM_TAG}
ExecStop=/usr/bin/podman stop -t 10 %N
Restart=on-failure
RestartSec=20

[Install]
Alias=%N
WantedBy=default.target

But applicance connect always on pg database on pmm container.

Is it possible to use this configuration ?

Thank you

Regards