第七步,拷贝percona-toolkit-2.1.7-1.noarch.rpm
[root@larrywen ule-mysql]# scp percona-toolkit-2.1.7-1.noarch.rpm 192.168.1.11:/opt root@192.168.1.11's password: percona-toolkit-2.1.7-1.noarch.rpm 100% 1767KB 1.7MB/s 00:00
第八步,主服务器中通过yum安装percona-toolkit-2.1.7-1.noarch.rpm
[root@serv01 opt]# yum install percona-toolkit-2.1.7-1.noarch.rpm -y
第九步,使用pt-slave-delay工具进行延时设置。可以先查看帮助。
[root@serv01 opt]# pt-slave-delay --help
pt-slave-delay starts and stops a slave server as needed to make it lag behind
the master. The SLAVE-HOST and MASTER-HOST use DSN syntax, and values are
copied from the SLAVE-HOST to the MASTER-HOST if omitted. For more details,
please use the --help option, or try 'perldoc /usr/bin/pt-slave-delay' for
complete documentation.
Usage: pt-slave-delay [OPTION...] SLAVE-HOST [MASTER-HOST]
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
--[no]continue Continue replication normally on exit (default yes)
--daemonize Fork to the background and detach from the shell
--database=s -D The database to use for the connection
--defaults-file=s -F Only read mysql options from the given file
--delay=m How far the slave should lag its master (default 1h).
Optional suffix s=seconds, m=minutes, h=hours, d=days;
if no suffix, s is used.
--help Show help and exit
--host=s -h Connect to host
--interval=m How frequently pt-slave-delay should check whether the
slave needs to be started or stopped (default 1m).
Optional suffix s=seconds, m=minutes, h=hours, d=days;
if no suffix, s is used.
--log=s Print all output to this file when daemonized
--password=s -p Password to use when connecting
--pid=s Create the given PID file when daemonized
--port=i -P Port number to use for connection
--quiet -q Don't print informational messages about operation
--run-time=m How long pt-slave-delay should run before exiting.
Optional suffix s=seconds, m=minutes, h=hours, d=days;
if no suffix, s is used.
--set-vars=s Set these MySQL variables (default wait_timeout=10000)
--socket=s -S Socket file to use for connection
--use-master Get binlog positions from master, not slave
--user=s -u User for login if not current user
--version Show version and exit
--version-check=s Send program versions to Percona and print suggested
upgrades and problems (default off)
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-slave-delay.conf,/root/.percon