标签:Management Monitoring -- server Percona pmm docker data percona
Docker¶
How to run PMM Server with Docker based on our Docker image.
The tags used here are for the current release. Other tags are available.
See also
Before you start
- Install Docker 1.12.6 or higher.
- (Optional) Install Docker compose.
Run
Summary
- Pull the Docker image.
- Copy it to create a persistent data container.
- Run the image.
- Open the PMM UI in a browser.
-
Pull the image.
docker pull percona/pmm-server:2
-
Create a persistent data container.
docker create --volume /srv \ --name pmm-data \ percona/pmm-server:2 /bin/true
Important
PMM Server expects the data volume to be
/srv
. Using any other value will result in data loss when upgrading.To check server and data container mount points:
docker inspect pmm-data | grep Destination && \ docker inspect pmm-server | grep Destination
-
Run the image.
docker run --detach --restart always \ --publish 443:443 \ --volumes-from pmm-data \ --name pmm-server \ percona/pmm-server:2
-
In a web browser, visit
https://localhost:443
(orhttp://localhost:80
if enabled) to see the PMM user interface. (If you are accessing the docker host remotely, replacelocalhost
with the IP or server name of the host.)
Backup
Summary
- Stop and rename the
pmm-server
container. - Take a local copy of the
pmm-data
container’s/srv
directory.
-
Stop the container.
docker stop pmm-server
-
Move the image.
docker rename pmm-server pmm-server-backup
-
Create a subdirectory (e.g.,
pmm-data-backup
) and move to it.mkdir pmm-data-backup && cd pmm-data-backup
-
Backup the data.
docker cp pmm-data:/srv .
Upgrade
Summary
- Stop the running container.
- Backup (rename) the container and copy data.
- Pull the latest Docker image.
- Run it.
Tip
To see what release you are running, use the PMM Upgrade panel on the Home Dashboard, or run:
docker exec -it pmm-server \
curl -ku admin:admin https://localhost/v1/version
(If you are accessing the docker host remotely, replace localhost
with the IP or server name of the host.)
-
Perform a backup.
-
Pull the latest image.
docker pull percona/pmm-server:2
-
Run it.
docker run \ --detach \ --restart always \ --publish 443:443 \ --volumes-from pmm-data \ --name pmm-server \ percona/pmm-server:2
Restore
Summary
- Stop and remove the container.
- Restore (rename) the backup container.
- Restore saved data to the data container.
- Restore permissions to the data.
Important
You must have a backup to restore from.
-
Stop the container.
docker stop pmm-server
-
Remove it.
docker rm pmm-server
-
Revert to the saved image.
docker rename pmm-server-backup pmm-server
-
Change directory to the backup directory (e.g.
pmm-data-backup
). -
Remove Victoria Metrics data folder.
docker run --rm --volumes-from pmm-data -it percona/pmm-server:2 rm -r /srv/victoriametrics/data
-
Copy the data.
docker cp srv pmm-data:/
-
Restore permissions.
docker run --rm --volumes-from pmm-data -it percona/pmm-server:2 chown -R root:root /srv && \ docker run --rm --volumes-from pmm-data -it percona/pmm-server:2 chown -R pmm:pmm /srv/alertmanager && \ docker run --rm --volumes-from pmm-data -it percona/pmm-server:2 chown -R root:pmm /srv/clickhouse && \ docker run --rm --volumes-from pmm-data -it percona/pmm-server:2 chown -R grafana:grafana /srv/grafana && \ docker run --rm --volumes-from pmm-data -it percona/pmm-server:2 chown -R pmm:pmm /srv/logs && \ docker run --rm --volumes-from pmm-data -it percona/pmm-server:2 chown -R postgres:postgres /srv/postgres && \ docker run --rm --volumes-from pmm-data -it percona/pmm-server:2 chown -R pmm:pmm /srv/prometheus && \ docker run --rm --volumes-from pmm-data -it percona/pmm-server:2 chown -R pmm:pmm /srv/victoriametrics && \ docker run --rm --volumes-from pmm-data -it percona/pmm-server:2 chown -R postgres:postgres /srv/logs/postgresql.log
-
Start the image.
docker start pmm-server
Remove
Summary
- Stop the container.
- Remove (delete) both the server and data containers.
- Remove (delete) both images.
Caution
These steps delete the PMM Server Docker image and any accumulated PMM metrics data.
-
Stop pmm-server container.
docker stop pmm-server
-
Remove containers.
docker rm pmm-server pmm-data
-
Remove the image.
docker rmi $(docker images | grep "percona/pmm-server" | awk {'print $3'})
Docker compose
Summary
- Copy and paste the
docker-compose.yml
file. - Run
docker-compose up
.
With this approach, data is stored in a volume, not in a pmm-data
container.
-
Copy and paste this text into a file called
docker-compose.yml
.version: '2' services: pmm-server: image: percona/pmm-server:2 hostname: pmm-server container_name: pmm-server restart: always logging: driver: json-file options: max-size: "10m" max-file: "5" ports: - "443:443" volumes: - data:/srv volumes: data:
-
Run:
docker-compose up
-
In a web browser, visit
https://localhost:443
to see the PMM user interface. (If you are accessing the docker host remotely, replacelocalhost
with the IP or server name of the host.)
Environment variables
Use the following Docker container environment variables (with -e var=value
) to set PMM Server parameters.
Variable | Description |
---|---|
DISABLE_UPDATES |
Disable automatic updates. |
DISABLE_TELEMETRY |
Disable built-in telemetry and disable STT if telemetry is disabled. |
METRICS_RESOLUTION |
High metrics resolution in seconds. |
METRICS_RESOLUTION_HR |
High metrics resolution (same as above). |
METRICS_RESOLUTION_MR |
Medium metrics resolution in seconds. |
METRICS_RESOLUTION_LR |
Low metrics resolution in seconds. |
DATA_RETENTION |
How many days to keep time-series data in ClickHouse. |
ENABLE_VM_CACHE |
Enable cache in VM. |
ENABLE_ALERTING |
Enable integrated alerting. |
ENABLE_AZUREDISCOVER |
Enable support for discovery of Azure databases. |
ENABLE_BACKUP_MANAGEMENT |
Enable integrated backup tools. |
PERCONA_TEST_SAAS_HOST |
SaaS server hostname. |
PERCONA_TEST_DBAAS |
Enable testing DBaaS features. (Will be deprecated in future versions.) |
ENABLE_DBAAS |
Enable DBaaS features. |
PMM_DEBUG |
Enables a more verbose log level. |
PMM_TRACE |
Enables a more verbose log level including trace-back information. |
Ignored variables
These variables will be ignored by pmm-managed
when starting the server. If any other variable is found, it will be considered invalid and the server won’t start.
Variable | Description |
---|---|
_ , HOME , HOSTNAME , LANG , PATH , PWD , SHLVL , TERM |
Default environment variables. |
GF_* |
Grafana’s environment variables. |
SUPERVISOR_ |
supervisord environment variables. |
PERCONA_TEST_ |
Unknown variable but won’t prevent the server starting. |
PERCONA_TEST_DBAAS |
Deprecated. Use ENABLE_DBAAS . |
Tips
-
Disable manual updates via the Home Dashboard PMM Upgrade panel by adding
-e DISABLE_UPDATES=true
to thedocker run
command. -
Eliminate browser certificate warnings by configuring a trusted certificate.
-
Optionally enable an (insecure) HTTP connection by adding
--publish 80:80
to thedocker run
command. However note that PMM Client requires TLS to communicate with the server so will only work on the secure port.
Isolated hosts
If the host where you will run PMM Server has no internet connection, you can download the Docker image on a separate (internet-connected) host and securely copy it.
-
On an internet-connected host, download the Docker image and its checksum file.
wget https://downloads.percona.com/downloads/pmm2/2.20.0/docker/pmm-server-2.20.0.docker wget https://downloads.percona.com/downloads/pmm2/2.20.0/docker/pmm-server-2.20.0.sha256sum
-
Copy both files to where you will run PMM Server.
-
Open a terminal on the PMM Server host.
-
(Optional) Check the Docker image file integrity.
shasum -ca 256 pmm-server-2.20.0.sha256sum
-
Load the image.
docker load -i pmm-server-2.20.0.docker
-
Create the
pmm-data
persistent data container.docker create --volume /srv \ --name pmm-data percona/pmm-server:2.20.0 /bin/true
-
Run the container.
docker run \ --detach \ --restart always \ --publish 443:443 \ --volumes-from pmm-data \ --name pmm-server \ percona/pmm-server:2.20.0
标签:Management,Monitoring,--,server,Percona,pmm,docker,data,percona 来源: https://www.cnblogs.com/cheyunhua/p/15098713.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。