Running PMM1 and PMM2 Clients on the Same Host
source link: https://www.percona.com/blog/2019/11/27/running-pmm1-and-pmm2-clients-on-the-same-host/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Want to try out Percona Monitoring and Management 2 (PMM 2) but you’re not ready to turn off your PMM 1 environment? This blog is for you! Keep in mind that the methods described are not intended to be a long-term migration strategy, but rather, simply a way to deploy a few clients in order to sample PMM 2 before you commit to the upgrade.
Here are step-by-step instructions for deploying PMM 1 & 2 client functionality i.e. pmm-client and pmm2-client, on the same host.
- Deploy PMM 1 on Server1 (you’ve probably already done this)
- Install and setup pmm-client for connectivity to Server1
- Deploy PMM 2 on Server2
- Install and setup pmm2-client for connectivity to Server2
- Remove pmm-client and switched completely to pmm2-client
The first few steps are already described in our PMM1 documentation so we are simply providing links to those documents. Here we’ll focus on steps 4 and 5.
Install and Setup pmm2-client Connectivity to Server2
It’s not possible to install both clients from a repository at the same time. So you’ll need to download a tarball of pmm2-client. Here’s a link to the latest version directly fromour site.
Download pmm2-client Tarball
* Note that depending on when you’re seeing this, the commands below may not be for the latest version, so the commands may need to be updated for the version you downloaded.
$ wget https://www.percona.com/downloads/pmm2/2.1.0/binary/tarball/pmm2-client-2.1.0.tar.gz
Extract Files From pmm2-client Tarball
$ tar -zxvf pmm2-client-2.1.0.tar.gz $ cd pmm2-client-2.1.0
Register and Generate Configuration File
Now it’s time to set up a PMM 2 client. In our example, the PMM2 server IP is 172.17.0.2 and the monitored host IP is 172.17.0.1.
$ ./bin/pmm-agent setup --config-file=config/pmm-agent.yaml \ --paths-node_exporter="$PWD/pmm2-client-2.1.0/bin/node_exporter" \ --paths-mysqld_exporter="$PWD/pmm2-client-2.1.0/bin/mysqld_exporter" \ --paths-mongodb_exporter="$PWD/pmm2-client-2.1.0/bin/mongodb_exporter" \ --paths-postgres_exporter="$PWD/pmm2-client-2.1.0/bin/postgres_exporter" \ --paths-proxysql_exporter="$PWD/pmm2-client-2.1.0/bin/proxysql_exporter" \ --server-insecure-tls --server-address=172.17.0.2:443 \ --server-username=admin --server-password="admin" 172.17.0.1 generic node8.ca
Start pmm-agent
Let’s run the pmm-agent using a screen. There’s no service manager integration when deploying alongside pmm-client, so if your server restarts, pmm-agent won’t automatically resume.
# screen -S pmm-agent
$ ./bin/pmm-agent --config-file="$PWD/config/pmm-agent.yaml"
Check the Current State of the Agent
$ ./bin/pmm-admin list Service type Service name Address and port Service ID Agent type Status Agent ID Service ID pmm-agent connected /agent_id/805db700-3607-40a9-a1fa-be61c76fe755 node_exporter running /agent_id/805eb8f6-3514-4c9b-a05e-c5705755a4be
Add MySQL Service
Detach the screen, then add the mysql service:
$ ./bin/pmm-admin add mysql --use-perfschema --username=root mysqltest MySQL Service added. Service ID : /service_id/28c4a4cd-7f4a-4abd-a999-86528e38992b Service name: mysqltest
Here is the state of pmm-agent:
$ ./bin/pmm-admin list Service type Service name Address and port Service ID MySQL mysqltest 127.0.0.1:3306 /service_id/28c4a4cd-7f4a-4abd-a999-86528e38992b Agent type Status Agent ID Service ID pmm-agent connected /agent_id/805db700-3607-40a9-a1fa-be61c76fe755 node_exporter running /agent_id/805eb8f6-3514-4c9b-a05e-c5705755a4be mysqld_exporter running /agent_id/efb01d86-58a3-401e-ae65-fa8417f9feb2 /service_id/28c4a4cd-7f4a-4abd-a999-86528e38992b qan-mysql-perfschema-agent running /agent_id/26836ca9-0fc7-4991-af23-730e6d282d8d /service_id/28c4a4cd-7f4a-4abd-a999-86528e38992b
Confirm you can see activity in each of the two PMM Servers:
PMM 1 PMM 2Remove pmm-client and Switch Completely to pmm2-client
Once you’ve decided to move over completely to PMM2, it’s better to make a switch from the tarball version to installation fromthe repository. It will allow you to perform client updates much easier as well as register the new agent as a service for automatically starting with the server. Also, we will show you how to make a switch without re-adding monitored instances.
Configure Percona Repositories
$ sudo yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpm $ sudo percona-release disable all $ sudo percona-release enable original release $ yum list | grep pmm pmm-client.x86_64 1.17.2-1.el6 percona-release-x86_64 pmm2-client.x86_64 2.1.0-1.el6 percona-release-x86_64
Here is a link to the apt variant .
Remove pmm-client
yum remove pmm-client
Install pmm2-client
$ yum install pmm2-client Loaded plugins: priorities, update-motd, upgrade-helper 4 packages excluded due to repository priority protections Resolving Dependencies --> Running transaction check ---> Package pmm2-client.x86_64 0:2.1.0-5.el6 will be installed ... Installed: pmm2-client.x86_64 0:2.1.0-5.el6 Complete!
Configure pmm2-client
Let’s copy the currently used pmm2-client configuration file in order to omit re-adding monitored instances.
$ cp pmm2-client-2.1.0/config/pmm-agent.yaml /tmp
It’s required to set the new location of exporters ( /usr/local/percona/pmm2/exporters/ ) in the file.
$ sed -i 's|node_exporter:.*|node_exporter: /usr/local/percona/pmm2/exporters/node_exporter|g' /tmp/pmm-agent.yaml $ sed -i 's|mysqld_exporter:.*|mysqld_exporter: /usr/local/percona/pmm2/exporters/mysqld_exporter|g' /tmp/pmm-agent.yaml $ sed -i 's|mongodb_exporter:.*|mongodb_exporter: /usr/local/percona/pmm2/exporters/mongodb_exporter|g' /tmp/pmm-agent.yaml $ sed -i 's|postgres_exporter:.*|postgres_exporter: /usr/local/percona/pmm2/exporters/postgres_exporter|g' /tmp/pmm-agent.yaml $ sed -i 's|proxysql_exporter:.*|proxysql_exporter: /usr/local/percona/pmm2/exporters/proxysql_exporter|g' /tmp/pmm-agent.yaml
The default configuration file has to be replaced by our file and the service pmm-agent has to be restarted.
$ cp /tmp/pmm-agent.yaml /usr/local/percona/pmm2/config/ $ systemctl restart pmm-agent
Check Monitored Services
So now we can verify the current state of monitored instances.
$ pmm-admin list
Also, it can be checked on PMM server-side.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK