In this section:

Introduction

Enterprise Pack ships with MongoDB 4.0, but you can configure a set of environment variables included with Enterprise Pack to connect to a newer version of MongoDB. You can connect Enterprise Pack up to MongoDB 4.4.

You can either configure the environment variables externally (recommended) or edit the dtpservices startup script to control the MongoDB settings.

Configuring Environment Variables Externally

Refer to Configuring Environment Variables for details about configuring MongoDB variables in your operating system.

Editing the Startup Script

 You should always stop Enterprise Pack before making modifications to the script files.

If you are comfortable working with bash or shell scripts, you can specify the external MongoDB by editing the dtpservices file. The files are in the following locations:

  • Linux: <DTP_INSTALL>/dtpservices/dtpservices.sh
  • Windows: <DTP_INSTALL>/dtpservices/dtpservices.bat 

Authentication

If the MongoDB database is configured with authentication enabled, then the user configured in Enterprise Pack should at least have the readWrite role in the following databases:

  • administration
  • service-designer
  • service

In the following example, the mongo shell command creates a user in MongoDB that can be used by Enterprise Pack:

db.createUser({
    user: 'enterprise-pack',
    pwd: passwordPrompt(),
    roles: [
        { role: 'readWrite', db: 'administration' },
        { role: 'readWrite', db: 'service-designer' },
        { role: 'readWrite', db: 'service' }
    ]
})

Migrating Data to the Remote Database

  1. Start Enterprise Pack and run the following command to migrate data from the embedded database to the remote instance:

    <DTP_INSTALL>/dtpservices/mongodb/bin/mongodump --port=8316 --gzip --archive=dump.tar.gz

    The <DTP_INSTALL> directory should match the value of the -i parameter when running the DTP.sh installation script.

  2. Copy the dump.tar.gz file created by the command to the server hosting the remote MongoDB database.
  3. Ensure that the remote server is running and restore the data dumped from the embedded database. The following example command assumes that the mongorestore executable is on the system path. Additional options, such as --username and --password may be necessary based on the database configuration. 

    mongorestore --gzip --archive=dump.tar.gz

Your infrastructure may not be fully consistent with the instructions described in this documentation. For example, you may first need to migrate the data into an older version of MongoDB on the remote system, then incrementally upgrade MongoDB until they are on the desired version of MongoDB. Refer to the MongoDB documentation for details about data migration: https://docs.mongodb.com/manual/tutorial/upgrade-revision/

Logging

The main.log file keeps track of DB connections. See Viewing Log Files for additional information. 

Example remote database log
[2021-05-24T15:35:35.771] [INFO] main - Configured to use a remote database. The embedded database will not be started.
[2021-05-24T15:35:35.774] [DEBUG] main - Connecting to database: mongodb://dtp-server2016.parasoft.com:27017/administration
[2021-05-24T15:35:35.828] [DEBUG] main - Connected to database: mongodb://dtp-server2016.parasoft.com:27017/administration
[2021-05-24T15:35:35.830] [DEBUG] main - Database connection is open: mongodb://dtp-server2016.parasoft.com:27017/administration
Example default database configuration log
2021-05-24T15:23:29.152] [INFO] main - Starting MongoDB.
[2021-05-24T15:23:29.193] [DEBUG] main - Connecting to database: mongodb://localhost:8316/administration
[2021-05-24T15:23:31.202] [DEBUG] main - Connecting to database: mongodb://localhost:8316/administration
[2021-05-24T15:23:33.212] [DEBUG] main - Connecting to database: mongodb://localhost:8316/administration
[2021-05-24T15:23:33.267] [DEBUG] main - Connected to database: mongodb://localhost:8316/administration
[2021-05-24T15:23:33.267] [DEBUG] main - Database connection is open: mongodb://localhost:8316/administration
[2021-05-24T15:23:33.268] [DEBUG] main - Disconnecting from database: mongodb://localhost:8316/administration
[2021-05-24T15:23:33.273] [DEBUG] main - Database connection closed: mongodb://localhost:8316/administration
[2021-05-24T15:23:33.274] [INFO] main - MongoDB is started.
[2021-05-24T15:23:33.274] [DEBUG] main - Connecting to database: mongodb://localhost:8316/administration
[2021-05-24T15:23:33.336] [DEBUG] main - Connected to database: mongodb://localhost:8316/administration
[2021-05-24T15:23:33.338] [DEBUG] main - Database connection is open: mongodb://localhost:8316/administration
  • No labels