How should I register the pmm agent on slave DBs?

I am trying to monitor a Mysql DB cluster of 2 DBs (1 master - 1 slave) and I was able to install the agent and register it against pmm server but the slave is having issues, once I followed the same steps Mysql Slave went down.

On the slave, the agent is installed a reporting server’s status but the agent is not registered in the DB.

Do I need to add some kind of flag to tell pmm agent that the registration is on a slave server?

Is there any procedure to do this? I wonder if once the pmm user is created on master it will replicate this user to slave so does that mean that I do not need to create the agent on the slave server?

example:

pmm-admin add mysql --username=<MYSQL_USER> --password=<MYSQL_PASSWORD> --query-source=perfschema –replication

@jsalazar Did you register the slave node on the PMM server?

As per your command, you have missed the replication-set name.

Here is an example of adding a slave node:

  1. pmm-admin config --server-insecure-tls --server-url=http://admin:XXXXXXXXX@101.1.1.11 --custom-labels=“” --region=“” 192.1.1.52 generic test123

  2. pmm-admin add mysql --server-insecure-tls --username=‘pmm_usr’ --password=‘XXXXXXXXX’ --host=‘192.1.1.52’ --port=3306 --service-name=<> --query-source=<> --environment=test –replication-set=test-slave

NOTE: Based on your requirements, you can adjust and add them.

Hi @Naresh9999 , thanks for your quick reply and for clarifying how to add a MySQL slave properly, I will incorporate the solution to my Chef cookbook for automation.

However, I managed to fix the issue before your reply by re-running the commands manually on each slave node while the nodes were down, it seems that chef-client could not create the pmm user after it was created in master and master replicate it to the slave, so I had to skip the problematic pmm user creation query and just ran:

pmm-admin add mysql --username=<MYSQL_USER> --password=<MYSQL_PASSWORD> --query-source=perfschema

and it worked because pmm user was already set with the privileges.

So not sure how critical is to have the replication-set flag added to the command and how it differs from my approach above.

Could you provide more information on this, please?

@jsalazar Nothing is critical here, but to manage the servers and filter the service, it will be easy.

This is how it will be useful if you have many replica sets.

1 Like

Hey @Naresh9999 , thanks for letting me know. It makes sense now, I will add this flag to the command then for future references on our clusters.

Have a great day.

1 Like