Updated on 2024-04-11 GMT+08:00

Configuring an RDS Data Connection

Preparations

  1. Log in to the RDS management console.
  2. Buy an RDS DB instance.
  3. In the left navigation pane of the RDS management console, choose Instances. Locate the row containing the RDS DB instance used by MRS data connections, click More in the Operation column, and select Log In to log in to the DB instance as user root.

  4. On the home page of the instance, click Create Database to create a database.

    If no new database is created, the MRS data connections will fail to configure.

  5. On the top of the page, choose Account Management > User Management.

    If the selected data connection is RDS MySQL database, ensure that the database user is user root. If the user is not root, perform 5 to 7.

  6. Click Create User to create a non-root user.

  7. On the top of the page, choose SQL Operations > SQL Query, switch to the target database by database name, and run the following SQL statements to grant permissions to the database user. In the following statements, ${db_name} and ${db_user} indicate the name of the database to be connected to MRS and the name of the new user, respectively.

    grant SELECT, INSERT on mysql.* to '${db_user}'@'%' with grant option;
    grant all privileges on ${db_name}.* to '${db_user}'@'%' with grant option;
    grant reload on *.* to '${db_user}'@'%' with grant option;
    flush privileges;

  8. Create a data connection by referring to Creating an RDS Data Connection.

Creating an RDS Data Connection

Create an RDS data connection for an existing MRS cluster.

  1. Log in to the MRS management console, and choose Data Connections in the left navigation pane.
  2. Click Create Data Connection.
  3. Configure parameters according to Table 1.

    Table 1 Parameters for creating a data connection

    Parameter

    Description

    Type

    The type of an external source connection. Value options are as follows:

    • RDS PostgreSQL database. Clusters that support Hive can connect to this type of database.
    • RDS MySQL database. Clusters that support Hive or Ranger can connect to this type of database.

    Name

    The name of a data connection.

    Database Instance

    The RDS database instance. This instance must be created in RDS before being referenced here, and the database must have been created. For details, see Preparations. Click View DB Instance to view the created DB instances.

    NOTE:
    • To ensure network communications between the cluster and the PostgreSQL database, create the instance in the same VPC and subnet as the cluster.
    • The inbound rule of the security group of the RDS DB instance must allow access of the instance to port 3306. To configure that, click the instance name on the RDS console to go to the instance management page. In the Connection Information area, click the name next to Security Group. On the page that is displayed, click the Inbound Rules tab, and click Add Rule. In the displayed Add Inbound Rule dialog box, in the Protocol & Port area, select TCP and enter port number 3306. In the Source area, select IP address and enter the IP addresses of all nodes where the MetaStore instances of Hive are located.
    • Currently, MRS supports PostgreSQL 14 on RDS.
    • Currently, MRS supports only MySQL 5.7.x/MySQL 8.0x on RDS.

    Database

    The name of the database to be connected to.

    Username

    The username for logging in to the database to be connected.

    Password

    The password for logging in to the database to be connected.

    Figure 1 Parameters for creating an RDS database connection

    When Type is set to RDS MySQL database or GaussDB(for MySQL), Username must be root. If the user is not root, perform operations by referring to Preparations.

  4. Click OK.