pt-config-diff

对比配置文件与配置文件、服务器与服务器 或者 配置文件与服务器 之前的参数差异。

 

1、用法

 pt-config-diff [OPTION...] CONFIG CONFIG [CONFIG...]
 CONFIG可以是文件也可以是数据源名称,最少必须指定两个配置文件源,就像unix下面的diff命令一样,如果配置完全一样就不会输出任何东西

例1、比较本地和远程服务器配置差异

[root@slave159 test]# pt-config-diff h=192.168.60.159 --user=huang --password=huang  h=192.168.61.42 --user=huang --password=huang
35 config differences
Variable                  slave159                  kfpanda
========================= ========================= =========================
basedir                   /opt/mysql-5.5.41         /usr/local/mysql
character_sets_dir        /opt/mysql-5.5.41/shar... /usr/local/mysql/share...
datadir                   /u02/data_3307/           /home/opaqdata/data/
event_scheduler           ON                        OFF
expire_logs_days          3                         0
general_log               ON                        OFF
general_log_file          /u02/data_3307/slave15... /home/opaqdata/data/kf...
hostname                  slave159                  kfpanda
innodb_version            5.5.41-tokudb-7.5.5       5.5.30-tokudb-7.0.1
lc_messages_dir           /opt/mysql-5.5.41/share/  /usr/local/mysql/share/
log                       ON                        OFF
log_bin_trust_function... ON                        OFF
log_error                 /u02/data_3307/slave15... /home/opaqdata/data/kf...
max_allowed_packet        5242880                   1048576
max_long_data_size        5242880                   1048576
open_files_limit          65534                     2500
pid_file                  /u02/data_3307/slave15... /home/opaqdata/data/kf...
plugin_dir                /opt/mysql-5.5.41/lib/... /usr/local/mysql/lib/p...
query_cache_size          0                         33554432
query_cache_type          OFF                       ON
server_id                 159                       1
skip_name_resolve         ON                        OFF
slow_query_log_file       /u02/data_3307/slave15... /home/opaqdata/data/kf...
socket                    /tmp/mysqltwo.sock        /tmp/mysql.sock
sort_buffer_size          31457280                  2097152
thread_stack              262144                    512000
tokudb_analyze_time       5                         60
tokudb_cache_size         16817350656               980219904
tokudb_commit_sync        OFF                       ON
tokudb_load_save_space    ON                        OFF
tokudb_max_lock_memory    2102168832                122527488
tokudb_read_block_size    65536                     131072
tokudb_row_format         tokudb_fast               tokudb_default
tokudb_version            tokudb-7.5.5              7.0.1
version                   5.5.41-tokudb-7.5.5-log   5.5.30-tokudb-7.0.1-log
例2、比较配置文件和服务器配置
[root@slave159 test]# pt-config-diff /etc/my.cnf  h=192.168.60.159 --user=huang --password=huang
2 config differences
Variable                  /etc/my.cnf slave159
========================= =========== ========
sort_buffer_size          16777216    31457280
table_open_cache          510         512
例3、比较两个文件得差异
[root@slave159 test]# pt-config-diff /etc/my.cnf  /opt/mysql-5.5.41/my.cnf 
2 config differences
Variable                  /etc/my.cnf /opt/mysql-5.5.41/my.cnf
========================= =========== ========================
sort_buffer_size          16777216    31457280
table_open_cache          510         512
--help
[root@slave159 test]# pt-config-diff --help
pt-config-diff diffs MySQL configuration files and server variables. CONFIG can
be a filename or a DSN.  At least two CONFIG sources must be given.  Like
standard Unix diff, there is no output if there are no differences.  For more
details, please use the --help option, or try 'perldoc
/usr/local/bin/pt-config-diff' for complete documentation.

Usage: pt-config-diff [OPTIONS] CONFIG CONFIG [CONFIG...]

Options:

  --ask-pass            Prompt for a password when connecting to MySQL
  --charset=s       -A  Default character set
  --config=A            Read this comma-separated list of config files; if
                        specified, this must be the first option on the command
                        line. (This option does not specify a CONFIG; it's
                        equivalent to --defaults-file.)
  --database=s      -D  Connect to this database
  --defaults-file=s -F  Only read mysql options from the given file
  --help                Show help and exit
  --host=s          -h  Connect to host
  --[no]ignore-case     Compare the variables case-insensitively (default yes)
  --ignore-variables=a  Ignore, do not compare, these variables
  --password=s      -p  Password to use for connection
  --pid=s               Create the given PID file
  --port=i          -P  Port number to use for connection
  --[no]report          Print the MySQL config diff report to STDOUT (default
                        yes)
  --report-width=i      Truncate report lines to this many characters (default
                        78)
  --set-vars=A          Set the MySQL variables in this comma-separated list of
                        variable=value pairs
  --socket=s        -S  Socket file to use for connection
  --user=s          -u  MySQL user if not current user
  --version             Show version and exit
  --[no]version-check   Check for the latest version of Percona Toolkit, MySQL,
                        and other programs (default yes)

Option types: s=string, i=integer, f=float, h/H/a/A=comma-separated list, d=DSN, z=size, m=time

Rules:

  This tool accepts additional command-line arguments. Refer to the SYNOPSIS and usage information for details.

DSN syntax is key=value[,key=value...]  Allowable DSN keys:

  KEY  COPY  MEANING
  ===  ====  =============================================
  A    yes   Default character set
  D    yes   Default database
  F    yes   Only read default options from the given file
  P    yes   Port number to use for connection
  S    yes   Socket file to use for connection
  h    yes   Connect to host
  p    yes   Password to use when connecting
  u    yes   User for login if not current user

  If the DSN is a bareword, the word is treated as the 'h' key.

Options and values after processing arguments:

  --ask-pass            FALSE
  --charset             (No value)
  --config              /etc/percona-toolkit/percona-toolkit.conf,/etc/percona-toolkit/pt-config-diff.conf,/root/.percona-toolkit.conf,/root/.pt-config-diff.conf
  --database            (No value)
  --defaults-file       (No value)
  --help                TRUE
  --host                (No value)
  --ignore-case         TRUE
  --ignore-variables    (No value)
  --password            (No value)
  --pid                 (No value)
  --port                (No value)
  --report              TRUE
  --report-width        78
  --set-vars            
  --socket              (No value)
  --user                (No value)
  --version             FALSE
  --version-check       TRUE


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值