{"id":22870908,"url":"https://github.com/percona-lab/pt-mysql-config-diff","last_synced_at":"2025-05-05T22:16:43.074Z","repository":{"id":57613661,"uuid":"90979052","full_name":"Percona-Lab/pt-mysql-config-diff","owner":"Percona-Lab","description":"A tool like pt-config-diff written in Go","archived":false,"fork":false,"pushed_at":"2020-07-10T23:28:14.000Z","size":57,"stargazers_count":11,"open_issues_count":1,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-05T22:16:36.354Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Percona-Lab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-11T12:54:31.000Z","updated_at":"2023-11-09T09:28:05.000Z","dependencies_parsed_at":"2022-09-10T23:31:10.633Z","dependency_job_id":null,"html_url":"https://github.com/Percona-Lab/pt-mysql-config-diff","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Percona-Lab%2Fpt-mysql-config-diff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Percona-Lab%2Fpt-mysql-config-diff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Percona-Lab%2Fpt-mysql-config-diff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Percona-Lab%2Fpt-mysql-config-diff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Percona-Lab","download_url":"https://codeload.github.com/Percona-Lab/pt-mysql-config-diff/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252584333,"owners_count":21771945,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-13T13:16:34.096Z","updated_at":"2025-05-05T22:16:43.011Z","avatar_url":"https://github.com/Percona-Lab.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MySQL Config Diff\r\n\r\nThis program can compare configurations and default values from different MySQL config sources like cnf files, SHOW VARIABLES and MySQL defaults parsed from `mysqld` help.  \r\n\r\n## Usage\r\n\r\n```\r\npt-mysql-config-diff [--format=text/json] \u003csrc_1\u003e \u003csrc_2\u003e\r\n```\r\n\r\nwhere `src` could be a file name pointing to a `.cnf` file or to a file having MySQL default values from `mysqld` help or a dsn in the form of a default pt-tool dsn parameter: `h=\u003chost\u003e,P=\u003cport\u003e,u=\u003cuser\u003e,p=\u003cpassword\u003e`.\r\n\r\n## Usage examples\r\n### Comparing .cnf vs .cnf files.\r\nWhen comparing 2 `cnf` files, the program will show all keys having differences between the 2 files, including missing keys in both files.\r\n\r\n```\r\npt-mysql-config-diff file1.cnf file2.cnf\r\n```\r\n\r\n**Example:**\r\n\r\n`cnf1.cnf`\r\n```\r\n[mysqld]\r\nkey1=value1\r\nkey2= 2\r\nkey3= true\r\n```\r\n\r\n`cnf2.cnf`\r\n```\r\n[mysqld]\r\nkey1=value1\r\nkey2=3\r\nkey4=true\r\n```\r\n\r\n`./pt-mysql-config-diff --format=text cnf1.cnf cnf2.cnf`\r\n```\r\nkey2:         2 \u003c-\u003e         3\r\nkey3:      true \u003c-\u003e \u003cMissing\u003e\r\nkey4: \u003cMissing\u003e \u003c-\u003e      true\r\n```\r\n\r\n### Comparing .cnf vs SHOW VARIABLES\r\n\r\nWhen comparing `.cnf` files vs `SHOW VARIABLES`, only configuration variables that exist in the cnf file are compared.  \r\n\r\n**Example: comparing a cnf vs a MySQL 5.7 instance**  \r\n\r\n`cnf3.cnf`  \r\n```\r\n[mysqld]\r\ninnodb_buffer_pool_size=512M\r\nlog_slow_rate_limit=100.1234\r\nlog_slow_verbosity=full\r\n```\r\n\r\n`./pt-mysql-config-diff --format=text ~/cnf3.cnf h=127.1,P=3306,u=root`  \r\n```\r\n     log_slow_verbosity:      full \u003c-\u003e \u003cMissing\u003e\r\ninnodb_buffer_pool_size: 536870912 \u003c-\u003e 134217728\r\n    log_slow_rate_limit:  100.1234 \u003c-\u003e \u003cMissing\u003e\r\n```\r\n\r\n### Comparing SHOW VARIABLES vs SHOW VARIABLES\r\n\r\nWhen comparing the same type of configs (SHOW VARIABLES on both sides), the program will show all keys having differences between the 2 instances, including missing keys in both sides.  \r\n\r\n**Example: Comparing MySQL 5.7 vs MySQL 5.6**  \r\n*Note: the output has been truncated and only a few values are here as an example*  \r\n\r\nHaving MySQL 5.7 on port `3306` and MySQL 5.6 on port `3308`:  \r\n\r\n`./pt-mysql-config-diff --format=text h=127.1,P=3306,u=root h=127.1,P=3308,u=root`  \r\n\r\n```\r\n\r\n                                          innodb_version:                                5.7.20 \u003c-\u003e                               5.6.38\r\n                      innodb_buffer_pool_load_at_startup:                                     1 \u003c-\u003e                                    0\r\n                                    session_track_schema:                                    ON \u003c-\u003e                            \u003cMissing\u003e\r\n                                                ssl_cert:                       server-cert.pem \u003c-\u003e                                     \r\n                    performance_schema_setup_actors_size:                                    -1 \u003c-\u003e                                  100\r\n                                           timed_mutexes:                             \u003cMissing\u003e \u003c-\u003e                                  OFF\r\n                  performance_schema_max_mutex_instances:                                    -1 \u003c-\u003e                                15906\r\n                                   innodb_undo_directory:                                    ./ \u003c-\u003e                                    .\r\n                         simplified_binlog_gtid_recovery:                             \u003cMissing\u003e \u003c-\u003e                                  OFF\r\n                                     session_track_gtids:                                   OFF \u003c-\u003e                            \u003cMissing\u003e\r\n                             sha256_password_proxy_users:                                   OFF \u003c-\u003e                            \u003cMissing\u003e\r\n                                           rbr_exec_mode:                                STRICT \u003c-\u003e                            \u003cMissing\u003e\r\n                    performance_schema_max_table_handles:                                    -1 \u003c-\u003e                                 4000\r\n                   performance_schema_max_metadata_locks:                                    -1 \u003c-\u003e                            \u003cMissing\u003e\r\n                        log_statements_unsafe_for_binlog:                                    ON \u003c-\u003e                            \u003cMissing\u003e\r\n\r\n```\r\n\r\n### Getting the list of variables having non-default values\r\n\r\nTo achieve this, you first need to generate a list of defaults for the MySQL version you are running:  \r\n\r\n`touch /tmp/my.cnf`  \r\n`\u003cpath-to-mysql-bin\u003e/mysqld --verbose --defaults-file=/tmp/my.cnf --help \u003e ~/my-5.7.defaults`\r\n\r\nand then you can compare the values from `SHOW VARIABLES` against the defaults:  \r\n\r\n`pt-mysql-config-diff --format=text h=127.1,P=3306,u=root ~/my-5.7.defaults`  \r\n\r\n```\r\n                                                   daemonize:                            \u003cMissing\u003e \u003c-\u003e                               FALSE\r\n                                                   federated:                            \u003cMissing\u003e \u003c-\u003e                                  ON\r\n                                            general_log_file:      /var/lib/mysql/fa5f51a13d1a.log \u003c-\u003e /usr/local/mysql/data/karl-OMEN.log\r\n                                                log_warnings:                                    2 \u003c-\u003e                                   0\r\n       performance_schema_consumer_events_waits_history_long:                            \u003cMissing\u003e \u003c-\u003e                               FALSE\r\n                                           skip_grant_tables:                            \u003cMissing\u003e \u003c-\u003e                               FALSE\r\n                                                   blackhole:                            \u003cMissing\u003e \u003c-\u003e                                  ON\r\n                                                      socket:          /var/run/mysqld/mysqld.sock \u003c-\u003e                     /tmp/mysql.sock\r\n                                            open_files_limit:                              1048576 \u003c-\u003e                                5000\r\n                             performance_schema_digests_size:                                10000 \u003c-\u003e                                  -1\r\n                                                 log_tc_size:                            \u003cMissing\u003e \u003c-\u003e                               24576\r\n                                           myisam_block_size:                            \u003cMissing\u003e \u003c-\u003e                                1024\r\n                                                     datadir:                      /var/lib/mysql/ \u003c-\u003e              /usr/local/mysql/data/\r\n       performance_schema_consumer_events_statements_history:                            \u003cMissing\u003e \u003c-\u003e                                TRUE\r\n                                            log_short_format:                            \u003cMissing\u003e \u003c-\u003e                               FALSE\r\n```\r\n\r\n\r\n### TODO\r\n- [ ] Add option to skip missing values on right/left side\r\n- [ ] Add option to skip certain variables\r\n- [ ] Add option to show big numbers in human readable format (1K, 1M)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpercona-lab%2Fpt-mysql-config-diff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpercona-lab%2Fpt-mysql-config-diff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpercona-lab%2Fpt-mysql-config-diff/lists"}