Coder Social home page Coder Social logo

simhaonline / proxysql-pmm-mysql_docker_cluster Goto Github PK

View Code? Open in Web Editor NEW

This project forked from taherbs/proxysql-pmm-mysql_docker_cluster

0.0 0.0 0.0 120 KB

Small cluster consisting of 3x MySQL 5.7 containers (1x Master and 2x Slaves), a ProxySQL 2.0.4 container and and a Percona Monitoring and Management server.

License: MIT License

Makefile 2.64% Shell 85.06% Dockerfile 12.30%

proxysql-pmm-mysql_docker_cluster's Introduction

ProxySQL/PMM/MySQL Docker cluster

MIT licensed

This repository contains a docker-compose.yml used to launch a small cluster consisting of 3x MySQL 5.7 containers (1x Master and 2x Slaves), a ProxySQL 2.0.4 container and and a Percona Monitoring and Management server (PMM SERVER) all connected via a lan network.

  • ProxySQL is automatically configured with 2x hostgroups, a writer hostgroup used as the default hostgroup and a reader hostgroup for all SELECT statements.
  • PMM monitoring can enabled/disabled from the docker-composer b changing the value of the "ENABLE_PMM_MONITORING" env variable.

Bellow is displayed a simplified diagram of the project architecture: Project Simplified Architecture

Config and Pre-requisites

The MySQL and ProxySQL have separate directories with their respective configuration in the conf directory. You can override any of the MySQL 5.7 variables by editing the my.cnf located in the respective subdirectory under conf for each container (i.e. conf/mysql/mysqlmaster/my.cnf, conf/mysql/mysqlslave1/my.cnf, conf/mysql/mysqlslave2/my.cnf). Its also possible to edit the ProxySQL config or the PMM client config script files as needed.

Note that you'll need the following pre-requisites installed on your host machine:

  • docker-ce / docker-ee (17.12+ required)
  • docker-compose (1.19+ required)
  • mysql-client (5.7+ required)
  • sysbench (1.0.12+ recommended if benchmarking)

Usage

# To start the cluster:
make init

# To delete the cluster:
make delete

# To reload the cluster after config changes:
make reload

Testing and Benchmarking

You can run benchmarking to simulate different SQL queries ( DROP/CREATE/UPDATE/SELECT) on the sysbench database.

# To run benchmarking:
make test

PMM Dashboards

PMM Architecture

Useful ProxySQL commands

Bellow some useful SLQ commands that could be run on the ProxySQL server to collect different type of stats:

# Connect to the ProxySQL DB
mysql -h "127.0.0.1" -u radmin -p'radmin' -P 16032

# Show top 5 queries based on total execution time:
SELECT digest,SUBSTR(digest_text,0,25),count_star,sum_time FROM stats_mysql_query_digest WHERE digest_text LIKE 'SELECT%' ORDER BY sum_time DESC LIMIT 5;

# Show the top 5 queries based on count:
SELECT digest,SUBSTR(digest_text,0,25),count_star,sum_time FROM stats_mysql_query_digest WHERE digest_text LIKE 'SELECT%' ORDER BY count_star DESC LIMIT 5;

# Show the top 5 queries based on maximum execution time:
SELECT digest,SUBSTR(digest_text,0,25),count_star,sum_time,sum_time/count_star avg_time, min_time, max_time FROM stats_mysql_query_digest WHERE digest_text LIKE 'SELECT%' ORDER BY max_time DESC LIMIT 5;

# Check how much times each rule have been executed
SELECT * FROM stats_mysql_query_rules;

# Check queries count categorized by command type
SELECT * FROM stats_mysql_commands_counters;

# Check servers connection logs
SELECT * FROM mysql_server_connect_log;
SELECT * FROM mysql_server_ping_log;
SELECT * FROM mysql_server_read_only_log;

Useful Documentation links

proxysql-pmm-mysql_docker_cluster's People

Contributors

taherbs avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.