Percona Toolkit on Windows

Percona Toolkit contains a lot of useful tools for DBA. Most of the tools works fine under Windows, but the implementation of Percona Toolkit in Windows is a little trickier than in Linux world.

Here is the list of the tools i’ve used successfully under Windows :

pt-variable-advisor : Advices on configuration problems
pt-deadlock-logger : Logs the deadlocks
pt-duplicate-key-checker : Shows duplicates keys
pt-query-digest : Format the slow query log
pt-slave-delay : make a slave lag behind master
pt-table-checksum : Checks replication integrity
pt-table-sync : Repairs broken replication

If you want to use PT on Windows, the first step is to download a perl environment for Windows, personaly i use Strawberry Perl. Installation is as simple as “next”, “next”, … , “finish”. DBD-MySQL which is a required library for PT is installed by default with this distribution.

After this step, you can use PT from the command line :
C:\Percona Toolkit>perl pt-variable-advisor -uroot -ppwd localhost

So, what’s the problem ? Tools like “pt-deadlock-logger” or “pt-slave-delay” have sense when they are daemonized – or in Windows terms – when they run as a service ! Percona Toolkits has the option “–daemonize” but unfortunatly this is a linux only feature.

The solution is NSSM, here is the “HowTo” for pt-slave-delay !

From the command line
C:\>nssm install SlaveDelay

Application tab :
Path : C:\Strawberry\perl\bin\perl.exe
Startup directory : C:\Percona Toolkit
Arguments : pt-slave-delay –delay 2h -uroot -ppwd localhost

Details tab
Description of the service and startup type

I/O tab :
stdout : C:\Percona Toolkit\log\SlaveDelay.log
stderr : C:\Percona Toolkit\log\SlaveDelay.log

Then “Install service”

From the command line :
C:\>net start SlaveDelay

Note :
– NSSM included in Strawberry, but it’s an old version so i suggest you to download the lastest version at https://nssm.cc/.
– Full help on NSSM here : https://nssm.cc/usage
– Full help for percona toolkits : http://www.percona.com/software/percona-toolkit

Et voilà !

Marc.

2 thoughts on “Percona Toolkit on Windows”

  1. dbForge Studio for MySQL support for Percona (PAM Percona, TokuDB as well) and works under Windows. I can recommend it to you. Real good tool!

    1. Hello Tony,

      I’m using Devart tools in my company :
      – dotConnect & dotConnect Universal for .Net projets
      – MyDac for Delphi

      I really apreciate them, i never tried dbForge Studio for MySQL !

Leave a Reply to Tony Cancel reply

Your email address will not be published. Required fields are marked *