Install and monitor MongoDB clusters¶
Developer Preview
Operations for MongoDB is a Developer Preview feature in PMM 3.10.0. Use it for testing and feedback only, not in production.
Operations for MongoDB enables you to check the health of every MongoDB cluster that PMM monitors, and to install Percona Server for MongoDB replica sets on empty nodes without SSH access. Before you start, review the limitations that apply in this Developer Preview release.
Every signed-in PMM user can open MongoDB > Operations and see all of its pages, except the install form. Only PMM Admins can scan nodes, start or abort installs, remove node entries, and change settings. For other users, these controls are disabled or hidden. Any user can click Refresh on Fleet.
Prepare PMM Server¶
Operations for MongoDB runs on PMM Extensions. It isn’t supported on AMI, PMM HA, or deployments with an external PostgreSQL database.
Before you enable Operations for MongoDB, prepare PMM Server:
- Deploy PMM Extensions with Docker. This setup already sets
PMM_ENABLE_EXTENSIONS=1,PMM_ENABLE_NOMAD=1, andPMM_PUBLIC_ADDRESS. PMM Server connects to PMM Extensions automatically. - Publish port
4647on thepmm-servercontainer (-p 4647:4647). PMM Client nodes connect to this port to receive scan and install jobs. Without it, remote nodes can’t receive jobs.
Enable Operations for MongoDB¶
Until you enable Operations for MongoDB, MongoDB > Operations doesn’t appear in the side menu and PMM doesn’t scan your nodes. You can enable it via PMM settings or an environment variable:
Use this method to enable Operations for MongoDB on a running PMM Server, without a restart:
- Go to Configuration > Settings > Advanced Settings.
- Turn on Operations for MongoDB.
- Click Apply changes.
If PMM can’t use PMM Extensions, the setting stays off and the error message says why, for example that PMM Extensions is unreachable. Fix the cause and try again.
Use this method to keep Operations for MongoDB on every time PMM Server starts, for example from a Docker Compose file or a startup script.
Start PMM Server with PMM_ENABLE_OM=1. While this variable is set, you can’t change the setting in the UI. The Operations for MongoDB toggle stays visible, but Apply changes returns an error.
After you enable it, MongoDB > Operations appears in the side menu with a Preview label. It includes these pages:
- Fleet: check the health of every MongoDB cluster that PMM monitors.
- Nodes: see every node PMM knows about and whether it’s ready to be scanned or have Percona Server for MongoDB installed.
- Automations: review the history of installs and scans.
- Settings: control how PMM scans your nodes and what it collects.
Prepare your nodes¶
Before you scan or install on a node, make sure it meets the requirements and, if you want scans to connect to MongoDB, that you’ve provided credentials.
Node requirements¶
PMM checks these requirements during scans and reports the results so you can fix issues before you install. Reported only means the scan checks and reports the requirement but doesn’t block on it. The install enforces it and fails if it isn’t met.
What each node needs for scans and installs
| Requirement | Scans | Installs |
|---|---|---|
| PMM Client 3.2.0 or later, installed from the DEB or RPM package | Required | Required |
pmm-agent running as root, which is the default for the package’s systemd service |
Required | Required |
| Writable cgroups | Required | Required |
The iproute package |
Required | Required |
Outbound TCP access to PMM Server on port 4647 |
Required | Required |
python3 with the venv module: python3-venv on Ubuntu, included on Rocky Linux |
Required | Required |
Access to PyPI or a configured pip mirror, because scans install pymongo |
Required | Required |
HTTPS access to repo.percona.com and OS package mirrors |
Reported only | Required |
HTTPS access to the /extensions URL on PMM Server |
Not needed | Required |
Provide MongoDB credentials for scans¶
Scans log in to MongoDB on each node to read the replica set state. They don’t use the monitoring credentials that PMM already holds, so you need to provide credentials even for instances that PMM monitors.
To provide credentials:
- Choose a MongoDB user with the
clusterMonitorrole. You can reuse the PMM monitoring user, which already has this role. -
On every node that runs MongoDB, create the
/root/.mongodb_urifile with one line:mongodb://<user>:<password>@<host>:<port>Scans read only the user and password from this line and log in to the
admindatabase. Nodes without MongoDB don’t need this file. -
Make the file readable only by root, because it contains a password:
chown root:root /root/.mongodb_uri chmod 600 /root/.mongodb_uri -
To check the credentials, click Scan in the node’s row on the Nodes page. Then go to MongoDB > Operations > Automations, select the Scans tab, and expand the latest scan. If the password is wrong, the scan shows as Partial, and the service appears in red with (no answer). Hover over it to see the error. If the file is missing, no error is shown. Scans still report the running version, but not the replica set state.
Scan without credentials¶
To skip MongoDB login entirely, go to MongoDB > Operations > Settings > General, turn off Connect to MongoDB, and click Save. The change applies to the next scan, without a restart. A scan that starts within about 30 seconds of saving can still use the previous setting.
With Connect to MongoDB off, scans collect only process and OS details and the installed MongoDB version, without connecting to mongod. No credentials needed, but scans won’t report replica set state or running version.
Scan nodes¶
A scan checks what runs on a node and whether you can install MongoDB on it. Until PMM scans a node, the node shows no data.
PMM scans every node automatically, every 10 minutes by default. PMM also scans every node after each restart and when Operations for MongoDB is turned on.
Run a scan now¶
To scan right away, for example after you add a node, go to MongoDB > Operations > Nodes and do one of the following:
- To scan every node, click Scan all.
- To scan some nodes, select them and click Scan selected.
- To scan one node, click Scan in its row.
While a scan runs, Scan all is unavailable. Scan is unavailable only in the rows of the nodes that the scan covers, and Scan selected only when you select one of those nodes.
Change the scan schedule¶
By default, PMM scans every node every 10 minutes. Each scan sends a job to every node. To scan more or less often:
- Go to MongoDB > Operations > Settings and select the General tab.
- In Scan every and Period, set the time between scans.
- Click Save. The change takes effect without a restart.
Stop automatic scans¶
If you want PMM to scan only when you ask, turn off automatic scans:
- Go to MongoDB > Operations > Settings and select the General tab.
- Turn off Automatic node scans.
- Click Save.
PMM then no longer scans on a schedule, when it restarts, or when Operations for MongoDB is turned on. Scan and Scan all on the Nodes page keep working. When you turn Automatic node scans back on, PMM scans at the interval set in Scan every and Period.
Install a replica set¶
PMM supports single-member and three-member replica sets. Each node must have at least one completed scan before you can select it for installation.
Before you install¶
Check your nodes and reduce the security exposure before you start the install.
Check nodes¶
Make sure each node meets the following conditions before you start. If a node doesn’t, PMM blocks it and shows the reason in the Automation column on the Nodes page:
- Supported OS release: a release of Ubuntu or Rocky Linux listed in the table that follows, matched on
IDandVERSION_IDin/etc/os-release. RHEL, AlmaLinux, Oracle Linux, and Debian aren’t supported. All nodes in one install must run the same OS. - No existing MongoDB:
mongodmust not be installed or running, and PMM must have no MongoDB service registered for the node. - Not the PMM Server host: don’t install on the host that runs PMM Server.
PMM installs each MongoDB version only onto the OS releases that Percona’s release lifecycle for MongoDB supports. Ubuntu matches on the exact release, and Rocky Linux on the major version, so Rocky Linux 9.4 counts as 9. The following table lists the supported releases:
| OS release | MongoDB 7.0 | MongoDB 8.0 |
|---|---|---|
| Ubuntu 22.04, 24.04 | Supported | Supported |
| Rocky Linux 8, 9 | Supported | Supported |
| Rocky Linux 10 | Not supported | Supported |
PMM blocks a node whose release isn’t listed, such as Ubuntu 20.04. The install form offers only the versions that every selected node supports.
PMM checks the following conditions only when the install starts, and the Nodes page doesn’t show them. Check them yourself before you start. If a node doesn’t meet them, the install fails at the pre-check:
- No MongoDB configuration:
/etc/mongod.confmust not exist. - Free data directory: the data directory (default
/var/lib/mongo) must be missing or empty, with at least 5 GiB free. - Free port: nothing else must be listening on the chosen port (default
27017).
PMM doesn’t check the following before the install starts. If they aren’t met, the install fails when PMM forms the replica set and then rolls it back:
- Resolvable node names: replica set members address each other by their PMM node names. Every member must resolve the node names of all members, including its own, through DNS or
/etc/hosts. - Network access between members: each member can reach the other members on the MongoDB port.
Reduce security exposure¶
During the install, mongod runs without authentication until the final step, when PMM turns authentication on for each node. Until then, any host that can reach the MongoDB port on a node can connect without credentials, and any user it creates keeps working after authentication is on.
To reduce this risk:
- Make sure the nodes aren’t reachable from untrusted networks before you start the install.
- Keep the default Listen on setting. By default, each member listens only on its own address and on
127.0.0.1. Listen on all interfaces only if you need it. - Don’t turn off Operations for MongoDB or restart PMM Server while an install is running. If the install stops,
mongodstays without authentication until the install resumes.
Run the install¶
Once your nodes pass the checks and you’ve reduced the security exposure, you’re ready to install. To install a MongoDB replica set:
-
Go to MongoDB > Operations > Nodes. To show only nodes without a database, select the Not monitored filter.
-
Select one node for a single-member replica set, or three nodes for a three-member replica set, and click Install MongoDB. To install on a single node, you can also click Install MongoDB in its row.
-
Fill in the form:
- MongoDB version: 7.0 (default) or 8.0, installed as Percona Server for MongoDB. If a selected node runs Rocky Linux 10, the form offers only 8.0.
- Replica set name.
-
Data path (default
/var/lib/mongo), Log path (default/var/log/mongodb/mongod.log), and Port (default27017).Keep the default port
In PMM 3.10.0, PMM registers the service for monitoring on port
27017even if you install on another port, so monitoring doesn’t work. This is a known issue. -
Listen on: by default, each member listens on its own address. PMM always adds
127.0.0.1. - Optional, for three-node installs only: per-member priority, votes, hidden, and delay settings for replica set elections.
- Optional: environment and cluster labels for PMM.
- Administrator user: the default name is
admin, with therootrole. Enter a password of at least 8 characters, or use the generated one.
-
Review the settings and start the install.
Save the generated password
PMM shows a generated password only once and deletes its copy after it creates the user. Save the password before you close the confirmation screen.
-
Track progress in MongoDB > Operations > Automations. On the Installs tab, expand your install to see the status of each node. The newest installs are at the top. When all nodes finish, PMM forms the replica set, creates the users, and turns on authentication.
PMM installs on all nodes in parallel, so the install takes a few minutes in total, mostly for downloading packages. When it finishes, the replica set appears on the Fleet page and PMM starts monitoring it.
View fleet health¶
Check fleet health as part of your regular operational checks, or when a cluster isn’t behaving as expected. It helps you spot replication lag early and confirm that your clusters run the versions you expect.
To view fleet health:
- Go to MongoDB > Operations > Fleet.
- On the Clusters tab, check the summary at the top: how many environments, clusters, and services PMM monitors, and how many services are up or down.
- To narrow the list, type part of a cluster name in Search clusters, or select values in the Health, Type, and Environment filters. A cluster must match the search and every filter that you set. Within one filter, any selected value matches. The filters are saved in the page URL, so you can share the filtered view. To reset, click Clear filters.
-
By default, clusters are grouped by environment. If you change Group by, the table keeps your choice for the browser session. For each cluster, check the following columns:
- Health: the overall state of the cluster, for example Healthy.
- Services: the number of services in the cluster.
- Process: the member types in the cluster, for example routers, shards and arbiters.
- Max repl. lag: the highest replication lag across members.
- Min oplog window: the smallest oplog window across members.
To add columns that are hidden by default, such as Type, Versions, Last seen, Max CPU, and Min conn. free, click Show/Hide columns in the table toolbar. In the Versions column, Mixed means that a replica set runs more than one version among the members that hold data. N versions means that the cluster’s members, routers and arbiters included, run N different versions. To see the versions, hover over the cell.
-
Expand a cluster’s row to find the member that causes poor health or high replication lag.
- Select the Services tab to check whether a specific service is up or down.
The page shows when its data was last refreshed and when the nodes were last scanned. To load the latest data, click Refresh.
Troubleshoot¶
Pages don’t load¶
If Nodes, Automations or Settings can’t load and the error says PMM Extensions did not accept the PMM session, check the pmm-extensions container. PMM signs you in to PMM Extensions with your PMM session. PMM Extensions accepts that session only while EXTENSIONS__AMBIENT_SESSION_SSO_ENABLED is on, which is the default. If the container sets it to false, remove the variable and recreate the container.
Scans¶
If a node shows no data or Needs attention in the Automation column, check the reason that appears under the status and fix it on the node.
If the reason isn’t clear, go to MongoDB > Operations > Automations, select the Scans tab, and check the scan errors for that node.
The Nodes page doesn’t flag rejected MongoDB credentials. To find them, look for Partial scans on the Scans tab, or check the Services tab as described below.
To find out why a service is failing, go to MongoDB > Operations > Fleet and select the Services tab. The Collected column shows the reason in red, for example Database unreachable or Database authentication failed. Click the service’s status to open its details, which show the full error and what to do about it. When PMM knows which scan failed, the details also link to it. A Down service marked not running had no mongod or mongos running at its last scan.
Installs¶
If an install step fails, PMM retries it once. If the retry also fails, PMM rolls back what it installed on all nodes: packages, configuration, and data. PMM doesn’t retry failed pre-checks.
To find out why an install failed, hover over its status on the Installs tab, or expand it to see the reason under the summary. To see each failed step’s reason, the end of its output and its task history ID, click Show failure details.
To stop an install that’s running, expand it on the Installs tab and abort it. PMM then rolls back the install in the same way.
If a node on the Nodes page shows PMM could not read from PMM Extensions which OS releases Operations installs onto, PMM can’t read the list of supported OS releases, so it blocks installs onto every node. The rest of the reason says why. Make sure that PMM Extensions is running and on the same version as PMM Server, then reload the Nodes page.
Limitations¶
Operations for MongoDB is a Developer Preview feature in PMM 3.10.0: you can try it out, but it isn’t complete or supported for production yet. It has the following limitations:
- You can install only replica sets with 1 or 3 members, not sharded clusters or standalone instances, though Fleet still shows any sharded clusters that PMM already monitors.
- No TLS or encryption at rest. Members authenticate to each other with a keyfile. TLS and encryption at rest are planned for a future release.
- Installs on the supported releases of Ubuntu and Rocky Linux only, using Percona packages.