By default, Alibaba Cloud E-MapReduce (EMR) deploys a Hue instance on each master node of EMR Hadoop clusters. If Hue is frequently accessed, the speed at which data is loaded to Hue decreases. This topic describes how to use a gateway cluster to increase the number of Hue instances. It also describes how to use Alibaba Cloud Server Load Balancer (SLB) to access Hue and balance the loads of multiple Hue instances.

Prerequisites

An EMR Hadoop cluster is created. For more information, see Create a cluster.
Note If the EMR version is V3.X.X earlier than V3.28.0 or V4.X.X earlier than V4.3.0, submit a ticket to enable multi-instance deployment.

Step 1: Create a gateway cluster

  1. Log on to the Alibaba Cloud EMR console.
  2. In the top navigation bar, select the region where your cluster resides and select a resource group based on your business requirements.
  3. Click the Cluster Management tab.
  4. Click CreateGateway in the upper-right corner.
  5. On the Create Gateway page, configure the following parameters. Retain the default values for the other parameters.
    1. Specify the name of the gateway cluster in the Cluster Name field.
    2. Turn on Assign Public IP Address.
    3. Specify a password for the gateway cluster in the Password field.
    4. Select the created Hadoop cluster from the Associated Cluster drop-down list.
    5. Read the terms of service and select E-MapReduce Service Terms.
    Note If you use the gateway cluster only to balance loads for Hue, set the system disk size to 120 GB, the data disk size to 200 GB, and Count to 2.
  6. Click Create.

Step 2: Add Hue to the gateway cluster

  1. On the Cluster Management page, find the gateway cluster and click Details in the Actions column.
  2. Optional:On the Cluster Overview page, view the EMR version of your gateway cluster in the Software Info section.
    If the EMR version is V3.X.X earlier than V3.28.0 or V4.X.X earlier than V4.3.0, log on to a node of the gateway cluster and run the following commands:
    mysql -u root -pEMRroot1234 -hemr-header-1 << EOF
    GRANT ALL PRIVILEGES on *.* to 'hue'@'%' WITH GRANT OPTION;
    GRANT ALL on hue.* to 'hue'@'%' IDENTIFIED BY 'EMRhue1234';
    FLUSH PRIVILEGES;
    CREATE DATABASE IF NOT EXISTS hue;
    EOF
  3. In the left-side navigation pane, click Cluster Management.
  4. On the Clusters and Services page, click Add Service.
  5. On the Add Service page, select Hue.
  6. Click OK.

Step 3: Configure Hue

  1. On the Cluster Management page, find the gateway cluster and click Details in the Actions column.
  2. In the left-side navigation pane, choose Cluster Service > Hue.
  3. Click the Configure tab. In the Service Configuration section, specify the more_hue_ports parameter. Separate port numbers with commas (,).
    port
    Note Each port number represents a Hue instance on each node. The default port number is 8888. If you specify n port numbers in the more_hue_ports field for a gateway cluster that consists of m nodes, the system deploys a total number of m × (n + 1) Hue instances in the gateway cluster.
  4. In the upper-right corner of the Service Configuration section, click Save.
  5. In the Confirm Changes dialog box, configure the parameters.
    1. Specify Description.
    2. Turn on Auto-update Configuration.
    3. Click OK.
  6. Restart Hue.
    1. In the upper-right corner of the Hue service page, choose Actions > Restart Hue.
    2. In the Cluster Activities dialog box, configure the parameters.
    3. Click OK.
    4. In the Confirm message, click OK.

Step 4: Enable load balancing

  1. Create an SLB instance. For more information, see Create a CLB instance.
  2. On the Instances page, find the SLB instance and click Configure Listener in the Actions column.
  3. In the Protocol and Listener step, perform the following operations:
    1. Select HTTP.
    2. Set Listening Port to 80.
    3. In the Advanced section, click Modify.
    4. Turn on Enable Session Persistence and set Persistent Timeout to 36000.
    5. Set Idle Timeout to 60.
    6. Click Next.
  4. In the Backend Servers step, perform the following operations:
    1. Select Create VServer Group from the Select Server Group drop-down list.
    2. Specify VServer Group Name. For example, set it to HUE_SLB.
    3. Click Add.
    4. Search for and select the ECS instance ID of the gateway cluster. Click Next.
    5. Click Add Port in the Actions column to add the default port 8888 and the ports configured for the more_hue_ports parameter in Step 3: Configure Hue.
    6. Click Add.
    7. Click Next.
  5. In the Health Check step, click Next.
  6. In the Confirm step, click Submit.
  7. In the Configure Server Load Balancer message, click OK.
    You are redirected to the Instances page. Click the refresh icon in the upper-right corner.

    If the health check status of a backend ECS instance is Active, the backend ECS instance is running properly and is able to process requests forwarded by SLB.

Step 5: Access Hue

Enter IP address of the SLB instance:Listening port in the address bar of your browser and press Enter. Then, use the default account admin and the initial password to log on to Hue.
  • IP address: You can view the IP address on the Instances page of the SLB console.
  • Listening port: the value of Listening Port that is configured in Step 4: Enable load balancing. In this example, port 80 is used.
To obtain the initial password, perform the following steps:
  1. On the Cluster Management page of the EMR console, find the cluster and click Details in the Actions column.
  2. In the left-side navigation pane, choose Cluster Service > Hue.
  3. Click the Configure tab. In the Service Configuration section, check the value of the admin_pwd parameter. The value is the initial password.