Add a MongoDB data source to connect Quick BI to your MongoDB database. Once connected, you can analyze and visualize data in Quick BI. Quick BI supports connecting to MongoDB over a public network or an Alibaba Cloud VPC. This topic describes how to add a self-managed MongoDB data source.
Before you begin, ensure that your network is connected:
If you connect Quick BI to your MongoDB database over a public network, add the IP addresses of Quick BI to the database allowlist. For more information, see Use security groups.
If you connect Quick BI to your MongoDB database over an internal network, use one of the following methods to connect the data source to Quick BI:
If your MongoDB database is deployed on an Alibaba Cloud ECS instance, you can connect over an Alibaba Cloud VPC.
You can also deploy a bastion host and access the database through an SSH tunnel.
Ensure you have the username and password for your self-managed MongoDB database.
Limitations
You must have the Workspace Admin or Organization Admin role to create data sources.
MongoDB 5.0 is supported.
Step 1: Install MongoDB BI Connector
The following example shows how to install MongoDB Connector for BI on a Linux operating system.
Download the MongoDB Connector for BI.
Select a Platform that matches your operating system.

Extract the downloaded package.

Start the mongosqld service.
NoteYou must add the IP address of the ECS instance that runs the mongosqld service to the MongoDB database allowlist.
./mongosqld --mongo-uri <Mongo_address> --auth -u <Username> -p <Password> --schemaRefreshIntervalSecs <Schema_refresh> --addr <Binding_address>Parameter
Description
Mongo_addressThe MongoDB connection address.
UsernameA username with root privileges.
PasswordThe password for the specified user.
Schema_refreshThe interval at which database and collection metadata in MongoDB is synchronized to memory.
Unit: seconds.
Recommended value: 86400 (1 day).
Binding_addressThe address and port to bind, typically the internal or public address of the machine.
Example:
0.0.0.0:3307NoteTo connect one machine to multiple instances, start multiple processes using different port numbers.
Example for a standard instance:
./mongosqld --mongo-uri mongodb://xxxx1.mongodb.rds.aliyuncs.com:3717 --addr 0.0.0.0:3307 -u root -p xxxx --auth --schemaRefreshIntervalSecs 86400Example for a replica set instance:
./mongosqld --mongo-uri mongodb://xxxx1.mongodb.rds.aliyuncs.com:3717,xxxx2.mongodb.rds.aliyuncs.com:3717/?replicaSet=mgset-xxxx --addr 0.0.0.0:3307 -u root -p xxxx --auth --schemaRefreshIntervalSecs 86400
If you see the error ./mongodrdl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory, this indicates that libssl is not installed. Run the following commands to install the library.
# Download from the official website
wget https://www.openssl.org/source/openssl-1.1.1e.tar.gz
# Compile and install
tar -xvf openssl-1.1.1e.tar.gz
cd openssl-1.1.1e
./config shared --openssldir=/usr/local/openssl --prefix=/usr/local/openssl
make && make install
# Configure
echo "/usr/local/lib64/" >> /etc/ld.so.conf
ldconfig
# Verify
openssl versionStep 2: Add a MongoDB data source
Log on to the Quick BI console.
To add the data source:
Go to the Create a data source page.
On the Self-managed Data Sources tab, select MongoDB.

In the Configure Connection dialog box, configure the following parameters.

Parameter
Description
Display Name
The name of the data source as it appears in the data source list.
Use a descriptive name without special characters or leading/trailing spaces.
Database Address
The address (IP address or domain name) of the host where the MongoDB Connector for BI service is deployed.
You must install the MongoDB Connector for BI before connecting.
Port
The port number of the database.
Database
The name of the database that you specified when you deployed your MongoDB database.
Username and Password
The username and password for the database.
The user must have CREATE, INSERT, UPDATE, and DELETE permissions on the tables in the database.
VPC Data Source
If the connector is deployed on an Alibaba Cloud ECS instance in a VPC, select VPC Data Source and configure the following parameters:
Payer's AccessKey ID: The AccessKey ID of the account that owns the instance.
For more information, see Create an AccessKey pair.
NoteEnsure that the AccessKey ID has read permissions on the target instance. If the key also has write permissions for the corresponding security group, the system automatically adds the IP address to the allowlist. Otherwise, you must add the IP address manually. For more information, see Create a custom policy.
Payer's AccessKey Secret: The AccessKey Secret of the account that owns the instance.
For more information, see Create an AccessKey pair.
Instance ID: The ID of the ECS instance. Log on to the ECS console and find the instance ID on the Instances page.
For more information, see View instance information.
Region: The region where the ECS instance is located.
For more information, see View instance information.
SSH
If you select SSH, you must configure the following parameters:
You can access the database through an SSH tunnel via a bastion host. Obtain the bastion host information from your O&M engineer or system administrator.
SSH Host: Enter the IP address of the bastion host.
SSH Username: The username for logging on to the bastion host.
SSH Password: The password for the specified username.
SSH Port: The port of the bastion host. The default is 22.
For more information, see Connect to a Linux instance by using a password or key.
Click Test Connection to verify the connection.

After the test succeeds, click OK to create the data source.
Next steps
After you create the data source, you can create a dataset and analyze data.
To add data tables or custom QL from your MongoDB database to Quick BI, see Create a dataset.
To add charts and analyze data, see Create a dashboard and Chart overview.
To drill down into your data for deeper analysis, see Step 3: Drill-down settings and display.
FAQ
Why isn't data from my MongoDB data source synchronizing to Quick BI in real time?
Cause
MongoDB data sources have a default synchronization delay of one day.
Solution
The data synchronizes automatically after one day.