Updated on 2024-05-29 GMT+08:00

Accessing Doris Through ELB

Doris can use a client that supports the MySQL protocol to access a single FE node to perform service operations. If FE nodes are faulty, Doris cannot provide services for external systems. To solve this problem, MRS can be deployed with the Elastic Load Balance (ELB) service in the architecture shown in Figure 1.

Doris uses the ELB-based deployment architecture to automatically distribute user access traffic to multiple backend nodes, expanding service capabilities to external systems and improving fault tolerance. When a backend Doris node becomes faulty, ELB automatically fails over access traffic to another properly running node.

Figure 1 Accessing Doris nodes through ELB

Enable the MySQL client to access Doris through ELB. The procedure is as follows:

  • Step 1: Purchase an ELB and obtain its public IP address.
  • Step 2: Add an ELB listener and configure its protocol and port.
  • Step 3: Access Doris through ELB on the MySQL client.

Prerequisite

  • A Doris cluster has been created and is running properly.
  • The MySQL client has been installed. For details, see Installing a MySQL Client.

Purchasing ELB and Interconnecting It with Doris

Buy an ELB instance and obtain its public IP address.

For details, see Creating a Shared Load Balancer.

  1. Log in to the management console and choose Networking > Elastic Load Balance (ELB) from the service list.
  2. In the upper right corner of the ELB console, click Buy Elastic Load Balancer.
  3. On the displayed page, set the following parameters and retain the default values for other parameters:

    • Type: Shared load balancer
    • Billing Mode: Pay-per-use
    • Enterprise Project: default
    • The values of VPC and Frontend Subnet must be the same as those of the MRS Doris cluster.

  4. Click Next, confirm the configurations, and click Submit.
  5. On the Load Balancers page, view and obtain the public IP address of the newly created load balancer.

Add an ELB listener.

For details, see Adding a Listener.

  1. On the Load Balancers page, click the name of the created load balancer to go to its details page.
  2. Click the Listeners tab and then Add Listener.

  3. On the Add Listener page, set the parameters as prompted. Retain the default values for the parameters that are not mentioned in the following steps.

    1. Configure the listener.

      Set Frontend Protocol to TCP, set Frontend Port to the access port, and click Next: Configure Request Routing Policy.

    2. Configure a routing policy.

      Set Load Balancing Algorithm to Weighted round robin, enable Sticky Session, and click Next: Add Backend Server.

    3. Add backend servers.

      In the Backend Servers pane, click Add Backend Server, add all nodes where Doris FE is deployed, and click OK.

      To view the service IP address of a Doris FE instance, log in to the MRS cluster management console, choose Components, click Doris, and click the Instances tab.

    4. Set Backend Port of the servers to the MySQL protocol query connection port of the Doris FE service. The default port is 9030. You can search for query_port on the service configuration page of the Doris component to view the port.
    5. Click Next: Confirm.
    6. Confirm the configuration and click Submit.
    7. Click View/Add Backend Server in the row where the created listener is located. In the Backend Servers pane, check whether the connection between the ELB and backend server is normal.

Use ELB to access Doris on the MySQL client.

  1. Log in to a node where MySQL is installed and run the following command to connect to Doris. For details, see Using Doris from Scratch.

    mysql -u Database login user -pPassword -PELB frontend port -hELB public IP address

    • The ELB frontend port is that configured in 8.a.
    • Replace the ELB public IP address with the IP address obtained in 5.

  2. Run the following command to check the connection status of the FE service:

    show frontends;

    If the query result is successful, Doris can be successfully accessed through ELB.