AutoMQ ensures cloud-native scalability, Kafka compatibility, and cost efficiency for importing data from AutoMQ into Apache Doris, driving fast, real-time analytics.
Apache Doris is a high-performance, real-time analytical database based on MPP architecture, known for its exceptional ease of use and sub-second response times for queries on massive datasets. It supports both high-concurrency point query scenarios and high-throughput complex analytical scenarios. Consequently, Apache Doris is well-suited for use cases such as report analysis, ad-hoc queries, unified data warehouse construction, and data lake federation query acceleration. Users can build applications on top of this, such as user behavior analysis, A/B testing platforms, log search analysis, user profiling, and order analysis.This document discusses how to import data from AutoMQ into Apache Doris using Apache Doris Routine Load. For detailed information about Routine Load, refer to the Routine Load Fundamentals document.
Ensure that an operational Apache Doris cluster is available. For demonstration purposes, we have set up a test Apache Doris environment on Linux by following the Docker Deployment for Doris document.Create a database and test table:
create database automq_db;CREATE TABLE automq_db.users ( id bigint NOT NULL, name string NOT NULL, timestamp string NULL, status string NULL) DISTRIBUTED BY hash (id) PROPERTIES ('replication_num' = '1');
Download the latest TGZ package from AutoMQ Releases and extract it. Assuming the extraction directory is $AUTOMQ_HOME, this article will use the tools in $AUTOMQ_HOME/bin to create topics and generate test data.
Refer to AutoMQ Deploy Multi-Nodes Cluster on Linux▸ to deploy a functional cluster, ensuring network connectivity between AutoMQ and Apache Doris.Quickly create a topic named example_topic in AutoMQ and write a test JSON data into it, following the steps below.
Use the Apache Kafka command-line tool to create the topic. Make sure you have access to the Kafka environment and that the Kafka service is running. Here is an example command for creating a topic:
Use Kafka command line tools or programming methods to write the test data into a Topic named example_topic. Below is an example using the command line tool:
Create a Routine Load job in the Apache Doris command line to receive JSON data, which is used for continuously importing data from the AutoMQ Kafka topic. For specific parameters of Routine Load, refer to the Doris Routine Load documentation.
First, check the status of the Routine Load job to ensure the task is running.
show routine load\G;
Then, query the relevant table in the Apache Doris database to confirm that the data has been successfully imported.
select * from users;+------+--------------+---------------------+--------+| id | name | timestamp | status |+------+--------------+---------------------+--------+| 1 | Test User | 2023-11-10T12:00:00 | active || 2 | Test User | 2023-11-10T12:00:00 | active |+------+--------------+---------------------+--------+2 rows in set (0.01 sec)