# Docker pt-toolkit

**URL:** https://forums.percona.com/t/docker-pt-toolkit/34039
**Category:** Percona Toolkit
**Created:** [September 30, 2024, 5:17pm UTC](https://forums.percona.com/t/docker-pt-toolkit/34039 "2024-09-30T17:17:50Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Jyoti\_Rajai](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/jyoti_rajai/32/4482_2.png) [@Jyoti\_Rajai](https://forums.percona.com/u/Jyoti_Rajai)
#### Post date: [September 30, 2024, 5:17pm UTC](https://forums.percona.com/t/docker-pt-toolkit/34039/1 "2024-09-30T17:17:50Z")

</div>

Hello here,

I have 2 individual servers, Both have docker service on it & MySQL instance are hosted on that servers. On one server A on it’s docker server MySQL primary is hosted, On server B on it’s docker server MySQL Secondary is hosted.  
Now I want to test the pt-table-checksum utility, the port for MySQL is used is 24306 on both servers. here is the code I have used it but it throws connectivity error :

```auto
#!/bin/bash

PRIMARY_HOST_IP="servera"

SECONDARY_HOST_IP="serverb"

USER="root"

PASSWORD="XXXXX"

PORT="24306"

# Run pt-table-checksum

pt-table-checksum h=$PRIMARY_HOST_IP,u=$USER,p=$PASSWORD,P=$PORT --no-check-binlog-format \

    --databases=$(mysql -h $PRIMARY_HOST_IP -u$USER -p$PASSWORD -P=$PORT\

    -NBe "SELECT GROUP_CONCAT(schema_name SEPARATOR ' ') FROM information_schema.schemata \

    WHERE schema_name NOT IN ('mysql','information_schema','performance_schema','sys');")

# Assuming pt-table-checksum has been configured previously to store results in a percona database

UNSYNCED_TABLES=$(mysql -h $SECONDARY_HOST_IP -u$USER -p$PASSWORD -P=$PORT -NBe \

    "SELECT COUNT(*) FROM percona.checksums WHERE (this_crc <> master_crc OR this_cnt <> master_cnt) AND db NOT IN ('mysql','information_schema','performance_schema','sys');")

# Send an alert if there are unsynchronized tables

if [[$UNSYNCED_TABLES -gt 0]]; then

    echo "There are $UNSYNCED_TABLES unsynchronized tables on the secondary server" \

    | mail -s "Database Synchronization Alert" your-email@example.com

fi

```

Error :

```auto
Checking if all tables can be checksummed ...
Starting checksum ...
Cannot connect to P=3306,h=ServerB,p=...,u=root: DBI connect(';host=ServerB;port=3306;mysql_read_default_group=client','root',...) failed: Can't connect to MySQL server on 'ServerB:3306' (110) at /usr/bin/pt-table-checksum line 1639.

Can't call method "selectrow_array" on an undefined value at /usr/bin/pt-table-checksum line 5346.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [ERROR] Unknown suffix '=' used for variable 'port' (value '=24306').
mysql: [ERROR] mysql: Error while setting value '=24306' to 'port'.
mysql_replication_sync_check.sh: 23: -NBe: not found
mysql_replication_sync_check.sh: 25: --databases=: not found
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [ERROR] Unknown suffix '=' used for variable 'port' (value '=24306').
mysql: [ERROR] mysql: Error while setting value '=24306' to 'port'.
mysql_replication_sync_check.sh: 33: SELECT COUNT(*) FROM percona.checksums WHERE (this_crc <> master_crc OR this_cnt <> master_cnt) AND db NOT IN ('mysql','information_schema','performance_schema','sys');: not found
mysql_replication_sync_check.sh: 43: Syntax error: "|" unexpected

                                                    

```

---

<div class="post-metadata">

### Author: ![Jyoti\_Rajai](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/jyoti_rajai/32/4482_2.png) [@Jyoti\_Rajai](https://forums.percona.com/u/Jyoti_Rajai)
#### Post date: [October 2, 2024, 2:07pm UTC](https://forums.percona.com/t/docker-pt-toolkit/34039/2 "2024-10-02T14:07:34Z")

</div>

Hello Anyone / @przemek,  
Can you check?

---

<div class="post-metadata">

### Author: ![Yunus](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/yunus/32/6430_2.png) [@Yunus](https://forums.percona.com/u/Yunus)
#### Post date: [October 4, 2024, 4:46pm UTC](https://forums.percona.com/t/docker-pt-toolkit/34039/3 "2024-10-04T16:46:38Z")

</div>

> [@Jyoti\_Rajai](#):
>
> ` --databases=$(mysql -h $PRIMARY_HOST_IP -u$USER -p$PASSWORD -P=$PORT\`

You should not be using -P=

> [@Jyoti\_Rajai](#):
>
> `mysql: [ERROR] Unknown suffix '=' used for variable 'port' (value '=24306').`

Here it is giving the error that it cannot use “=” along with port defined.  
Just use -P$PORT

---

<div class="post-metadata">

### Author: ![Jyoti\_Rajai](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/jyoti_rajai/32/4482_2.png) [@Jyoti\_Rajai](https://forums.percona.com/u/Jyoti_Rajai)
#### Post date: [October 10, 2024, 7:40am UTC](https://forums.percona.com/t/docker-pt-toolkit/34039/4 "2024-10-10T07:40:30Z")

</div>

root@mysql-north-us-u2284:~/mysql\_crons# sh mysql\_replication\_sync\_check.sh  
Checking if all tables can be checksummed …  
Starting checksum …  
Cannot connect to P=3306,h=XXapp,p=…,u=root: DBI connect(‘;host=XXpp;port=3306;mysql\_read\_default\_group=client’,‘root’,…) failed: Can’t connect to MySQL server on ‘XXXio.app:3306’ (110) at /usr/bin/pt-table-checksum line 1639.

Can’t call method “selectrow\_array” on an undefined value at /usr/bin/pt-table-checksum line 5346.  
mysql: [Warning] Using a password on the command line interface can be insecure.  
mysql: [ERROR] Unknown suffix ‘=’ used for variable ‘port’ (value ‘=24306’).  
mysql: [ERROR] mysql: Error while setting value ‘=24306’ to ‘port’.  
mysql\_replication\_sync\_check.sh: 23: -NBe: not found  
mysql\_replication\_sync\_check.sh: 25: --databases=: not found  
mysql: [Warning] Using a password on the command line interface can be insecure.  
mysql: [ERROR] mysql: option ‘-e’ requires an argument.  
mysql\_replication\_sync\_check.sh: 33: SELECT COUNT(\*) FROM percona.checksums WHERE (this\_crc \<\> master\_crc OR this\_cnt \<\> master\_cnt) AND db NOT IN (‘mysql’,‘information\_schema’,‘performance\_schema’,‘sys’);: not found  
mysql\_replication\_sync\_check.sh: 43: Syntax error: “|” unexpected  
root@mysql-north-us-u2284:~/mysql\_crons#

---

<div class="post-metadata">

### Author: ![Yunus](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/yunus/32/6430_2.png) [@Yunus](https://forums.percona.com/u/Yunus)
#### Post date: [October 11, 2024, 3:04am UTC](https://forums.percona.com/t/docker-pt-toolkit/34039/5 "2024-10-11T03:04:16Z")

</div>

> [@Jyoti\_Rajai](#):
>
> mysql: [ERROR] Unknown suffix ‘=’ used for variable ‘port’ (value ‘=24306’).  
> mysql: [ERROR] mysql: Error while setting value ‘=24306’ to ‘port’.

Its same that you are trying to set the port with non integer value with “=”
