Skip to main content

Mysql to Doris

Mysql to Doris

mysql to doris is mainly suitable for automating the creation of doris odbc tables, mainly implemented with shell scripts

manual

mysql to doris code here

Directory Structure

├── mysql_to_doris
│ ├── conf
│ │ ├── doris.conf
│ │ ├── mysql.conf
│ │ └── tables
│ ├── all_tables.sh
│ │
└── └── user_define_tables.sh
  1. all_tables.sh

    This script mainly reads all the tables under the mysql specified library and automatically creates the Doris odbc external table

  2. user_define_tables.sh

    This script is mainly used for users to customize certain tables under the specified mysql library to automatically create Doris odbc external tables

  3. conf

    Configuration file, doris.conf is mainly used to configure doris related, mysql.conf is mainly used to configure mysql related, tables is mainly used to configure user-defined mysql library tables

full

  1. Download using mysql to doris here

  2. Configuration related files

    #doris.conf
    master_host=
    master_port=
    doris_password=

    #mysql.conf
    mysql_host=
    mysql_password=
    Configuration itemillustrate
    master_hostDoris FE master node IP
    master_portDoris FE query_port port
    doris_passwordDoris Password (default root user)
    mysql_hostMysql IP
    mysql_passwordMysql Password (default root user)
  3. Execute the all_tables.sh script

sh all_tables.sh mysql_db_name doris_db_name

After successful execution, the files directory will be generated, and the directory will contain tables (table name) and tables.sql (doris odbc table creation statement)

custom

  1. Modify the conf/tables file to add the name of the odbc table that needs to be created
  2. To configure mysql and doris related information, refer to step 2 of full creation
  3. Execute the user_define_tables.sh script
sh user_define_tables.sh mysql_db_name doris_db_name

After successful execution, the user_files directory will be generated, and the directory will contain tables.sql (doris odbc table creation statement)