您好,登錄后才能下訂單哦!
yum install -y docker-io
docker pull percona/pmm-server:latest
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
docker run -d \
-p 8888:80 \ #將docker的80端口映射到宿主機的8888端口
--volumes-from pmm-data \
--name pmm-server \
--restart always \
percona/pmm-server:latest
查看運行狀態(tài)
[root@localhost ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
983cb32aa7ca percona/pmm-server:latest "/opt/entrypoint.sh" 4 days ago Up 4 days 443/tcp, 0.0.0.0:8888->80/tcp pmm-server
670aaeb497cf percona/pmm-server:latest "/bin/true" 4 days ago pmm-data
[root@localhost docker]# docker exec -it pmm-server /bin/bash #進入docker容器
[root@983cb32aa7ca opt]# vi /etc/grafana/grafana.ini
#################################### Anonymous Auth ##########################
[auth.anonymous]
# enable anonymous access
#enabled = True
[root@983cb32aa7ca opt]# cat /etc/localtime
TZif2UTCTZif2UTC
UTC0
[root@983cb32aa7ca opt]# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
cp: overwrite '/etc/localtime'? y
瀏覽器中輸入: xx.xx.xx.xx:8888
yum install http://www.percona.com/downloads/percona-release/redhat/0.1-6/percona-release-0.1-6.noarch.rpm #配置percona源
yum install pmm-client #安裝pmm-client
--server 后接的是pmm-server的地址和端口
-c 后邊接的是配置文件,默認(rèn)配置文件為/usr/local/percona/pmm-client/pmm.yml
pmm-admin config --server xx.xx.xx.xx:8888 -c /usr/local/percona/pmm-client/pmm.yml
以下是配置文件的內(nèi)容
cat /usr/local/percona/pmm-client/pmm.yml
server_address: xx.xx.xx.xx:8888
client_address: xx.xx.xx.xx
bind_address: xx.xx.xx.xx
client_name: monitor-node1
pmm-admin add linux:metrics
在MySQL實例中創(chuàng)建監(jiān)控用戶:
GRANT SELECT, PROCESS, SUPER, REPLICATION CLIENT, RELOAD ON *.* TO 'pmm'@'127.0.0.1' IDENTIFIED BY 'pmm' WITH MAX_USER_CONNECTIONS 10;
GRANT SELECT, UPDATE, DELETE, DROP ON performance_schema.* TO 'pmm'@'127.0.0.1';
添加MySQL監(jiān)控
pmm-admin add mysql --host 127.0.0.1 --user pmm --password pmm --port 3306 instance3306 ##此命令是監(jiān)控MySQL實例狀態(tài)以及慢查詢分析,如果不想監(jiān)控慢日志使用mysql:metrics即可
某臺機器下線,需要清理pmm-server中關(guān)于這臺機器的數(shù)據(jù),執(zhí)行purge命令后報錯
[root@localhost ~]# pmm-admin purge linux:metrics
panic: interface conversion: interface {} is nil, not map[string]interface {}
goroutine 1 [running]:
github.com/percona/pmm-client/pmm.(*Admin).PurgeMetrics(0xbe4e60, 0x7ffc82a0674b, 0xd, 0xc4201f68b8, 0xc4201abb68, 0x7ff262)
/tmp/go/src/github.com/percona/pmm-client/pmm/main.go:427 +0x5a4
main.glob..func39(0xbde460, 0xc4200a1730, 0x1, 0x1)
/tmp/go/src/github.com/percona/pmm-client/pmm-admin.go:1179 +0xd1
github.com/percona/pmm-client/vendor/github.com/spf13/cobra.(*Command).execute(0xbde460, 0xc4200a16e0, 0x1, 0x1, 0xbde460, 0xc4200a16e0)
/tmp/go/src/github.com/percona/pmm-client/vendor/github.com/spf13/cobra/command.go:654 +0x2a2
github.com/percona/pmm-client/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xbdeb20, 0xc4201abdd0, 0x49b302, 0x0)
/tmp/go/src/github.com/percona/pmm-client/vendor/github.com/spf13/cobra/command.go:729 +0x2d4
github.com/percona/pmm-client/vendor/github.com/spf13/cobra.(*Command).Execute(0xbdeb20, 0xc0263c, 0x92bf0f)
/tmp/go/src/github.com/percona/pmm-client/vendor/github.com/spf13/cobra/command.go:688 +0x2b
main.main()
/tmp/go/src/github.com/percona/pmm-client/pmm-admin.go:1398 +0x18dc
疑似為bug,官方表名會在以后版本修復(fù):https://jira.percona.com/browse/PMM-2894
報錯如下:
Server summary:mysql summary - Exit Status 1
解決辦法:將MySQL相關(guān)命令軟連接到/usr/bin/
ln -s /usr/local/mysql/bin/* /usr/bin/
參考地址:https://www.percona.com/forums/questions-discussions/percona-monitoring-and-management/47268-server-summary-mysql-summary-exit-status-1
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。