Connect to Serverless StarRocks using EMR StarRocks Manager

更新时间:
复制 MD 格式

EMR StarRocks Manager is the data management console for EMR Serverless StarRocks instances from the Alibaba Cloud E-MapReduce (EMR) team. It provides comprehensive tools for data management, diagnostics, analytics, and security configuration.

Background

The SQL editor is an interactive query tool in EMR StarRocks Manager that lets you write, run, and manage SQL queries directly from the console, eliminating the need to install client software. This feature simplifies real-time data querying and analysis, improving efficiency for data analysts and developers. For more information, see SQL editor.

Prerequisites

You have created an EMR Serverless StarRocks instance. For more information, see Create an instance.

Procedure

  1. Go to the instance list page.

    1. Log on to the E-MapReduce console.

    2. In the navigation pane on the left, choose EMR Serverless > StarRocks.

    3. In the top navigation bar, select a region based on your requirements.

  2. On the Instances page, find your instance and click Connect in the Actions column.

  3. Connect to the StarRocks instance.

    New connection

    1. On the New Connection tab, configure the following parameters.

      Parameter

      Example

      Description

      Region

      China (Hangzhou)

      The region where your EMR Serverless StarRocks instance is located.

      Instance

      StarRocks_Serverlesss

      Select the name of your EMR Serverless StarRocks instance.

      Name

      Connection_Serverlesss

      A custom name for the connection.

      The name must be 1 to 64 characters in length and can contain Chinese characters, letters, digits, hyphens (-), and underscores (_).

      Username

      Enter as required

      The default username is admin. You can use this username to connect or create other users. For more information about how to create a user, see Manage users and grant permissions.

      Password

      Enter as required

      The password for the specified username in the StarRocks instance.

    2. Click Test Connectivity.

    3. After a successful test, click OK.

    Existing connections

    Important

    Ensure the target instance still exists. If the instance was deleted, you must create a new connection.

    On the Existing Connections tab, find the desired connection and click Connection in the Actions column.

  4. (Optional) Perform operations on the StarRocks instance.

    1. In the SQL editor, on the Queries page, click Configuration File or the image icon in the right pane, and then click Confirm to create a new file.

    2. In the new file, enter the following SQL statements and click Run.

      /* Create a database. */
      create database test_sql_editor_db;
      /* Use the database. */
      use test_sql_editor_db;
      /* Create a table. */
      CREATE TABLE
          `emr_query_logs` (
              `conn_id` varchar(10) NULL COMMENT "",
              `database` varchar(100) NULL COMMENT "",
              `start_time` bigint (20) NULL COMMENT "",
              `end_time` bigint (20) NULL COMMENT "",
              `event_time` bigint (20) NULL COMMENT "",
              `is_query` boolean NULL COMMENT "",
              `latency` int (11) NULL COMMENT "",
              `query_id` varchar(40) NULL COMMENT "",
              `remote_ip` varchar(15) NULL COMMENT "",
              `state` varchar(20) NULL COMMENT "",
              `user` varchar(20) NULL COMMENT ""
          ) ENGINE = OLAP DUPLICATE KEY (`conn_id`) COMMENT "OLAP" DISTRIBUTED BY HASH (`user`) BUCKETS 10 PROPERTIES (
              "replication_num" = "2",
              "in_memory" = "false",
              "storage_format" = "DEFAULT",
              "enable_persistent_index" = "false",
              "compression" = "LZ4"
          );
      /* Insert data. */
      insert into
          test_sql_editor_db.emr_query_logs (
              `conn_id`,
              `database`,
              `start_time`,
              `end_time`,
              `event_time`,
              `is_query`,
              `latency`,
              `query_id`,
              `remote_ip`,
              `state`,
              `user`
          )
      values
          (
              '54656',
              'tpc_h_sf1',
              1691635106990,
              1691635107405,
              1691635107405000000,
              1,
              415,
              'fbec0dd7-3726-11ee-a3ef-720338511ec3',
              '10.0.**.**',
              'FINISHED',
              'admin'
          ),
          (
              '54658',
              'tpc_h_sf1',
              1691635107632,
              1691635107860,
              1691635107860000000,
              1,
              228,
              'fc4e0301-3726-11ee-a3ef-720338511ec3',
              '10.0.**.**',
              'FINISHED',
              'admin'
          ),
          (
              '54659',
              'tpc_h_sf1',
              1691635108757,
              1691635108930,
              1691635108930000000,
              1,
              173,
              'fcf9ac5s8-3726-11ee-a3ef-720338511ec3',
              '10.0.**.**',
              'FINISHED',
              'admin'
          ),
          (
              '54661',
              'tpc_h_sf1',
              1691635108994,
              1691635109137,
              1691635109137000000,
              1,
              143,
              'fd1dd62e-3726-11ee-a3ef-720338511ec3',
              '10.0.**.**',
              'FINISHED',
              'admin'
          ),
          (
              '54663',
              'tpc_h_sf1',
              1691635109445,
              1691635109533,
              1691635109533000000,
              1,
              88,
              'fd62a765-3726-11ee-a3ef-720338511ec3',
              '10.0.**.**',
              'FINISHED',
              'admin'
          ),
          (
              '54664',
              'tpc_h_sf1',
              1691635109724,
              1691635109907,
              1691635109907000000,
              1,
              183,
              'fd8d39d9-3726-11ee-a3ef-720338511ec3',
              '10.0.**.**',
              'FINISHED',
              'admin'
          );
      /* View table information. */
      select * from test_sql_editor_db.emr_query_logs;

      The query results are displayed below.

Related documentation