PMM監控MySQL

來源:互聯網
上載者:User

標籤:start   80連接埠   bash   from   one   anon   summary   release   調整   

一、PMM-SERVER1. 安裝docker
yum install -y docker-io
2. 拉取pmm-server鏡像
docker pull percona/pmm-server:latest
3. 建立持久化容器
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
4. 啟動pmm-server
docker run -d    -p 8888:80 \     #將docker的80連接埠映射到宿主機的8888連接埠   --volumes-from pmm-data    --name pmm-server    --restart always    percona/pmm-server:latest

查看運行狀態

[[email protected] ~]# docker ps -aCONTAINER ID        IMAGE                       COMMAND                CREATED             STATUS              PORTS                           NAMES983cb32aa7ca        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    
5. 關閉匿名登陸,並調整時區
[[email protected] docker]# docker exec -it pmm-server /bin/bash    #進入docker容器[[email protected] opt]# vi /etc/grafana/grafana.ini#################################### Anonymous Auth ##########################[auth.anonymous]# enable anonymous access#enabled = True[[email protected] opt]# cat /etc/localtime TZif2UTCTZif2UTCUTC0[[email protected] opt]# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime cp: overwrite ‘/etc/localtime‘? y
6. 登陸dashboard

瀏覽器中輸入: xx.xx.xx.xx:8888

二、PMM-CLIENT1. 在需要監控的機器上安裝pmm-client
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
2. 配置pmm-server地址

--server 後接的是pmm-server的地址和連接埠
-c 後邊接的是設定檔,預設設定檔為/usr/local/percona/pmm-client/pmm.yml

pmm-admin config --server xx.xx.xx.xx:8888 -c /usr/local/percona/pmm-client/pmm.yml             

以下是設定檔的內容

cat /usr/local/percona/pmm-client/pmm.ymlserver_address: xx.xx.xx.xx:8888client_address: xx.xx.xx.xxbind_address: xx.xx.xx.xxclient_name: monitor-node1
3. 添加linux系統監控
pmm-admin add linux:metrics 
4. 添加MySQL監控

在MySQL執行個體中建立監控使用者:

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監控

pmm-admin add mysql --host 127.0.0.1 --user pmm --password pmm --port 3306 instance3306   ##此命令是監控MySQL執行個體狀態以及慢查詢分析,如果不想監控慢日誌使用mysql:metrics即可
三、遇到的問題1. purge報錯

某台機器下線,需要清理pmm-server中關於這台機器的資料,執行purge命令後報錯

[[email protected] ~]# pmm-admin purge linux:metricspanic: 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 +0x5a4main.glob..func39(0xbde460, 0xc4200a1730, 0x1, 0x1)    /tmp/go/src/github.com/percona/pmm-client/pmm-admin.go:1179 +0xd1github.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 +0x2a2github.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 +0x2d4github.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 +0x2bmain.main()    /tmp/go/src/github.com/percona/pmm-client/pmm-admin.go:1398 +0x18dc

疑似為bug,官方表名會在以後版本修複:https://jira.percona.com/browse/PMM-2894

2. _PMM System Summary面板無法顯示MySQL資訊匯總

報錯如下:

Server summary:mysql summary - Exit Status 1

解決辦法:將MySQL相關命令軟串連到/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

PMM監控MySQL

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.