how to use local pmm-data volume

Hi guys!
I have a instance of pmm-server and pmm-data working fine, both in docker. All right.

For a new instance, I’m trying use a local volume on host server to store only the pmm-data.
I created the local folders ( /opt/consul-data, /opt/prometheus, /var/lib/grafana, /var/lib/mysql ) and when start the pmm-server, I have trouble with mysql:

#docker run -p 9080:80 -p 9443:443 –volume /root/docker/volumes/var/lib/mysql:/var/lib/mysql --volume /root/docker/volumes/opt/consul-data:/opt/consul-data --volume /root/docker/volumes/opt/prometheus:/opt/prometheus --volume /root/docker/volumes/var/lib/grafana:/var/lib/grafana --name pmm-server -e METRICS_RETENTION=190h -e QUERIES_RETENTION=7 -e SERVER_USER=srv143 -e SERVER_PASSWORD=password0 -e METRICS_RESOLUTION=5s --restart always percona/pmm-server:latest

See messages from container log:
2018-05-17 16:16:01,187 INFO exited: createdb2 (exit status 1; not expected),
2018-05-17 16:16:01,208 INFO spawned: ‘createdb2’ with pid 2889,
2018-05-17 16:16:02,048 INFO spawned: ‘pmm-managed’ with pid 2908,
2018-05-17 16:16:02,061 INFO exited: pmm-managed (exit status 2; not expected),
2018-05-17 16:16:02,196 INFO success: mysql entered RUNNING state, process has stayed up for > than 1 seconds (startsecs),
2018-05-17 16:16:02,196 INFO exited: createdb3 (exit status 1; not expected),
2018-05-17 16:16:03,049 INFO success: createdb2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs),
2018-05-17 16:16:03,051 INFO spawned: ‘createdb3’ with pid 2918,
2018-05-17 16:16:03,082 INFO exited: mysql (exit status 1; not expected),
2018-05-17 16:16:04,085 INFO spawned: ‘mysql’ with pid 2920,
2018-05-17 16:16:04,085 INFO success: createdb3 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs),
2018-05-17 16:16:04,203 INFO exited: createdb (exit status 1; not expected),
2018-05-17 16:16:04,229 INFO spawned: ‘createdb’ with pid 2934,
2018-05-17 16:16:04,386 INFO exited: qan-api (exit status 1; not expected),
2018-05-17 16:16:04,732 INFO spawned: ‘qan-api’ with pid 2942,
2018-05-17 16:16:05,793 INFO success: mysql entered RUNNING state, process has stayed up for > than 1 seconds (startsecs),
2018-05-17 16:16:05,793 INFO success: qan-api entered RUNNING state, process has stayed up for > than 1 seconds (startsecs),
2018-05-17 16:16:05,793 INFO success: createdb entered RUNNING state, process has stayed up for > than 1 seconds (startsecs),
2018-05-17 16:16:05,816 INFO exited: mysql (exit status 1; not expected),
2018-05-17 16:16:06,229 INFO spawned: ‘mysql’ with pid 2954,
2018-05-17 16:16:06,231 INFO exited: createdb2 (exit status 1; not expected),
2018-05-17 16:16:06,253 INFO spawned: ‘createdb2’ with pid 2956,
2018-05-17 16:16:08,071 INFO success: mysql entered RUNNING state, process has stayed up for > than 1 seconds (startsecs),
2018-05-17 16:16:08,071 INFO success: createdb2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs),
2018-05-17 16:16:08,077 INFO exited: createdb3 (exit status 1; not expected),
2018-05-17 16:16:08,105 INFO spawned: ‘createdb3’ with pid 2978,
2018-05-17 16:16:08,106 INFO exited: mysql (exit status 1; not expected),
2018-05-17 16:16:09,109 INFO spawned: ‘mysql’ with pid 2980,
2018-05-17 16:16:09,109 INFO success: createdb3 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs),
2018-05-17 16:16:09,236 INFO exited: createdb (exit status 1; not expected),
2018-05-17 16:16:09,274 INFO spawned: ‘createdb’ with pid 2994,
2018-05-17 16:16:09,743 INFO exited: qan-api (exit status 1; not expected),
2018-05-17 16:16:09,775 INFO spawned: ‘qan-api’ with pid 3002,
2018-05-17 16:16:10,836 INFO success: mysql entered RUNNING state, process has stayed up for > than 1 seconds (startsecs),
2018-05-17 16:16:10,836 INFO success: qan-api entered RUNNING state, process has stayed up for > than 1 seconds (startsecs),
2018-05-17 16:16:10,836 INFO success: createdb entered RUNNING state, process has stayed up for > than 1 seconds (startsecs),

If I not use the volume mount for mysql, the container works fine, but I wont save the mysql data on local host.

#docker run -p 9080:80 -p 9443:443 --volume /root/docker/volumes/opt/consul-data:/opt/consul-data --volume /root/docker/volumes/opt/prometheus:/opt/prometheus --volume /root/docker/volumes/var/lib/grafana:/var/lib/grafana --name pmm-server -e METRICS_RETENTION=190h -e QUERIES_RETENTION=7 -e SERVER_USER=srv143 -e SERVER_PASSWORD=password0 -e METRICS_RESOLUTION=5s --restart always percona/pmm-server:latest

Does how to address this issue with mysql ?

BR

–note added by Percona Community Manager, going forward using pmm-server:n rather than pmm-server:latest is best practice, our advice changed since this post was written. In this case pmm-server:1 would have been appropriate for these code examples.

Having same problem here! Only mysql complaining and won’t even start up. Did you ever solve this issue?
I wonder if we use local volume for prometheus, grafana, consul only and leave mysql alone, what data will be lost?

Hi rnmkr

We definitely need the data to persist for MySQL, otherwise Query Analytics will be completely broken.

marcio

Can you get the MySQL error log? If mysqld isn’t running then those createdb, qan-api jobs will fail since they depend on MySQL. Directory permissions are correct?

We don’t officially support host volumes, we recommend creation of a pmm-data container as documented: [url]Percona Monitoring and Management . Having said that I don’t see why it shouldn’t work, so share with us the logs and we’ll review. Thanks

Because there is no such thing as “docker volumes” in kubernetes or any other container orchecstration.

Thanks for the information rnmkr - do none of these apply to your environment? [url]Volumes | Kubernetes

I found this article very helpful for using mapped storage instead of the docker storage

[url]https://www.percona.com/blog/2018/03/20/using-different-mount-points-on-pmm-docker-deployments/[/url]