Hue High Availability

To enable high availability (HA) for Hue, you must have at least two Hue servers running on unique hosts, and at least one Load Balancer. For secure high availability, enable TLS/SSL for Hue and install Kerberos.

Configure Hue High Availability in Managed Clusters

This section applies to managed deployments with Cloudera Manager.

Minimum Required Role: Cluster Administrator (also provided by Full Administrator)

Prerequisites

  • Hue is configured to use an external database. See Hue Databases.
  • Secure configurations have TLS/SSL certificates and Kerberos installed.

Configuring Hue for High Availability in Cloudera Manager

  1. Go to the Hue service.
  2. Add Roles for Hue Server and Load Balancer (and for secure installations, Kerberos Ticket Renewer):
    1. Select Actions > Add Role Instances.
    2. Click Select hosts under Hue Server Hue Server Role, select a host, and click OK.
    3. Click Select hosts under Load Balancer Hue Load Balancer Role, select a host, and click OK.
    4. [Secure configurations] Click Select hosts under Kerberos Ticket Renewer Kerberos Ticket Renewer Role , select the same host as the new Hue server, and click OK.
    5. Click Continue.
    6. Check each role and select Actions for Selected > Start and click Start.
  3. [Secure configurations] Enable TLS/SSL for Hue:
    1. Go to Hue > Configuration and search on TLS/SSL.
    2. Find property, Enable TLS/SSL for Hue, and check Hue Server Default Group.
    3. Set other TLS/SSL properties appropriate for your setup. Some to consider are:
      • Hue Load Balancer Port - The Apache Load Balancer listens on this port. The default is 8889.
      • Path to TLS/SSL Certificate File - The TLS/SSL certificate file.
      • Path to TLS/SSL Private Key File - The TLS/SSL private key file.
  4. Click Save Changes and Restart Hue.

For more information, see Automatic High Availability and Load Balancing of Hue.

Configure Hue High Availability in Unmanaged Clusters

This section applies to unmanaged deployments without Cloudera Manager. To make the Hue service highly available, configure at least two Hue servers, each on a different host. Also configure the load balancer to direct traffic to an alternate host if the primary host becomes unavailable.

Prerequisites

  • The Hue service is installed and two or more Hue server roles are configured.
  • You have network access through SSH to the host machines with the Hue server role(s).
  • An external database was added each Hue server is configured to use it. See Hue Databases.

Installing and Configuring a nginx Load Balancer (for example)

To enable high availability for Hue, install the nginx load balancer on one of the Hue instances. Clients access this instance through a designated port number, and the nginx load balancer directs the request to one of the Hue server instances.

  1. With SSH, log in as the root user to the host machine of one of the Hue instances.
  2. Install nginx:
    Red Hat/Centos:
    yum install nginx
    Debian/Ubuntu:
    apt-get install nginx
  3. Create the following Hue cluster configuration file:
    /etc/nginx/conf.d/hue.conf
  4. Configure hue.conf with the following template:
    server {
        server_name NGINX_HOSTNAME;
        charset utf-8;
    
        listen 8001;
    
        # Or if running hue on https://
        ## listen 8001 ssl;
        ## ssl_certificate /path/to/ssl/cert;
        ## ssl_certificate_key /path/to/ssl/key;
    
        client_max_body_size 0;
        location / {
            proxy_pass http://hue;
            proxy_set_header Host $http_host;
            proxy_set_header X-Forwarded-For $remote_addr;
    
            # Or if the upstream Hue instances are running behind https://
            ## proxy_pass https://hue;
        }
    
        location /static/ {
            # Uncomment to expose the static file directories.
            ## autoindex on;
    
            # If Hue was installed with packaging install:
            ## alias /usr/lib/hue/build/static/;
    
            # Or if on a parcel install:
            alias /opt/cloudera/parcels/CDH/lib/hue/build/static/;
    
            expires 30d;
            add_header Cache-Control public;
        }
    }
    
    upstream hue {
        ip_hash;
    
        # List all the Hue instances here for high availability.
        server HUE_HOST1:8888 max_fails=3;
        server HUE_HOST2:8888 max_fails=3;
        ...
    }
  5. Update the following in the hue.conf file:
    • Replace NGINX_HOSTNAME with the URL of the host where you installed nginx. For example:
      server_name myhost-2.myco.com;
    • In the location/static block, comment or uncomment the alias lines, depending on whether your cluster was installed using parcels or packages. (The comment indicator is #.)
    • In the upstream hue block, list all the hostnames, including port number, of the Hue instances in your cluster. For example:
      server myhost-1.myco.com:8888 max_fails=3;
      server myhost-2.myco.com:8888 max_fails=3;
      server myhost-4.myco.com:8888 max_fails=3;
      
    • If the Hue service in your cluster is configured to use TLS/SSL:
      • Uncomment these lines, and replace the path names with the paths for your cluster:
        ## listen 8001 ssl;
        ## ssl_certificate /path/to/ssl/cert;
        ## ssl_certificate_key /path/to/ssl/key;
      • Uncomment the following line in the location / block:
        ## proxy_pass https://hue;
        and comment out the following line:
        proxy_pass http://hue;
      • Comment out the following line:
        listen 8001
  6. Start nginx:
    sudo service nginx start
  7. Test your installation by opening the Hue application in a web browser, using the following URL:
    • Without TLS/SSL: http://NGINX_HOSTNAME:8001

    • With TLS/SSL: https://NGINX_HOSTNAME:8001

    NGINX_HOSTNAME is the name of the host machine where you installed nginx.

  8. Test high availability:
    1. Stop the Hue service instance on the host where you installed nginx.
    2. Access the Hue application as described in the previous step. If you can connect to the Hue application, you have successfully enabled high availability.
  9. If necessary, configure your backend database for high availability. Consult the vendor documentation for the database that you configured for Hue.