All Products
Search
Document Center

Quick BI:Add a User-created Data Source MongoDB

Last Updated:Apr 28, 2024

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.

  1. Download MongoDB Connector for BI.

    The value of the Platform parameter must match the platform of your local operating system.下载连接器

  2. Decompress the downloaded package.

    解压_4.2.2

  3. Start the mongosqld service.

    Note

    You 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.

    Note

    By 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: libssl.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

  1. After you log on to the Quick BI console.

  2. Perform the steps that are shown in the following figure to add a user-created MongoDB data source.

    1. Go to the Create Data Source page.

    2. Click Show More.

      image

    3. Select the MongoDB data source.

      image

  3. 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.

  4. Click Test Connection to verify that the data source can be connected.

    image

  5. 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.