Before you use the data migration or synchronization feature of OceanBase Migration Service (OMS) Community Edition, you must create dedicated database users in the source and target databases for the data migration or synchronization task and grant corresponding privileges to these users.
OceanBase-CE data source
Create an OceanBase Community Edition user
In this example, an OceanBase Community Edition user is created. Specify this user for the Database username field when you create an OceanBase-CE data source. For example, the username of the database can be OMSTEST.
Log in to the OceanBase Community Edition console as the system administrator.
In the source business tenant, create a data migration or synchronization user.
CREATE USER '<user_name>' IDENTIFIED BY '<password>';Use the
GRANTstatement to grant privileges to the database user. For more information, see User privileges.
Create a DRC user
If you need to read incremental log data and database object schemas from OceanBase Community Edition, create a DRC user in the sys tenant of the source.
In this example, a DRC user is created. Specify this user for the Username field in Advanced Options when you create an OceanBase-CE data source. For example, the username of the DRC user can be user01.
Create a user
CREATE USER <drc_user> IDENTIFIED BY <drc_password>;Grant privileges
GRANT SELECT ON <db_name>.* TO <drc_user>;
Create the __oceanbase_inner_drc_user user
If you need to migrate a table without a primary key, create the __oceanbase_inner_drc_user user in the Source Business Tenant before you execute the data migration task.
Here, the __oceanbase_inner_drc_user user is created. Specify this user for the __oceanbase_inner_drc_user Password field when you create an OceanBase-CE data source.
Create a user
CREATE USER __oceanbase_inner_drc_user IDENTIFIED BY '<password>';Grant privileges
GRANT SELECT ON *.* TO __oceanbase_inner_drc_user;
MySQL data source
The MySQL database user created in this section is used to fill in Database username when you create a MySQL data source.
Log in to the MySQL database.
Create a user in the MySQL database for data migration or synchronization.
CREATE USER '<user_name>'@'<host_name>' IDENTIFIED BY '<password>';Parameter Description user_name The name of the user to be created. host_name The host from which the account is allowed to log in to the database. If the account is allowed to log in to the database from any host, use percent sign (%). password The password of the user to be created. Execute the
GRANTstatement to grant privileges to the created database user. For more information, see User privileges.
PostgreSQL data source
The PostgreSQL database user created in this section is used to fill in Database username when you create a PostgreSQL data source.
Log in to the PostgreSQL database.
Create a user in the PostgreSQL database for data migration or synchronization.
CREATE USER <user_name> ENCRYPTED PASSWORD '<password>';Execute the
GRANTstatement to grant privileges to the created database user. For more information, see User privileges.
TiDB data source
The TiDB database user created in this section is used to fill in Database username when you create a TiDB data source.
Log in to the TiDB database.
Create a user in the TiDB database for data migration or synchronization.
CREATE USER '<user_name>'@'<host_name>' IDENTIFIED BY '<password>';Parameter Description user_name The name of the user to be created. host_name The host from which the account is allowed to log in to the database. If the account is allowed to log in to the database from any host, use percent sign (%). password The password of the user to be created. Execute the
GRANTstatement to grant privileges to the created database user. For more information, see User privileges.
ElasticSearch data source
The ElasticSearch database user created in this section is used to fill in Database username when you create an ElasticSearch data source.
Create a role.
POST /_security/role/{roleName} { "cluster": ["all"], "indices": [ { "names": [ "*" ], "privileges": ["all"] } ], "metadata": {}, "transient_metadata": { "enabled": true } }Create a database user and assign the role to the user.
POST /_security/user/{username} { "password" : "123456", "roles" : ["role"], "full_name" : "username", "email" : "", "metadata" : { } }
MongoDB data source
The MongoDB database user created here is used to fill in the Database username field when creating a MongoDB data source.
Connect to the MongoDB database instance using the mongo command.
Switch to the authentication database that stores user information.
use <database_name>Create a database user.
db.createUser({ user: "username", pwd: "password", roles: [ { role: "roleName", db: "<database_name>" } ] });Create a role and grant permissions. For more information, see User privileges.
StarRocks data source
The StarRocks database user created here is used for the Database username field when you create a StarRocks data source.
Log in to the StarRocks database.
Create a user in the StarRocks database for data migration.
CREATE USER '<user_name>'@'<host_name>' IDENTIFIED BY '<password>';Parameter Description user_name The name of the user to be created. host_name The host that allows the account to log in. If the account is allowed to log in from any host, use a percent sign (%). password The password of the user to be created. Use the
GRANTstatement to grant permissions to the database user. For more information, see User privileges.