hipster mysql monitoring serving a deconstructed pmm
play

Hipster MySQL Monitoring: Serving a deconstructed PMM Percona Live - PowerPoint PPT Presentation

Hipster MySQL Monitoring: Serving a deconstructed PMM Percona Live 2017 Santa Clara, California | April 24th 27th, 2017 Ben Mildren, Senior Database Engineer The deconstructed flat white digitalocean.com Just give me coffee!


  1. Hipster MySQL Monitoring: Serving a deconstructed PMM Percona Live 2017 Santa Clara, California | April 24th – 27th, 2017 Ben Mildren, Senior Database Engineer

  2. The deconstructed flat white digitalocean.com

  3. Just give me coffee! digitalocean.com

  4. What is PMM? ● Appliance ○ Abstracted setup ○ Batteries included ● Monitoring ○ Query Analytics (Log Analysis) ○ Metrics Monitor (Performance Monitoring) ● Management ○ MySQL Replication Topology Manager (Orchestrator) digitalocean.com

  5. What is PMM? Query Analytics ● QAN ○ QAN App (https://github.com/percona/qan-app) ○ QAN API (https://github.com/percona/qan-api) ○ QAN Agent (https://github.com/percona/qan-agent) digitalocean.com

  6. PMM Components - QAN ● QAN Agent consumes slow query log / performance schema ○ Fingerprints Queries for aggregation ● Sends data to QAN API ○ Stores data in MySQL DB local to PMM ● Displays data via QAN App (web gui) ● MySQL Query Analysis (Log Analysis) ○ pt-query-digest, Anemometer, ELK ○ VividCortex & Honeycomb digitalocean.com

  7. What is PMM? Metrics Monitor ● Prometheus (https://prometheus.io/) ○ Exporters ○ https://prometheus.io/docs/instrumenting/exporters/ ● Grafana (https://grafana.com/) ○ Percona Dashboards ○ https://github.com/percona/grafana-dashboards digitalocean.com

  8. PMM Components - Prometheus ● Originally developed at Soundcloud ● Based on Borgmon (Google) ● Whitebox monitoring ● Pull vs Push ● Storage / Retention ○ Graphite ○ InfluxDB ● Exporters digitalocean.com

  9. PMM Components - Consul ● Service Discovery & K/V Data store ● Single node configuration ● Uses API (no local agents) ● Services for each exporter digitalocean.com

  10. PMM Components - Grafana ● Dashboarding ● Plugins ○ Panels ○ Data sources ○ Apps digitalocean.com

  11. What is PMM? MySQL Replication Topology Manager ● Orchestrator (https://github.com/github/orchestrator) ● Mature project under custodianship of Github ● Automates master failover / slave promotion digitalocean.com

  12. PMM Overview ● PMM Server ○ Docker Container ○ Open Virtual Appliance (OVA) ○ Amazon Machine Images (AMI) ● PMM Client ○ DEB ○ RPM https://github.com/percona/pmm/blob/master/doc/source/images/pmm-diagram.png digitalocean.com

  13. PMM Components - PMM Glue ● pmm landing page (PMM Server) ● pmm admin (PMM Client) digitalocean.com

  14. Walking through the installation.. Install PMM Server (Docker Container) 1. < install docker > 2. Create data container docker create -v /opt/prometheus/data -v /opt/consul-data -v /var/lib/mysql \ -v /var/lib/grafana --name pmm-data percona/pmm-server:1.1.3 /bin/true 1. Create PMM server container docker run -d -p 80:80 --volumes-from pmm-data --name pmm-server --restart always \ percona/pmm-server:1.1.3 digitalocean.com

  15. PMM Server under the hood.. ● https://github.com/percona/pmm-server ● https://github.com/percona/pmm-server/blob/master/Dockerfile ○ Centos based ○ Installed using Ansible playbooks (local connection) ○ Docker runs multiple processes using supervisord digitalocean.com

  16. PMM Server under the hood.. ● https://github.com/percona/pmm-server ● https://github.com/percona/pmm-server/blob/master/playbook-install.yml ○ install / configuration ○ pmm yum repo ● https://github.com/percona/pmm-server/blob/master/playbook-init.yml ● https://github.com/percona/pmm-server/blob/master/entrypoint.sh ● https://github.com/percona/pmm-server/blob/master/supervisord.conf digitalocean.com

  17. Walking through the installation.. Install PMM Client 1. Download and install repo ( yum or apt ) 2. Install pmm client sudo apt-get install pmm-client 1. Connect client to pmm server sudo pmm-admin config --server < insert pmm server address here > 1. Start collecting data sudo pmm-admin add mysql digitalocean.com

  18. PMM Client under the hood.. ● https://github.com/percona/pmm-client sudo pmm-admin config --server < insert pmm server address here > ● https://github.com/percona/pmm-client/blob/master/pmm-admin.go#L558-L587 ○ https://github.com/percona/pmm-client/blob/master/pmm/config.go ○ Creates pmm config file (/usr/local/percona/pmm-client/pmm.yml) sudo pmm-admin add mysql ● https://github.com/percona/pmm-client/blob/master/pmm-admin.go#L142-L202 ○ AddLinuxMetrics ( https://github.com/percona/pmm-client/blob/master/pmm/linux_metrics.go ) ○ AddMySQLMetrics ( https://github.com/percona/pmm-client/blob/master/pmm/mysql_metrics.go ) ○ AddMySQLQueries ( https://github.com/percona/pmm-client/blob/master/pmm/mysql_queries.go ) digitalocean.com

  19. PMM Limitations ● Docker anti-pattern - single container running multiple processes ● Scalability - always confined to a single appliance ● Flexibility - only a few variables can be adjusted ● Integration digitalocean.com

  20. Questions? digitalocean.com

  21. Independent Deployment Options ● Ansible (Chef, Puppet, Salt Stack) ● Docker Compose digitalocean.com

  22. Ansible Best Practices ● Idempotence ● Keep playbooks simple ○ Cleanly separate Provisioning, Deployment, & Orchestration ● Use Ansible Vault digitalocean.com

  23. Ansible Roles ● Use Roles! ○ Encapsulation ■ Reuse (Ansible Galaxy) ■ Defaults & Variables ○ Versioning ○ Testing digitalocean.com

  24. Sample Ansible Project Layout - ansible (main project directory) - galaxy_roles (roles installed by ansible-galaxy) - inventories - development (environment specific inventories) - production - group_vars - development (include both vars & vault) - production - library (local modules) - playbooks - roles (local roles) digitalocean.com - vault_passwords

  25. Sample Ansible Config [defaults] inventory = ./inventories gathering = smart fact_caching = jsonfile fact_caching_connection = /tmp fact_caching_timeout = 86400 ansible_managed = "PLEASE DO NOT EDIT BY HAND -- THIS FILE IS MANAGED BY ANSIBLE" library = /usr/share/ansible/modules/:./library roles_path = ./roles:./galaxy_roles hash_behaviour = merge [ssh_connection] ssh_args = -C -o ControlMaster=auto -o ControlPersist=60s control_path = %(directory)s/%%C digitalocean.com

  26. Delphinus Project ● Sample PMM-like project ● Encapsulated Roles (Including MySQL, Consul, Prometheus, Grafana, QAN, Nginx) ● Utilises Ansible Vault & Ansible Galaxy digitalocean.com

  27. Demo digitalocean.com

  28. Further options ● HA ○ Prometheus & Grafana ● Terraform ○ Declarative vs Procedural ○ Terragrunt ● Packer ○ Reuse ansible code to build images ○ Faster deployment digitalocean.com

  29. Final thoughts ● PMM is a great solution ○ Quick and easy to install ○ It can provide immediate value ● However, PMM is just a collection of components ○ If you need to more advanced options, be your own barista digitalocean.com

  30. Thank you! Questions?

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend