您好,登錄后才能下訂單哦!
詳細的部署信息請參考官方文檔:
https://www.percona.com/doc/percona-monitoring-and-management/deploy/server/docker.setting-up.html#pmm-server-docker-image-pulling
一、server端部署:
1.監控機器安裝docker:
ip:192.168.56.101
操作系統版本:
[root@my-mm ~]# cat /etc/centos-release
CentOS Linux release 7.5.1804 (Core)
安裝:
yum install -y docker
啟動:
systemctl start docker
systemctl enable docker
2.拉取PMM服務器映像:
docker pull percona/pmm-server:latest
[root@my-mm ~]# docker pull percona/pmm-server:latest
Trying to pull repository docker.io/percona/pmm-server ...
latest: Pulling from docker.io/percona/pmm-server
aeb7866da422: Pull complete
904d1ed4e1e3: Pull complete
Digest: sha256:5eb0fe89d2e93198e7070e92f22cdd95fcef5db257f70a3e05071685f2503a56
Status: Downloaded newer image for docker.io/percona/pmm-server:latest
3.創建一個PMM數據容器:
docker create \
-v /opt/prometheus/data \
-v /opt/consul-data \
-v /var/lib/mysql \
-v /var/lib/grafana \
--name pmm-data \
percona/pmm-server:latest /bin/true
[root@my-mm ~]# docker create \
> -v /opt/prometheus/data \
> -v /opt/consul-data \
> -v /var/lib/mysql \
> -v /var/lib/grafana \
> --name pmm-data \
> percona/pmm-server:latest /bin/true
8448b22b99f7d667f6bfa9dcc78a4e662aed57a4d36473061d2533afa6c3e515
4.創建和運行 PMM Server Container:
docker run -d -p 80:80 --volumes-from pmm-data --name pmm-server --restart always percona/pmm-server:latest
[root@my-mm ~]# docker run -d -p 80:80 --volumes-from pmm-data --name pmm-server --restart always percona/pmm-server:latest
56372ece726b9e61f29d2f0dd1e72a5353237015997f2e7637a7164b05f38727
檢查docker狀態:
[root@my-mm ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
56372ece726b percona/pmm-server:latest "/opt/entrypoint.sh" 28 seconds ago Up 27 seconds 0.0.0.0:80->80/tcp, 443/tcp pmm-server
5.登錄:
http://192.168.56.101
默認登錄信息如下,可以自行修改:
username:admin password:admin
登錄界面:
二、客戶端部署:
6.客戶端部署軟件,在需要被監控MySQL服務端安裝pmm-client:
客戶端信息(192.168.56.102)
添加yum源(或者下載安裝包):
rpm -ivh https://www.percona.com/redir/downloads/percona-release/redhat/latest/percona-release-0.1-6.noarch.rpm
安裝pmm-client:
yum install pmm-client –y
卸載軟件:
yum remove pmm-client -y
6.添加監控:
客戶端連接pmm server,配置監控服務器:
pmm-admin config --server 192.168.56.101
添加操作系統監控:
[root@my2 ~]# pmm-admin add linux:metrics
OK, now monitoring this system.
在需要監控的數據庫上面創建用戶:
GRANT ALL PRIVILEGES ON *.* TO 'pmm-monitor'@'%' IDENTIFIED BY 'pmm-monitor';
flush privileges;
添加mysql監控:
pmm-admin add mysql --user pmm-monitor --password pmm-monitor --host 192.168.56.102 --port 3306
[root@my2 ~]# pmm-admin add mysql --user pmm-monitor --password pmm-monitor --host 192.168.56.102 --port 3306
[linux:metrics] OK, already monitoring this system.
[mysql:metrics] OK, now monitoring MySQL metrics using DSN pmm-monitor:***@tcp(192.168.56.102:3306)
[mysql:queries] OK, now monitoring MySQL queries from slowlog using DSN pmm-monitor:***@tcp(192.168.56.102:3306)
web頁面查看添加的mysql監控信息:
客戶端查看監控信息:
[root@my2 ~]# pmm-admin list
pmm-admin 1.16.0
PMM Server | 192.168.56.101
Client Name | my2.ml.com
Client Address | 192.168.56.102
Service Manager | linux-upstart
-------------- ----------- ----------- -------- ----------------------------------------- --------------------------------------------------------------------------------------
SERVICE TYPE NAME LOCAL PORT RUNNING DATA SOURCE OPTIONS
-------------- ----------- ----------- -------- ----------------------------------------- --------------------------------------------------------------------------------------
mysql:queries my2.ml.com - YES pmm-monitor:***@tcp(192.168.56.102:3306) query_source=slowlog, query_examples=true, slow_log_rotation=true, retain_slow_logs=1
linux:metrics my2.ml.com 42000 YES -
mysql:metrics my2.ml.com 42002 YES pmm-monitor:***@tcp(192.168.56.102:3306)
默認監控顯示是以主機名字顯示,如果機器上面部署多個mysql或者需要指定顯示的主機名:
pmm-admin config --server 192.168.56.101 client-name #client-name是指定監控顯示名稱client-name
例如:
pmm-admin add mysql --user pmm-monitor --password 'pmm-monitor' --socket=/data/mysql_3317/data/mysql.sock mysql-3307
清除監控數據:
pmm-admin purge 會提示幫助信息,示例如下:
pmm-admin purge linux:metrics my2.ml.com
pmm-admin purge mysql:metrics my2.ml.com
刪除添加的監控項:
pmm-admin remove mysql:metrics my2.ml.com
直接輸入pmm-admin會顯示所有的幫助信息:
[root@my2 ~]# pmm-admin
Usage:
pmm-admin [flags]
pmm-admin [command]
Available Commands:
config Configure PMM Client.
add Add service to monitoring.
annotate Annotate application events.
remove Remove service from monitoring.
list List monitoring services for this system.
info Display PMM Client information (works offline).
check-network Check network connectivity between client and server.
ping Check if PMM server is alive.
start Start monitoring service.
stop Stop monitoring service.
restart Restart monitoring service.
show-passwords Show PMM Client password information (works offline).
purge Purge metrics data on PMM server.
repair Repair installation.
uninstall Removes all monitoring services with the best effort.
summary Fetch system data for diagnostics.
help Help about any command
Flags:
-c, --config-file string PMM config file (default "/usr/local/percona/pmm-client/pmm.yml")
-h, --help help for pmm-admin
--skip-root skip UID check (experimental)
--timeout duration timeout (default 5s)
--verbose verbose output
-v, --version show version
Use "pmm-admin [command] --help" for more information about a command.
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。