pt-stalk get wrong mysqld pid when the host installed multi mysql instance

Bug #1644694 reported by zhechen
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Toolkit moved to
Carlos Salguero

Bug Description

host env:
    Centos 6.8

two mysql instance:
    $ pidof mysqld
    33530 17881

my host have two mysql instance, 3304 port(pid: 17881) and 3306 port(pid: 33530), when I use pt-stalk to monitor 3304 port, the mysql info logs in /var/lib/pt-stalk/ is about 3306 port, this is wrong, I just want log the mysql 3304 port.

the following code in pt-stalk mabye get wrong mysql pid:

   792 collect() {
   793 local d="$1" # directory to save results in
   794 local p="$2" # prefix for each result file
   796 local mysqld_pid=$(_pidof mysqld | awk '{print $1; exit;}')

the subsequent mysql info will be wrong when mysqld_pid is wrong, pt-stalk should read mysql pid_file to get right pid number.

Tags: pt-stalk
Revision history for this message
Jericho Rivera (jericho-rivera) wrote :

With port=3307 option only it will not pick the right instance:
[root@multi ~]# bash -x pt-stalk --no-stalk --iterations=2 --sleep=30 --user=root --password=p3rc0na --port=3307 > stalk.out 2>&1
[root@multi ~]# grep ^port /var/lib/pt-stalk/*-variables
/var/lib/pt-stalk/2016_11_25_04_49_31-variables:port 3306
/var/lib/pt-stalk/2016_11_25_04_50_01-variables:port 3306

Using the socket will pick the right instance:
[root@multi ~]# bash -x pt-stalk --no-stalk --iterations=2 --sleep=30 --user=root --password=p3rc0na --socket=/tmp/mysql1.sock > stalk1.out 2>&1
[root@multi ~]# grep ^port /var/lib/pt-stalk/*-variables
/var/lib/pt-stalk/2016_11_25_04_49_31-variables:port 3306
/var/lib/pt-stalk/2016_11_25_04_50_01-variables:port 3306
/var/lib/pt-stalk/2016_11_25_04_57_36-variables:port 3307
/var/lib/pt-stalk/2016_11_25_04_58_06-variables:port 3307

attaching stalk.out file using the port=3307 option only

tags: added: pt-stalk
Changed in percona-toolkit:
status: New → Confirmed
Changed in percona-toolkit:
assignee: nobody → Carlos Salguero (carlos-salguero)
milestone: none → 2.2.21
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to:

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.