Using Docker to visualize MySQL performance schema
Last week, I was pleased to present at Percona Live Amsterdam 2015 regarding the importance of Performance Schema and how to begin approaching visualizing the data that is available to diagnose performance issues and fine tune your MySQL environment. You can download the slides from the Percona Live conference page. The session highlighted using the ELK ( Elasticsearch+ Logstash+ Kibana) stack to assist visualizing event data, in addition to graphite+graphana to visualize time-series data. As many people who attend conferences are aware, the availability of internet access is sketchy at best. To combat this, the visualization stack that I created was strictly local utilizing Docker, specifically the Docker Toolbox. The docker-compose.yml file that creates the stack is fairly straightforward. Since the session was about the upcoming changes to the Performance Schema in MySQL 5.7, I chose to use MySQL's official 5.7 Docker image: https://gist.github.com/dtest/23fc9d36a612ff98072f#file-mysql-docker-compose-yml Pay attention to two aspects of this output.
- I am creating a mysql_data container. Using a Data Volume Container is highly recommended when working with any data that should be persisted and not baked into the Docker image.
- I am building the container using the `build` command. Throughout the entire docker-compose.yml file, I am adding additional functionality to base containers provided by the Docker Hub. For the MySQL container, the Dockerfile looks like this: https://gist.github.com/dtest/23fc9d36a612ff98072f#file-mysql-dockerfile
- Install Docker Toolbox on your machine
- Create the docker-machine: https://gist.github.com/dtest/23fc9d36a612ff98072f#file-create_machine-sh
- Clone the dtest/visualize-mysql repository and change into the parent directory. https://gist.github.com/dtest/23fc9d36a612ff98072f#file-clone-repo-sh
- Bring the environment up: https://gist.github.com/dtest/23fc9d36a612ff98072f#file-docker-up-sh
- Verify that the containers are running, noting that the data volume containers should have exited with status 0: https://gist.github.com/dtest/23fc9d36a612ff98072f#file-docker-ps-sh
- You can then point your browser to the Kibana (https://<docker-machine IP>:9292/) and Graphana (https://<docker-machine IP>:8000/) dashboards. The Graphana dashboard requires login, and the default credentials are admin/admin.