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
- Go to the Hue service.
- Add Roles for Hue Server and Load Balancer (and for secure installations, Kerberos Ticket
Renewer):
- Select .
- Click Select hosts under Hue Server , select a host, and click OK.
- Click Select hosts under Load Balancer , select a host, and click OK.
- [Secure configurations] Click Select hosts under Kerberos Ticket Renewer , select the same host as the new Hue server, and click OK.
- Click Continue.
- Check each role and select Start. and click
- [Secure configurations] Enable TLS/SSL for Hue:
- Go to TLS/SSL. and search on
- Find property, Enable TLS/SSL for Hue, and check Hue Server Default Group.
- 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.
- 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
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.
- With SSH, log in as the root user to the host machine of one of the Hue instances.
- Install nginx:
Red Hat/Centos:
yum install nginx
Debian/Ubuntu:apt-get install nginx
- Create the following Hue cluster configuration file:
/etc/nginx/conf.d/hue.conf
- 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; ... }
- 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
- Uncomment these lines, and replace the path names with the paths for your cluster:
- Replace NGINX_HOSTNAME with the URL of the host where you installed nginx. For example:
- Start nginx:
sudo service nginx start
- 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.
-
- Test high availability:
- Stop the Hue service instance on the host where you installed nginx.
- Access the Hue application as described in the previous step. If you can connect to the Hue application, you have successfully enabled high availability.
- If necessary, configure your backend database for high availability. Consult the vendor documentation for the database that you configured for Hue.