All Products
Search
Document Center

Data Lake Analytics - Deprecated:Background and preparations

Last Updated:Apr 22, 2019

Background

Data Lake Analytics (DLA) serves as a hub for in-cloud data processing. It allows you to query and analyze data in ApsaraDB for RDS, Table Store, and OSS through standard JDBC.

In DLA, you can also create a database (mapping database) connecting to an ApsaraDB for MongoDB (MongoDB) database. Then, you can use a MySQL client or MySQL command-line interface (CLI) tool to connect to DLA and execute standard SQL statements to read and write data from and to the MongoDB database. Alternatively, after analyzing the massive amounts of data stored in Alibaba Cloud Object Storage Service (OSS) and Table Store , you can write the result back to the MongoDB database for front-end service use.

Prerequisites

Before using DLA to read and write data from and to the MongoDB database, you must follow these steps to prepare the test data in the MongoDB database:

  1. Create a MongoDB instance.

    DLA and the MongoDB instance must be in the same region.

    DLA connects to a MongoDB database over the VPC of the MongoDB instance. Therefore, we recommend that you select VPC as the network type when creating the MongoDB instance. You can click Switch to VPC to switch the network type of the MongoDB instance from classic network to VPC.

  2. Configure the whitelist.

  3. Connect to the instance.

  4. Insert test data

The example in this topic describes how to create a database named mongo_test in your MongoDB instance, create a collection named person in the mongo_test database, and then insert the following test data into the person collection:

  1. db.person.insert({id:1, name: "james", age: 10, create_time: new Date()});
  2. db.person.insert({id:2, name: "bond", age: 20, create_time: new Date()});
  3. db.person.insert({id:3, name: "lily", age: 30, create_time: new Date()});
  4. db.person.insert({id:4, name: "lucy", age: 20, create_time: new Date()});

Notes

Before creating a MongoDB schema in DLA, you must add the CIDR block 100.104.0.0/16 to your MongoDB whitelist.

Your MongoDB instance is in a VPC, and by default DLA cannot access resources in the VPC. To enable DLA to access your MongoDB instance, you need to use the reverse VPC technology, that is, add the CIDR block 100.104.0.0/16 to the whitelist of your MongoDB instance.

Permission statement: When you add the CIDR block 100.104.0.0/16 to the whitelist of your MongoDB instance, you agree that we can use the reverse VPC technology to read and write data from and to your MongoDB database.

Procedure

  1. Create a MongoDB schema

  2. Create a MongoDB table and read and write data from and to the table