Skip to main content

Using External Meta Databases

NineData Community Edition can store metadata in an enterprise-owned MySQL database. Use this configuration when you need centralized metadata storage, easier backup management, or higher availability for Community Edition deployments.

Before you begin

  • The version of NineData Community Edition must be at least 4.1.0. To view the current version, sign in to the NineData Community Edition console and check the upper-left corner of the page.

    version

  • The version of the enterprise-owned MySQL database should be 8.0 or above, and the account must have the permission to create databases (CREATE DATABASE). If this permission is not available, the following databases should be created in advance and the account should be granted all permissions on the database: meta, scheduler, slow_log, track_event, replication_exec, replication_metastore.

  • Ensure that the server where NineData Community Edition is deployed can access the external MySQL meta database instance.

Procedure

This option lets NineData create metadata databases without manual creation.

  1. Access the self-built MySQL meta database.

  2. Create a dedicated user for NineData.

    CREATE USER 'ninedata'@'%' IDENTIFIED BY '<Your-Password>';
  3. Grant global permissions.

    GRANT ALL ON *.* TO 'ninedata'@'%';
  4. Pass the META_DB environment variable in the docker run command when deploying the NineData Community Edition service. Use the format -e META_DB=<database account>:<database password>@<database host>:<database port number>.

    docker run -p 9999:9999 --privileged -v /opt/ninedata:/u01 -e META_DB=ninedata:123456@127.0.0.1:3306 --name ninedata -d swr.cn-east-3.myhuaweicloud.com/ninedata/ninedata:4.1.0

Option 2: Manual Database Creation Mode

Use this option when NineData cannot be granted database creation permissions. Pre-create the required databases and grant the account full management permissions for those databases.

  1. Access the self-built MySQL meta database.

  2. Create all required meta databases.

    CREATE DATABASE meta;
    CREATE DATABASE scheduler;
    CREATE DATABASE slow_log;
    CREATE DATABASE track_event;
    CREATE DATABASE replication_exec;
    CREATE DATABASE replication_metastore;
  3. Create a user and grant full management permissions for the above databases.

    CREATE USER 'ninedata'@'%' IDENTIFIED BY '<Your-Password>';
    GRANT ALL PRIVILEGES ON meta.* TO 'ninedata'@'%';
    GRANT ALL PRIVILEGES ON scheduler.* TO 'ninedata'@'%';
    GRANT ALL PRIVILEGES ON slow_log.* TO 'ninedata'@'%';
    GRANT ALL PRIVILEGES ON track_event.* TO 'ninedata'@'%';
    GRANT ALL PRIVILEGES ON replication_exec.* TO 'ninedata'@'%';
    GRANT ALL PRIVILEGES ON replication_metastore.* TO 'ninedata'@'%';
    FLUSH PRIVILEGES;
  4. Pass the META_DB environment variable in the docker run command when deploying the NineData Community Edition service. Use the format -e META_DB=<database account>:<database password>@<database host>:<database port number>.

    docker run -p 9999:9999 --privileged -v /opt/ninedata:/u01 -e META_DB=ninedata:123456@127.0.0.1:3306 --name ninedata -d swr.cn-east-3.myhuaweicloud.com/ninedata/ninedata:4.1.0

Result

After NineData Community Edition starts with the META_DB environment variable, metadata is stored in the specified external MySQL database instead of the built-in metadata database.