Skip to content

Start the pbm-agent process

Start pbm-agent on every server with the mongod node installed. It is best to use the packaged service scripts to run pbm-agent.

$ sudo systemctl start pbm-agent
$ sudo systemctl status pbm-agent

For example, imagine that you put configsvr nodes (listen port 27019) collocated on the same servers as the first shard’s mongod nodes (listen port 27018, replica set name sh1rs). In this server there should be two pbm-agent processes, one connected to the shard (e.g. “mongodb://username:password@localhost:27018/”) and one to the configsvr node (e.g. “mongodb://username:password@localhost:27019/”).

For reference, the following is an example of starting pbm-agent manually. The output is redirected to a file and the process is backgrounded.

Important

Start the pbm-agent as the mongod user. The pbm-agent requires write access to the MongoDB data directory to make physical restores.

$ su mongod nohup pbm-agent --mongodb-uri "mongodb://username:password@localhost:27018/" > /data/mdb_node_xyz/pbm-agent.$(hostname -s).27018.log 2>&1 &

Replace username and password with those of your pbm user. /data/mdb_node_xyz/ is the path where pbm-agent log files will be written. Make sure you have created this directory and granted write permissions to it for the mongod user.

Alternatively, you can run pbm-agent on a shell terminal temporarily if you want to observe and/or debug the startup from the log messages.

How to see the pbm-agent log

With the packaged systemd service, the log output to stdout is captured by systemd’s default redirection to systemd-journald. You can view it with the command below. See man journalctl for useful options such as --lines, --follow, etc.

$ journalctl -u pbm-agent.service
-- Logs begin at Tue 2019-10-22 09:31:34 JST. --
Jan 22 15:59:14 : Started pbm-agent.
Jan 22 15:59:14 pbm-agent[3579]: pbm agent is listening for the commands
...
...

If you started pbm-agent manually, see the file you redirected stdout and stderr to.

When a message pbm agent is listening for the commands is printed to the pbm-agent log file, pbm-agent confirms that it has connected to its mongod node successfully.

Next steps

Make a backup

Get expert help

If you need assistance, visit the community forum for comprehensive and free database knowledge, or contact our Percona Database Experts for professional support and services.


Last update: November 13, 2024
Created: November 13, 2024