PMM은 PMM server + PMM client (db서버에 설치) 로 이루어져있습니다.
PMM server는 docker를 통해 이미지를 받아오고 PMM client는 rpm으로 설치하는 과정을 소개하겠습니다.

 

-.1 docker 설치

[root@testserver1 ec2-user]# yum install docker
Loaded plugins: priorities, update-motd, upgrade-helper

[root@testserver1 ec2-user]# service docker start
Starting cgconfig service:                                 [  OK  ]
Starting docker:        .                                  [  OK  ]
[root@testserver1 ec2-user]#
[root@testserver1 ec2-user]# docker version
Client:
 Version:      18.03.1-ce
 API version:  1.37
 Go version:   go1.9.4
 Git commit:   3dfb8343b139d6342acfd9975d7f1068b5b1c3d3
 Built:        Thu May 24 22:21:27 2018
 OS/Arch:      linux/amd64
 Experimental: false
 Orchestrator: swarm
Server:
 Engine:
  Version:      18.03.1-ce
  API version:  1.37 (minimum version 1.12)
  Go version:   go1.9.4
  Git commit:   7390fc6/18.03.1-ce
  Built:        Thu May 24 22:22:43 2018
  OS/Arch:      linux/amd64
  Experimental: false
=> yum으로 docker 설치 후 docker start
 

-.2 pmm server 설치

 
[root@testserver1 ec2-user]# docker pull percona/pmm-server
Using default tag: latest
latest: Pulling from percona/pmm-server
469cfcc7a4b3: Pull complete
aa2dbf5f79ad: Pull complete
Digest: sha256:93ebd791229d8e5d2fa1e955f838532d5231e61c31a7652b11c87f1717ec2bbc
Status: Downloaded newer image for percona/pmm-server:latest
[root@testserver1 ec2-user]#
[root@testserver1 ec2-user]# docker images
REPOSITORY           TAG                 IMAGE ID            CREATED             SIZE
percona/pmm-server   latest              a412cf31e624        2 weeks ago         999MB
=> percona/pmm-server image를 받아온 후 확인
 
 
[root@testserver1 aws]# docker create -v /opt/prometheus/data -v /opt/consul-data -v /var/lib/mysql/ --name PMM-DATA percona/pmm-server /bin/true
9b18ba73b80beb49e82360e885686eea88fb74c20caa8bc3a64f3f13b05e28bc
[root@testserver1 aws]# docker run -d -p 80:80 --volumes-from PMM-DATA --name PMM-SERVER --restart always percona/pmm-server
30a8ec753efed18b21838ce3f0e1cf921289fb23e129487d1cd637fa5283a56a


[root@testserver1 aws]# docker ps -a
CONTAINER ID        IMAGE                COMMAND                CREATED              STATUS              PORTS                         NAMES
30a8ec753efe        percona/pmm-server   "/opt/entrypoint.sh"   37 seconds ago       Up 36 seconds       0.0.0.0:80->80/tcp, 443/tcp   PMM-SERVER
9b18ba73b80b        percona/pmm-server   "/bin/true"            About a minute ago   Created                                           PMM-DATA
=> pmm-server 에 필요한 컨테이너를 생성 후 실행

 

-3. PMM client 설치

[root@testserver1 ec2-user]# rpm -ivh pmm-client-1.11.0-1.el6.x86_64.rpm
[root@testserver1 ec2-user]# rpm -qa | grep pmm
pmm-client-1.11.0-1.el6.x86_64

[root@testserver1 local]# pmm-admin config --server pmm-server ip
OK, PMM server is alive.
PMM Server      | pmm-server ip
Client Name     | testserver1
Client Address  | 
=> db 서버에서 pmm-client 를 설치 후 pmm-admin 커맨드를 통해 데이터를 전송할 pmm-server 를 등록해줌
 
 
[root@testserver1 local]# pmm-admin add mysql --user root --password test
[linux:metrics] OK, now monitoring this system.
[mysql:metrics] OK, now monitoring MySQL metrics using DSN root:***@unix(/engn001/masvc01/TEST_10.2.4/mysql/mysql.sock)
[mysql:queries] OK, now monitoring MySQL queries from slowlog using DSN root:***@unix(/engn001/masvc01/TEST_10.2.4/mysql/mysql.sock)
=> pmm-admin 커맨드를 사용하여 모니터링할 maria db를 등록함
 
 
[root@testserver1 local]# pmm-admin list
pmm-admin 1.11.0
PMM Server      | pmm-server ip
Client Name     | testserver1
Client Address  | pmm-server ip
Service Manager | linux-upstart

-------------- ---------------- ----------- -------- ------------------------------------------------------------- -------------------------------------------------------------------------------------
SERVICE TYPE   NAME             LOCAL PORT  RUNNING  DATA SOURCE                                                   OPTIONS
-------------- ---------------- ----------- -------- ------------------------------------------------------------- -------------------------------------------------------------------------------------
mysql:queries  testserver1  -           YES      root:***@unix(/engn001/masvc01/TEST_10.2.4/mysql/mysql.sock)  query_source=slowlog, query_examples=true, slow_log_rotation=true, retain_slow_logs=1
linux:metrics  testserver1  42000       YES      -                                                   
mysql:metrics  testserver1  42002       YES      root:***@unix(/engn001/masvc01/TEST_10.2.4/mysql/mysql.sock)
=> pmm-admin list 를 통해 pmm-client 모듈들 정상 확인

 

 

-4. PMM 접속

- PMM 메인페이지 : http://서버아이피

- 쿼리분석 페이지 : http://서버아이피/qan

- 매트릭스 모니터 : http://서버아이피/graph