Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I'm new to Percona tools. I am trying to use pt-table-checksum as follows:

pt-table-checksum h=localhost -u root -p xyz--replicate=percona.checksums --create-replicate-table --databases=mysql

But get the error.

Diffs cannot be detected because no slaves were found

Please read the --recursion-method documentation for information.

My.cnf

#password       = your_password
port            = 3306
socket          = /tmp/mysql.sock
default-character-set=utf8

[mysqld]
datadir=/spacedb
socket=/tmp/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
init-connect='SET NAMES utf8'
character-set-server = utf8
max_connections = 300

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[mysqladmin]
socket=/tmp/mysql.sock

[mysql]
socket=/tmp/mysql.sock
default-character-set=utf8

[mysqld_multi]
mysqld     = /usr/bin/mysqld_safe
mysqladmin = /usr/bin/mysqladmin
user       = multi_admin
password   = user

[mysqld1]
socket     = /tmp/mysql.sock
port       = 3306
pid-file   = /var/run/mysqld/mysqld.pid
datadir    = /spacedb
language   = /usr/share/mysql/english
server-id  = 1
log-bin    = mysql-bin
binlog_format = mixed

# Expire_logs + MaxBinlogSize
expire_logs_days = 7
max_binlog_size = 100M

sync_binlog = 1
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout=1

init-connect='SET NAMES utf8'
character-set-server = utf8
max_connections = 300

[mysqld2]
socket     = /tmp/mysql.sock2
port       = 3307
pid-file   = /var/run/mysqld/mysqld2.pid
datadir    = /repdb
language   = /usr/share/mysql/english
server-id  = 2
relay-log  = mysqld2-relay-bin

innodb_lock_wait_timeout=1
init-connect='SET NAMES utf8'
character-set-server = utf8

Do I have to use DSN? And how does it work?

share|improve this question
add comment

1 Answer

According to the Documentation on --recursion-method

Preferred recursion method for discovering replicas. Possible methods are:

METHOD       USES
===========  ==================
processlist  SHOW PROCESSLIST
hosts        SHOW SLAVE HOSTS
dsn=DSN      DSNs from a table

The processlist method is the default, because SHOW SLAVE HOSTS is not reliable. However, the hosts method can work better if the server uses a non-standard port (not 3306). The tool usually does the right thing and finds all replicas, but you may give a preferred method and it will be used first.

The hosts method requires replicas to be configured with report_host, report_port, etc.

The dsn method is special: it specifies a table from which other DSN strings are read. The specified DSN must specify a D and t, or a database-qualified t. The DSN table should have the following structure:

CREATE TABLE `dsns`
(
   `id` int(11) NOT NULL AUTO_INCREMENT,  
   `parent_id` int(11) DEFAULT NULL,
   `dsn` varchar(255) NOT NULL,  
   PRIMARY KEY (`id`)
);

To make the tool monitor only the hosts 10.10.1.16 and 10.10.1.17 for replication lag and checksum differences, insert the values h=10.10.1.16 and h=10.10.1.17 into the table. Currently, the DSNs are ordered by id, but id and parent_id are otherwise ignored.

You could do this setup for DSN if you want, but you do not have to go that far yet. Why?

The default --recursion-method is the processlist. This simply means that you did not run START SLAVE; on the port 3307 instance. You cannot use --recursion-method processlist on a Master where all the Slaves are stopped. When you run START SLAVE; on port 3307, a DB Connection should appear in the processlist of the Master (3306 instance) from the Slave (3307 instance). In light of this, you should just run START SLAVE; on port 3307 and then run the pt-table-checksum.

Give it a Try !!!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.