When you install Sisense, a MongoDB instance is installed locally on your machine that contains metadata for ElastiCubes, dashboards, and users. The goal of the replica set is to ensure that each MongoDB has the same information about ElastiCubes, dashboards, and filters. If a MongoDB fails on one query server, the next available MongoDB can replace it. To maintain consistency throughout your configuration and support high availability, each MongoDB instance must be identical with the other MongoDB instances in your configuration.
Each MongoDB instance is part of a replica set. A replica set is a group of MongoDB instances that have the same Sisense data. There are two types of nodes within a replica set. The primary node, which supports write operations and the secondary nodes, which replicate the primary MongoDB’s operations log and syncs the data to reflect that of the primary MongoDB.
The primary and secondary MongoDB nodes can be hosted on the build or query nodes in a high availability configuration or on their own servers.
There are four steps to support high availability for the MongoDB in Sisense:
- Preparing to set up replica set.
- Setting up replica nodes.
- Creating a replica set.
- Connecting Sisense to the replica set.
- Servers in which port 27018 is open.
- RoboMongo installed on a machine that has access to those servers on port 27018 (any node can be on one of the servers).
- MongoDB installed on the machine. By default, this is installed when Sisense is installed. If Sisense is not installed, download MongoDB version 2.4.5 zip on the secondary servers from here.
Preparing to Set up a Replica Set
For each machine that you have installed Sisense, you must stop the Sisense-related services from running to prepare the main MongoDB instance that will be replicated to the other secondary nodes.
This procedure assumes your primary node has Sisense installed.
To prepare each server node in your replica set:
- Log in to the machine that hosts Sisense.
- Depending on your Sisense installation:
- Full IIS: Open the IIS Manager and stop the website SisenseWeb.
- IIS Express: Open Windows Services and stop the service Sisense.WebExpress.
- In Windows Services, stop the service named Monitoring Agent_service and the service Sisense.Repository.
- For the server that will be the primary node, backup the Sisense MongoDB instance by copying this directory and saving to another location:
You can delete the backup copy after you have verified that everything is running as expected.
- For each secondary server where Sisense is installed, backup the contents of the directory below including the MongoDB instance.
Setting Up the Replica Nodes
For each node in your replica set, you must have a MongoDB configuration file. The configuration file contains information about the MongoDB such as its open port and the name of the replica set the MongoDB instance belongs to.
When Sisense is installed on the node, this configuration file is created for you. You must add the line replSet=replica_set to the configuration file. This line is used to identify the node as part of the replica set.
For nodes in which Sisense is not installed, you must create this configuration file as described in the procedure below.
To set up a node:
When Sisense is installed:
- In the directory, ‘C:\Program Files\Sisense\Infra\MongoDB\MongoDB.conf’, backup the MongoDB configuration.
- In the original MongoDB.conf file, add the line replSet = replica_set.
- In Windows Services, restart the Sisense.Repository service.
When Sisense is not installed:
- If Sisense is not installed, MongoDB must be downloaded as described in the Prerequisites. Extract the MongoDB zip to a directory called c:\Sisense.
After extracting the file you should see an executable mongod file at c:\Sisense\bin\mongod.exe.
- In the directory c:\Sisense\bin\, create a file named ‘MongoDB.conf’ as shown below:
replSet = replica_set
- In the directory c:\Sisense\, create the following directories as listed below: DB with two subdirectories named Log and Prod within it.
- In the Windows Command Prompt, run the following command to install MongoDB as a Windows service:
C:\Sisense\bin\mongod.exe --config C:\Sisense\MongoDB.conf --install
- In Windows Services, start the MongoDB service.
- Verify that the MongoDB service is running and that its startup type is automatic.
Creating a Replica Set
After you have prepared the MongoDB configuration file for each of your nodes, you must create a replica set with these nodes. With a replica set, each member has the same Sisense data but is otherwise independent. If the primary becomes unavailable, the replica set holds an election to select a new primary from one of the secondary nodes.
To create replica set:
- Open Robomongo and select Open Shell to connect to the primary node.
- In the new shell, run the command rs.initiate() to create a replica set.
- Run the following commands:
cfg = rs.conf()
cfg.members.host = "XX.XX.XX.XX:27018" (Enter your IP address of the primary node and the MongoDB port, by default 27018).
- Run the command rs.add(“XX.XX.XX.XX:27018”), where the XX is the IP address of your secondary node. Run this command to add the unique IP address for each secondary node. For example:
rs.initiate() cfg = rs.conf() cfg.members.host = "10.50.1.199:27018" rs.reconfig(cfg) rs.add("10.20.1.196:27018") rs.add("10.20.1.197:27018")
- Run the command rs.status() to verify that the replica set was configured properly. Run this command every couple of minutes to check the progress until stateStr of the secondaries service displays SECONDARY.
Connecting Sisense to the Replica Set
After you have configured the replica set, you must connect it to Sisense to support your high availability configuration.
Repeat the procedure below for each machine with Sisense installed.
To connect Sisense to a replica set:
- In the directory “C:\Program Files\Sisense\PrismWeb\App_Data\Configurations\” backup the file db.config.
- In the original db.config file, modify the line:
<add name="MongoProvider" connectionString="MongoDB://localhost:27018/?safe=true"/>
<add name="MongoProvider" connectionString="MongoDB://XX.XX.X.XX:27018,XX.XX.X.XX:27018,XX.XX.X.XX:27018/?replicaset=replica_set&readPreference=primaryPreferred&safe=true"/></connectionStrings>
Where XX.XX.XX.XX:27018 is the IP address and port for each MongoDB instance in your replica set separated by a comma.
- In this directory “C:\Program Files\Sisense\PrismWeb\vnext\config”, backup the file default.yaml
- In the original default.yaml file, at the bottom add the following:
- host: XX.XX.X.XX
- host: XX.XX.X.XX
- host: XX.XX.X.XX
The dbpath line should be ‘C:\ProgramData\Sisense\PrismWeb\DB\Prod’ on nodes in which Sisense is installed and ‘C:/Sisense/DB/Prod’ when Sisense is not installed.
- In Windows Services, start the service Sisense.Repository.
- Depending on your Sisense installation,
- Full IIS: Open the IIS Manager and start the website SisenseWeb.
- IIS Express: Open Windows Services and start the service Sisense.WebExpress.
Hey! Was this article helpful?
Questions? Ask the community.