mysql管理 监控_【MySQL】数据库监控与管理:Percona Monitoring and Management

[root@wallet04 ~]# wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm

[root@wallet04 ~]# rpm -ivh epel-release-latest-6.noarch.rpm

[root@wallet04 ~]# yum install -y docker-io device-mapper-event-libs

[root@wallet04 ~]# service docker start

Starting cgconfig service:                             [  OK  ]

Starting docker:                                       [  OK  ]

[root@wallet04 ~]# service docker status

docker (pid  1895) is running...

[root@wallet04 ~]# docker pull percona/pmm-server:latest

latest: Pulling from percona/pmm-server

e4b082fc6cdb: Pull complete

f016d310caa9: Pull complete

ba8785ab0cd6: Pull complete

72e31437b55a: Pull complete

4bb41d9768b7: Pull complete

a1336b651e7c: Pull complete

8395cf3b081a: Pull complete

bc7d7034330d: Pull complete

7b67e4e03e9f: Pull complete

134e09fd6400: Pull complete

af07f2902996: Pull complete

98f4a1e5d60f: Pull complete

92e1ca415c20: Pull complete

966f7b2091af: Pull complete

7ce95cd7a920: Pull complete

7845cb971987: Pull complete

Digest: sha256:c2d43772228b15eccb1544711b1943562e30582b545b48074fcdb4a2ae600d20

Status: Downloaded newer image for percona/pmm-server:latest

[root@wallet04 ~]# 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

ad3dbd3ee7f823a6c061d050c8f7895e1c704f7f06c9bd321a1d9dfab141a761

[root@wallet04 ~]# docker run -d \

-e METRICS_RETENTION=720h \

-e SERVER_USER=admin \

-e SERVER_PASSWORD=abcd.1234 \

-p 80:80 \

--volumes-from pmm-data percona/pmm-server:latest

110ec5a93240deb8c60e2a43029ef48023b06d804c7e3c48559894f24d72fb36

[root@wallet04 ~]# netstat -tunlp | grep docker

tcp        0      0 :::80        :::*        LISTEN        8563/docker-proxy

[root@wallet01 ~]# mysql -uroot -pabcd.1234

mysql> show variables like 'performance_schema';

+--------------------+-------+

| Variable_name      | Value |

+--------------------+-------+

| performance_schema | ON    |

+--------------------+-------+

1 row in set (0.00 sec)

mysql> set global innodb_monitor_enable=all;

Query OK, 0 rows affected (0.00 sec)

mysql> show variables like 'innodb_monitor_enable';

+-----------------------+-------+

| Variable_name         | Value |

+-----------------------+-------+

| innodb_monitor_enable | all   |

+-----------------------+-------+

1 row in set (0.00 sec)

[root@wallet01 ~]# rpm -ivh pmm-client-1.17.1-1.el6.x86_64.rpm

[root@wallet01 ~]# pmm-admin --help

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

Use "pmm-admin [command] --help" for more information about a command.

[root@wallet01 ~]# pmm-admin config --server 192.168.1.204 --server-user admin --server-password abcd.1234

OK, PMM server is alive.

PMM Server      | 192.168.1.204 (password-protected)

Client Name     | wallet01

Client Address  | 192.168.1.201

[root@wallet01 ~]# vi /usr/local/percona/pmm-client/pmm.yml

server_address: 192.168.1.204

client_address: 192.168.1.201

bind_address: 192.168.1.201

client_name: wallet01

server_user: admin

server_password: abcd.1234

[root@wallet01 ~]# pmm-admin add linux:metrics

OK, now monitoring this system.

[root@wallet01 ~]# pmm-admin add mysql --user root --password abcd.1234 --host localhost --query-source perfschema

[linux:metrics] OK, already monitoring this system.

[mysql:metrics] OK, now monitoring MySQL metrics using DSN root:***@unix(/tmp/mysql.sock)

[mysql:queries] OK, now monitoring MySQL queries from slowlog using DSN root:***@unix(/tmp/mysql.sock)

[root@wallet01 ~]#  pmm-admin list

pmm-admin 1.17.1

PMM Server      | 192.168.1.204 (password-protected)

Client Name     | wallet01

Client Address  | 192.168.1.201

Service Manager | linux-upstart

-------------- --------- ----------- -------- ------------------------------ ---------------------------------------------

SERVICE TYPE   NAME      LOCAL PORT  RUNNING  DATA SOURCE                               OPTIONS

-------------- --------- ----------- -------- ------------------------------ ---------------------------------------------

mysql:queries  wallet01  -           YES      root:***@unix(/tmp/mysql.sock)  query_source=perfschema, query_examples=true

linux:metrics  wallet01  42000       YES      -

mysql:metrics  wallet01  42002       YES      root:***@unix(/tmp/mysql.sock)

[root@wallet01 ~]# pmm-admin check-network

PMM Network Status

Server Address | 192.168.1.204

Client Address | 192.168.1.201

* System Time

NTP Server (0.pool.ntp.org)         | 2019-02-22 00:42:23 +0000 UTC

PMM Server                          | 2019-02-22 00:42:23 +0000 GMT

PMM Client                          | 2019-02-22 08:42:23 +0800 CST

PMM Server Time Drift               | OK

PMM Client Time Drift               | OK

PMM Client to PMM Server Time Drift | OK

* Connection: Client --> Server

-------------------- -------

SERVER SERVICE       STATUS

-------------------- -------

Consul API           OK

Prometheus API       OK

Query Analytics API  OK

Connection duration | 141.946µs

Request duration    | 15.821µs

Full round trip     | 157.767µs

* Connection: Client 

-------------- --------- -------------------- ------- ---------- ---------

SERVICE TYPE   NAME      REMOTE ENDPOINT      STATUS  HTTPS/TLS  PASSWORD

-------------- --------- -------------------- ------- ---------- ---------

linux:metrics  wallet01  192.168.1.201:42000  OK      YES        YES

mysql:metrics  wallet01  192.168.1.201:42002  OK      YES        YES

mysql管理 监控_【MySQL】数据库监控与管理:Percona Monitoring and Management_第1张图片

mysql管理 监控_【MySQL】数据库监控与管理:Percona Monitoring and Management_第2张图片

mysql管理 监控_【MySQL】数据库监控与管理:Percona Monitoring and Management_第3张图片

mysql管理 监控_【MySQL】数据库监控与管理:Percona Monitoring and Management_第4张图片

mysql管理 监控_【MySQL】数据库监控与管理:Percona Monitoring and Management_第5张图片

你可能感兴趣的:(mysql管理,监控)