Navigation
This version of the documentation is archived and no longer supported. To learn how to upgrade your version of MongoDB Ops Manager, refer to the upgrade documentation.
You were redirected from a different version of the documentation. Click here to go back.

Test Ops Manager Monitoring

On this page

Overview

The following procedure creates a MongoDB replica set and sets up a database populated with random data for use in testing an Ops Manager installation. Create the replica set on a separate machine from Ops Manager.

These instructions create the replica set on a server running RHEL 6+ or Amazon Linux. The procedure installs all the members to one server.

Procedure

1

Increase each server’s default ulimit settings.

RHEL and CentOS 6 limit the maximum number of user processes to 1024. This overrides the general user process limit (ulimit -u) setting.

If a /etc/security/limits.d/99-mongodb-nproc.conf user process configuration file does not exist, create it. In this file, add soft and hard nproc (number of processes) entries with values that are larger than the RHEL 1024 user process limit. Use the contents of the /etc/security/limits.d/90-nproc.conf file as a template.

For more information, see UNIX ulimit Settings in the MongoDB manual.

2

Install MongoDB on each server.

First, set up a repository definition by issuing the following command:

echo "[mongodb-org-3.2]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/
gpgcheck=0
enabled=1" | sudo tee -a /etc/yum.repos.d/mongodb-org-3.2.repo

Second, install MongoDB by issuing the following command:

sudo yum install -y mongodb-org mongodb-org-shell
3

Create the data directories for the replica set.

Create a data directory for each replica set member and set mongod.mongod as each data directory’s owner.

For example, the following command creates the directory /data and then creates a data directory for each member of the replica set. You can use different directory names:

sudo mkdir -p /data /data/mdb1 /data/mdb2 /data/mdb3

The following command sets mongod.mongod as owner of the new directories:

sudo chown mongod:mongod /data /data/mdb1 /data/mdb2 /data/mdb3
4

Start a separate MongoDB instance for each replica set member.

Start each mongod instance on its own dedicated port number and with the data directory you created in the last step. For each instance, specify mongod as the user. Start each instance with the replSet command-line option specifying the name of the replica set.

For example, the following three commands start three members of a new replica set named rs0:

sudo -u mongod mongod --port 27017 --dbpath /data/mdb1 --replSet rs0 --logpath /data/mdb1/mongodb.log --fork

sudo -u mongod mongod --port 27018 --dbpath /data/mdb2 --replSet rs0 --logpath /data/mdb2/mongodb.log --fork

sudo -u mongod mongod --port 27019 --dbpath /data/mdb3 --replSet rs0 --logpath /data/mdb3/mongodb.log --fork
5

Connect to one of the members.

For example, the following command connects to the member running on port 27017:

mongo --port 27017
6

Initiate the replica set and add members.

In the mongo shell, issue the rs.initiate() and rs.add() methods, as shown in the following example. Replace the hostnames in the example with the hostnames of your servers:

rs.initiate()
rs.add("mdb.example.net:27018")
rs.add("mdb.example.net:27019")
7

Verify the replica set configuration.

Issue the rs.conf() method and verify that the members array lists the three members:

rs.conf()
8

Add data to the replica set.

Issue the following for loop to create a collection titled testData and populate it with 25,000 documents, each with an _id field and a field x set to a random string.

for (var i = 1; i <= 25000; i++) {
  db.testData.insert( { x : Math.random().toString(36).substr(2, 15) } );
  sleep(0.1);
}
9

Confirm data entry.

After the script completes, you can view a document in the testData collection by issuing the following:

db.testData.findOne()

To confirm that the script inserted 25,000 documents into the collection, issue the following:

db.testData.count()
10

Open the Ops Manager home page in a web browser and register the first user.

The first user created for Ops Manager is automatically assigned the Global Owner role.

Enter the following URL in a web browser, where <ip_address> is the IP address of the server:

http://<ip_address>:8080

Click the Register link and enter information for the new Global Owner user. When you finish, you are logged into the Ops Manager Application as that user. For more information on creating and managing users, see Manage Ops Manager Users.

11

Set up monitoring for the replica set.

If you have enabled the Backup Daemon, click the Get Started button for Backup and follow the instructions. This will set up both monitoring and backup. Otherwise click the Get Started button for Monitoring and follow instructions.

When prompted to add a host, enter the hostname and port of one of the replica set members in the form <hostname>:<port>. For example: mdb.example.net:27018

When you finish the instructions, Ops Manager is running and monitoring the replica set.