Synchronizing Data Manually with Script

The system automatically synchronizes all search relevant index data from MongoDB Server to Index Server after you perform the following operations:

Deploy Index Server for the first time

Upgrade Index Server

Execute a benchmark or discovery task

The global search service is available only after the synchronization is finished.

To improve the usability of Index Server in case that the auto synchronization fails or is interrupted due to a network issue or system exception, an executable python script is provided so that you can manually trigger the synchronization at any time.

Note: Before starting the synchronization, make sure the services of Message Server and MongoDB Server is up and running.

Method1: Using Windows Batch File

1.Log in to the Windows server where NetBrain Web Server or Worker Server is installed. Take Web Server for example.

2.Navigate to the <IE_Install_Home>\Web Server\nb_publish_client directory, where <IE_Install_Home> is the root installation of NetBrain Web Server.

3.Copy the NBConfig.json file under the directory, and then paste it to the <IE_Install_Home>\Search directory.

4.Under the <IE_Install_Home>\Search directory, open the Mongodb2Elasticsearch2.bat file with a text editor, modify the values of the following parameters, and then save the changes.

set "SYNCDBNAME=BeiJingDomain"
set "SYNCINDEXNAME=dashboard"
"C:\Python34\python.exe" main.py --syncdbname "%SYNCDBNAME%" --syncindexname "%SYNCINDEXNAME%"

Parameter

Description

SYNCDBNAME

Specify the data scope to be synchronized. The value can be a domain name or a tenant name.

If you specify a domain name as the value, all index data in the current domain will be synchronized from MongoDB Server to Index Server.

If you specify a tenant name as the value, all index data under the tenant will be synchronized from MongoDB Server to Index Server.

If you do not specify a value for the parameter, all index data in the system will be synchronized from MongoDB Server to Index Server.

SYNCINDEXNAME

Specify the types of index data to be synchronized. Index Server creates an index for the following types of objects in the system:

device

devicegroup

site

path

dashboard

oIf you specify dashboard as the value, only the index data of all dashboards will be synchronized from MongoDB Server to Index Server.

oIf you do not specify a value for the parameter, all index data will be synchronized from MongoDB Server to Index Server.

"C:\Python34\python.exe"

The physical installation path of Python, which must be modified to <IE_Install_Home>\Python34\python.exe.

In this example, only the index data of all dashboards in the domain "BeiJingDomain" will be synchronized from MongoDB Server to Index Server.

5.Double-click the Mongodb2Elasticsearch.bat2 file to start the synchronization.

Method2: Using Windows CMD Prompt

1.Log in to the Windows server where NetBrain Web Server or Worker Server is installed. Take Web Server for example.

2.Navigate to the <IE_Install_Home>\Web Server\nb_publish_client directory, where <IE_Install_Home> is the root installation of NetBrain Web Server.

3.Copy the NBConfig.json file under the directory, and then paste it to the <IE_Install_Home>\Search directory.

4.Open a command line prompt, and run the cd <IE_Install_Home>\NetBrain\Search command to navigate to <IE_Install_Home>\Search directory.

5.Run the main.py --syncdbname <value1> --syncindexname <value2> command to start the synchronization. See Parameter Description for more details.