After you add a MongoDB data source to connect a MongoDB database to Quick BI, you can analyze and view data in the Quick BI console. Quick BI can access a MongoDB database over the Internet or a virtual private cloud (VPC). This topic describes how to add a user-created MongoDB data source to a group workspace.
Your network meets the following requirements:
If you Quick BI connect to the MongoDB database over the Internet, add the Quick BI IP address to the whitelist of the database. For more information, see Add security group rules.
If you want to connect Quick BI to the MongoDB database over a VPC, make sure that one of the following methods is used to ensure the connectivity between Quick BI and the user-created MongoDB data source:
If the MongoDB database is deployed on an Elastic Compute Service (ECS) instance, you can connect Quick BI to the MongoDB database over a VPC.
You can deploy a jump server and access the database over an SSH tunnel.
The username and password of the user-created MongoDB database are obtained.
Limits
Only workspace administrators and organization administrators can add data sources.
Version 5.7.12 is supported.
Step 1: Install MongoDB Connector for BI
This section describes how to install MongoDB Connector for BI in the Linux operating system.
Download MongoDB Connector for BI.
The value of the Platform parameter must match the platform of your local operating system.
Decompress the downloaded package.
Start the mongosqld service.
NoteYou must add the IP address of the ECS instance on which the mongosqld service is started to the whitelist of the MongoDB database.
./mongosqld --mongo-uri <Mongo_address> --auth -u <Username> -p <Password> --schemaRefreshIntervalSecs <Schema_refresh> --addr <Binding_address>
Parameter
Description
Mongo_address
The endpoint of the MongoDB database.
Username
The username of the account that has the root permissions.
Password
The password of the account that has the root permissions.
Schema_refresh
The interval at which the information about the database and collections in MongoDB is synchronized to the memory.
Unit: seconds.
Recommended value: 86400. This value is equal to one day.
Binding_address
The port number. In most cases, this parameter is set to the internal or public endpoint of the machine,
such as
0.0.0.0:3307
.NoteBy starting multiple processes and setting different port numbers, one machine can connect to multiple instances.
Sample code that is used to access 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 86400
Sample code that is used to access 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 the error message ./mongodrdl: error while loading shared libraries: lib
ssl
.so.1.1: cannot open shared object file: No such file or directory
appears after the preceding operations are performed, libssl is not installed. To resolve this issue, perform the following operations:
# Download libssl from the official website of OpenSSL.
wget https://www.openssl.org/source/openssl-1.1.1e.tar.gz
# Compile and install libssl.
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 libssl.
echo "/usr/local/lib64/" >> /etc/ld.so.conf
ldconfig
# Check whether libssl is installed.
openssl version
Step 2: Add a user-created data source MongoDB
After you log on to the Quick BI console.
Perform the steps that are shown in the following figure to add a user-created MongoDB data source.
Go to the Create Data Source page.
Click Show More.
Select the MongoDB data source.
In the Configure Connection dialog box, configure the following settings based on your business requirements.
Parameter
Description
Name
The name of the data source. The name is displayed in the data source list.
The name cannot contain special characters or start or end with spaces.
Database address
The address of the database where the MongoDB BI connector is deployed, including the IP address or domain name. You must install the MongoDB BI connector before connecting.
Port Number
The port number of MongoDB Connector for BI.
Database
The name of the MongoDB database that is customized when you deploy the database.
Username and Password
The username and password that are used to access the database.
Make sure that the username has the create, insert, update, and delete permissions on the tables in the database.
VPC Data Source
If the MongoDB database is deployed on a ECS and the network type is Alibaba Cloud VPC, select VPC Data Source and configure the following parameters:
AccessKey ID: the AccessKey ID that is used to purchase the instance.
For more information, see Obtain an AccessKey pair.
AccessKey: the AccessKey secret that is used to purchase the instance.
For more information, see Obtain an AccessKey pair.
Instance ID: the ID of the ECS instance.
Region: the region in which the ECS instance is deployed.
SSH
If you select SSH, you must configure the following parameters:
You can deploy a jump server and access the database over an SSH tunnel. To obtain the jump server information, contact O&M personnel or system administrators.
SSH Host: the IP address of the jump server.
SSH Username: the username that is used to log on to the jump server.
SSH Password: the password that is used to log on to the jump server.
SSH Port Number: the port number that is used to connect to the jump server. Default value: 22.
For more information, see Connect to a Linux instance by using a password.
Click Test Connection to verify that the data source can be connected.
After the data source passes the connectivity test, click OK.
What to do next
After you add a data source, you can create a dataset and analyze data.
For more information about how to add a table in a MongoDB database or a custom QL Quick BI, see Create and manage datasets.
You can add charts for data analysis. For more information, see Create a dashboard and Overview of visualization charts.
Drill down the data for in-depth data analysis. For more information, see the Configure the drilling feature section of the "Drilling" topic.