Moving Your Linux Server MongoDB Database to a Windows Server
Overview
This article describes how to migrate a Linux Hub's MongoDB database to a new Windows Hub server, retaining all existing data such as events, agents, and configuration.
Netwrix Change Tracker no longer supports the Linux Hub, so use this procedure if you are still running one.
IMPORTANT: Verify that the MongoDB versions match on your current and target servers. For additional Netwrix Change Tracker installation prerequisites, refer to the Requirements article.
Instructions
Step 1 — Export the Database on the Linux Hub
-
Connect to the Linux server that hosts your Netwrix Change Tracker Hub.
-
Stop the
nnthubserviceandnntgen7agentcoreservices:service nnthubservice stopservice nntgen7agentcore stop -
Create a directory to hold the mongodump output, and change to it. For example:
mkdir /example/MongoDumpcd /example/MongoDump -
Export the database:
mongodump -d NNTHubService -
Copy the resulting dump directory to the new Windows server.
Step 2 — Prepare the New Windows Server
-
Connect to the server where Netwrix Change Tracker will be installed via RDP.
-
Run the Change Tracker installer and install the same version that was running on the Linux Hub.
NOTE: If the installer prompts you for a database storage engine, select the option that matches the storage engine of your existing database. Contact Netwrix Support if you are unsure which one your Linux Hub used.
Step 3 — Restore the Database on Windows
- Open a Command Prompt and run it as an Administrator.
- Enter the following commands in order:
iisreset /stopsc stop MongoDBcd C:\ProgramData\Change Tracker Generation 7 (NetCore)\MongoDBrmdir db /s(enterYand Enter when prompted)mkdir dbcd C:\Program Files\NNT Change Tracker Suite\Gen7\MongoDB\binsc start MongoDBmongorestore.exe <path-to-dump>\NNTHubService -d NNTHubService
- Allow time for the database to re-index. Once the re-index completes, the word done appears in the Command Prompt window.
- Enter the following command:
iisreset /start. - Close the Command Prompt window.
- Confirm that you can log in to Netwrix Change Tracker and open the Settings page. If you changed the admin user's password on the Linux Hub, that password still works.
Troubleshooting
If you see the following error on the Settings page, follow the troubleshooting steps.
Error: Key not valid in specified state
Change Tracker encrypts the Remote Credentials password and SMTP password entries using a key tied to the specific Hub server that stored them. Restoring the database on a different server — as in this migration — means the new server cannot decrypt those fields, which is why the Settings page shows this error. Clearing the affected entries removes the ciphertext the new server cannot read, but you must re-enter the Remote Credentials password and SMTP settings afterward.
Reset the Remote Credentials Password
- Open a Command Prompt and run it as an Administrator.
- Enter the following commands in order:
iisreset /stopcd C:\Program Files\NNT Change Tracker Suite\Gen7\MongoDB\binmongosh.exeshow dbsuse NNTHubServicedb.RemoteCredentials.update({},{$set: { "pa.Password": "" }}, { multi: true });exitiisreset /start
- Close the Command Prompt window.
- Confirm that you can log in to Netwrix Change Tracker.
Clear the SMTP Password Entries
If the error persists, try the following steps:
- Open a Command Prompt and run it as an Administrator.
- Enter the following commands in order:
iisreset /stopcd C:\Program Files\NNT Change Tracker Suite\Gen7\MongoDB\binmongosh.exeshow dbsuse NNTHubServicedb.HubConfigData.remove({ "Key" : "SMTP Password" });db.HubConfigData.remove({ "Key" : "SMTP Password2" });exitiisreset /start
- Close the Command Prompt window.