pt-config-diff

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

 

1、用法

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

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

[html]  view plain  copy
  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  
  2. 35 config differences  
  3. Variable                  slave159                  kfpanda  
  4. ========================= ========================= =========================  
  5. basedir                   /opt/mysql-5.5.41         /usr/local/mysql  
  6. character_sets_dir        /opt/mysql-5.5.41/shar... /usr/local/mysql/share...  
  7. datadir                   /u02/data_3307/           /home/opaqdata/data/  
  8. event_scheduler           ON                        OFF  
  9. expire_logs_days          3                         0  
  10. general_log               ON                        OFF  
  11. general_log_file          /u02/data_3307/slave15... /home/opaqdata/data/kf...  
  12. hostname                  slave159                  kfpanda  
  13. innodb_version            5.5.41-tokudb-7.5.5       5.5.30-tokudb-7.0.1  
  14. lc_messages_dir           /opt/mysql-5.5.41/share/  /usr/local/mysql/share/  
  15. log                       ON                        OFF  
  16. log_bin_trust_function... ON                        OFF  
  17. log_error                 /u02/data_3307/slave15... /home/opaqdata/data/kf...  
  18. max_allowed_packet        5242880                   1048576  
  19. max_long_data_size        5242880                   1048576  
  20. open_files_limit          65534                     2500  
  21. pid_file                  /u02/data_3307/slave15... /home/opaqdata/data/kf...  
  22. plugin_dir                /opt/mysql-5.5.41/lib/... /usr/local/mysql/lib/p...  
  23. query_cache_size          0                         33554432  
  24. query_cache_type          OFF                       ON  
  25. server_id                 159                       1  
  26. skip_name_resolve         ON                        OFF  
  27. slow_query_log_file       /u02/data_3307/slave15... /home/opaqdata/data/kf...  
  28. socket                    /tmp/mysqltwo.sock        /tmp/mysql.sock  
  29. sort_buffer_size          31457280                  2097152  
  30. thread_stack              262144                    512000  
  31. tokudb_analyze_time       5                         60  
  32. tokudb_cache_size         16817350656               980219904  
  33. tokudb_commit_sync        OFF                       ON  
  34. tokudb_load_save_space    ON                        OFF  
  35. tokudb_max_lock_memory    2102168832                122527488  
  36. tokudb_read_block_size    65536                     131072  
  37. tokudb_row_format         tokudb_fast               tokudb_default  
  38. tokudb_version            tokudb-7.5.5              7.0.1  
  39. version                   5.5.41-tokudb-7.5.5-log   5.5.30-tokudb-7.0.1-log  
例2、比较配置文件和服务器配置
[html]  view plain  copy
  1. [root@slave159 test]# pt-config-diff /etc/my.cnf  h=192.168.60.159 --user=huang --password=huang  
  2. 2 config differences  
  3. Variable                  /etc/my.cnf slave159  
  4. ========================= =========== ========  
  5. sort_buffer_size          16777216    31457280  
  6. table_open_cache          510         512  
例3、比较两个文件得差异
[html]  view plain  copy
  1. [root@slave159 test]# pt-config-diff /etc/my.cnf  /opt/mysql-5.5.41/my.cnf   
  2. 2 config differences  
  3. Variable                  /etc/my.cnf /opt/mysql-5.5.41/my.cnf  
  4. ========================= =========== ========================  
  5. sort_buffer_size          16777216    31457280  
  6. table_open_cache          510         512  
--help
[html]  view plain  copy
  1. [root@slave159 test]# pt-config-diff --help  
  2. pt-config-diff diffs MySQL configuration files and server variables. CONFIG can  
  3. be a filename or a DSN.  At least two CONFIG sources must be given.  Like  
  4. standard Unix diff, there is no output if there are no differences.  For more  
  5. details, please use the --help option, or try 'perldoc  
  6. /usr/local/bin/pt-config-diff' for complete documentation.  
  7.   
  8. Usage: pt-config-diff [OPTIONS] CONFIG CONFIG [CONFIG...]  
  9.   
  10. Options:  
  11.   
  12.   --ask-pass            Prompt for a password when connecting to MySQL  
  13.   --charset=s       -A  Default character set  
  14.   --config=A            Read this comma-separated list of config files; if  
  15.                         specified, this must be the first option on the command  
  16.                         line. (This option does not specify a CONFIG; it's  
  17.                         equivalent to --defaults-file.)  
  18.   --database=s      -D  Connect to this database  
  19.   --defaults-file=s -F  Only read mysql options from the given file  
  20.   --help                Show help and exit  
  21.   --host=s          -h  Connect to host  
  22.   --[no]ignore-case     Compare the variables case-insensitively (default yes)  
  23.   --ignore-variables=a  Ignore, do not compare, these variables  
  24.   --password=s      -p  Password to use for connection  
  25.   --pid=s               Create the given PID file  
  26.   --port=i          -P  Port number to use for connection  
  27.   --[no]report          Print the MySQL config diff report to STDOUT (default  
  28.                         yes)  
  29.   --report-width=i      Truncate report lines to this many characters (default  
  30.                         78)  
  31.   --set-vars=A          Set the MySQL variables in this comma-separated list of  
  32.                         variable=value pairs  
  33.   --socket=s        -S  Socket file to use for connection  
  34.   --user=s          -u  MySQL user if not current user  
  35.   --version             Show version and exit  
  36.   --[no]version-check   Check for the latest version of Percona Toolkit, MySQL,  
  37.                         and other programs (default yes)  
  38.   
  39. Option types: s=stringi=integerf=float, h/H/a/A=comma-separated list, d=DSNz=sizem=time  
  40.   
  41. Rules:  
  42.   
  43.   This tool accepts additional command-line arguments. Refer to the SYNOPSIS and usage information for details.  
  44.   
  45. DSN syntax is key=value[,key=value...]  Allowable DSN keys:  
  46.   
  47.   KEY  COPY  MEANING  
  48.   ===  ====  =============================================  
  49.   A    yes   Default character set  
  50.   D    yes   Default database  
  51.   F    yes   Only read default options from the given file  
  52.   P    yes   Port number to use for connection  
  53.   S    yes   Socket file to use for connection  
  54.   h    yes   Connect to host  
  55.   p    yes   Password to use when connecting  
  56.   u    yes   User for login if not current user  
  57.   
  58.   If the DSN is a bareword, the word is treated as the 'h' key.  
  59.   
  60. Options and values after processing arguments:  
  61.   
  62.   --ask-pass            FALSE  
  63.   --charset             (No value)  
  64.   --config              /etc/percona-toolkit/percona-toolkit.conf,/etc/percona-toolkit/pt-config-diff.conf,/root/.percona-toolkit.conf,/root/.pt-config-diff.conf  
  65.   --database            (No value)  
  66.   --defaults-file       (No value)  
  67.   --help                TRUE  
  68.   --host                (No value)  
  69.   --ignore-case         TRUE  
  70.   --ignore-variables    (No value)  
  71.   --password            (No value)  
  72.   --pid                 (No value)  
  73.   --port                (No value)  
  74.   --report              TRUE  
  75.   --report-width        78  
  76.   --set-vars              
  77.   --socket              (No value)  
  78.   --user                (No value)  
  79.   --version             FALSE  
  80.   --version-check       TRUE  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值