These configuration variables are under the [desktop] section in
the hue.ini configuration file.
Hue uses CherryPy web server. You can use the following options to change the IP address and port that the web server listens on. The default setting is port 8888 on all configured IP addresses.
# Webserver listens on this address and port
http_host=0.0.0.0
http_port=8888
For security, you should also specify the secret key that is used for secure hashing in the session store. Enter a long series of random characters (30 to 60 characters is recommended).
secret_key=jFE93j;2[290-eiw.KEiwN2s3['d;/.q[eIW^y#e=+Iei*@Mn<qW5o
NOTE: If you don't specify a secret key, your session cookies will not be secure. Hue will run but it will also display error messages telling you to set the secret key.
In the Hue ini configuration file, in the [desktop] section, you can enter the names of the app to hide:
[desktop] # Comma separated list of apps to not load at server startup. app_blacklist=beeswax,impala,security,filebrowser,jobbrowser,rdbms,jobsub,pig,hbase,sqoop,zookeeper,metastore,spark,oozie,indexer
By default, the first user who logs in to Hue can choose any username and password and becomes an administrator automatically. This user can create other user and administrator accounts. User information is stored in the Django database in the Django backend.
The authentication system is pluggable. For more information, see the Hue SDK Documentation.
List of some of the possible authentications:
For example, to enable Hue to first attempt LDAP directory lookup before falling back to the database-backed user model, we can update the hue.ini configuration file or Hue safety valve in Cloudera Manager with a list containing first the LdapBackend followed by either the ModelBackend or custom AllowFirstUserDjangoBackend (permits first login and relies on user model for all subsequent authentication):
[desktop] [[auth]] backend=desktop.auth.backend.LdapBackend,desktop.auth.backend.AllowFirstUserDjangoBackend
This tells Hue to first check against the configured LDAP directory service, and if the username is not found in the directory, then attempt to authenticate the user with the Django user manager.
Programmatically
When a Hue administrator loses their password, a more programmatic approach is required to secure the administrator again. Hue comes with a wrapper around the python interpreter called the “shell” command. It loads all the libraries required to work with Hue at a programmatic level. To start the Hue shell, type the following command from the Hue installation root.
Then:
cd /usr/lib/hue (or /opt/cloudera/parcels/CDH-XXXXX/share/hue if using parcels and CM)
build/env/bin/hue shell
The following is a small script, that can be executed within the Hue shell, to change the password for a user named “example”:
from django.contrib.auth.models import User
user = User.objects.get(username='example')
user.set_password('some password')
user.save()
The script can also be invoked in the shell by using input redirection (assuming the script is in a file named script.py):
build/env/bin/hue shell < script.py
How to make a certain user a Hue admin
build/env/bin/hue shell
Then set these properties to true:
from django.contrib.auth.models import User
a = User.objects.get(username='hdfs')
a.is_staff = True
a.is_superuser = True
a.set_password('my_secret')
a.save()
** Via a command**
Go on the Hue machine, then in the Hue home directory and either type:
To change the password of the currently logged in Unix user:
build/env/bin/hue changepassword
If you don't remember the admin username, create a new Hue admin (you will then also be able to login and could change the password of another user in Hue):
build/env/bin/hue createsuperuser
The properties we need to tweak are leaflet_tile_layer and leaflet_tile_layer_attribution, that can be configured in the hue.ini file:
[desktop]
leaflet_tile_layer=https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}
leaflet_tile_layer_attribution='Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
We explained how to run Hue with NGINX serving the static files or under Apache. If you use another proxy, you might need to set these options:
[desktop] # Enable X-Forwarded-Host header if the load balancer requires it. use_x_forwarded_host=false # Support for HTTPS termination at the load-balancer level with SECURE_PROXY_SSL_HEADER. secure_proxy_ssl_header=false
You can configure Hue to serve over HTTPS.
Configure Hue to use your private key by adding the following
options to the hue.ini configuration file:
ssl_certificate=/path/to/certificate ssl_private_key=/path/to/key
Ideally, you would have an appropriate key signed by a Certificate Authority.
If you're just testing, you can create a self-signed key using the openssl
command that may be installed on your system:
Create a key:
openssl genrsa 1024 > host.key
Create a self-signed certificate:
openssl req -new -x509 -nodes -sha1 -key host.key > host.cert
When getting a bigger result set from Hive/Impala or bigger files like images from HBase, the response requires to increase the buffer size of SASL lib for thrift sasl communication.
[desktop] # This property specifies the maximum size of the receive buffer in bytes in thrift sasl communication (default 2 MB). sasl_max_buffer=2 * 1024 * 1024
In the [useradmin] section of the configuration file, you can
optionally specify the following:
default_user_group:: The name of a default group that is suggested when creating a user manually. If the LdapBackend or PamBackend are configured for doing user authentication, new users will automatically be members of the default group.
You can add a custom banner to the Hue Web UI by applying HTML directly to the property, banner_top_html. For example:
banner_top_html=<H4>My company's custom Hue Web UI banner</H4>
You can customize a splash screen on the login page by applying HTML directly to the property, login_splash_html. For example:
[desktop]
[[custom]]
login_splash_html=WARNING: You are required to have authorization before you proceed.
There is also the possibility to change the logo for further personalization.
[desktop]
[[custom]]
# SVG code to replace the default Hue logo in the top bar and sign in screen
# e.g. <image xlink:href="/static/desktop/art/hue-logo-mini-white.png" x="0" y="0" height="40" width="160" />
logo_svg=
You can go crazy and write there any SVG code you want. Please keep in mind your SVG should be designed to fit in a 160×40 pixels space. To have the same ‘hearts logo’ you can see above, you can type this code
[desktop]
[[custom]]
logo_svg='<g><path stroke="null" id="svg_1" d="m44.41215,11.43463c-4.05017,-10.71473 -17.19753,-5.90773 -18.41353,-0.5567c-1.672,-5.70253 -14.497,-9.95663 -18.411,0.5643c-4.35797,11.71793 16.891,22.23443 18.41163,23.95773c1.5181,-1.36927 22.7696,-12.43803 18.4129,-23.96533z" fill="#ffffff"/> <path stroke="null" id="svg_2" d="m98.41246,10.43463c-4.05016,-10.71473 -17.19753,-5.90773 -18.41353,-0.5567c-1.672,-5.70253 -14.497,-9.95663 -18.411,0.5643c-4.35796,11.71793 16.891,22.23443 18.41164,23.95773c1.5181,-1.36927 22.76959,-12.43803 18.41289,-23.96533z" fill="#FF5A79"/> <path stroke="null" id="svg_3" d="m154.41215,11.43463c-4.05016,-10.71473 -17.19753,-5.90773 -18.41353,-0.5567c-1.672,-5.70253 -14.497,-9.95663 -18.411,0.5643c-4.35796,11.71793 16.891,22.23443 18.41164,23.95773c1.5181,-1.36927 22.76959,-12.43803 18.41289,-23.96533z" fill="#ffffff"/> </g>'
Read more about it in Hue with a custom logo post.
This article details how to store passwords in a script launched from the OS rather than have clear text passwords in the hue*.ini files.
Some passwords go in Hue ini configuration file making them easily visible to Hue admin user or by users of cluster management software. You can use the password_script feature to prevent passwords from being visible.
Hue now offers a new property, idle_session_timeout, that can be configured in the hue.ini file:
[desktop] [[auth]] idle_session_timeout=600
When idle_session_timeout is set, users will automatically be logged out after N (e.g. – 600) seconds of inactivity and be prompted to login again:
Read more about Auditing User Administration Operations with Hue and Cloudera Navigator.
These configuration variables are under the [hadoop] section in
the hue.ini configuration file.
Depending on which apps you need, you need to make sure that some Hadoop services are already setup (that way Hue can talk to them).
|-------------|--------------------------------------------------------| | Component | Applications | |-------------|--------------------------------------------------------| | Editor | SQL (Hive, Impala, any database...), Pig, Spark... | | Browsers | YARN, Oozie, Impala, HBase, Livy | | Scheduler | Oozie | | Dashboard | Solr, SQL (Impala, Hive...) | |-------------|--------------------------------------------------------|
You need to enable WebHdfs or run an HttpFS server. To turn on WebHDFS,
add this to your hdfs-site.xml and restart your HDFS cluster.
Depending on your setup, your hdfs-site.xml might be in /etc/hadoop/conf.
<property>
<name>dfs.webhdfs.enabled</name>
<value>true</value>
</property>
You also need to add this to core-site.xml.
<property>
<name>hadoop.proxyuser.hue.hosts</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.hue.groups</name>
<value>*</value>
</property>
If you place your Hue Server outside the Hadoop cluster, you can run an HttpFS server to provide Hue access to HDFS. The HttpFS service requires only one port to be opened to the cluster.
Also add this in httpfs-site.xml which might be in /etc/hadoop-httpfs/conf.
<property>
<name>httpfs.proxyuser.hue.hosts</name>
<value>*</value>
</property>
<property>
<name>httpfs.proxyuser.hue.groups</name>
<value>*</value>
</property>
Hue submits MapReduce jobs to Oozie as the logged in user. You need to
configure Oozie to accept the hue user to be a proxyuser. Specify this in
your oozie-site.xml (even in a non-secure cluster), and restart Oozie:
<property>
<name>oozie.service.ProxyUserService.proxyuser.hue.hosts</name>
<value>*</value>
</property>
<property>
<name>oozie.service.ProxyUserService.proxyuser.hue.groups</name>
<value>*</value>
</property>
Hue's Hive SQL Editor application helps you use Hive to query your data. It depends on a Hive Server 2 running in the cluster. Please read this section to ensure a proper integration.
Your Hive data is stored in HDFS, normally under /user/hive/warehouse
(or any path you specify as hive.metastore.warehouse.dir in your
hive-site.xml). Make sure this location exists and is writable by
the users whom you expect to be creating tables. /tmp (on the local file
system) must be world-writable (1777), as Hive makes extensive use of it.
HiveServer2 and Impala support High Availability through a “load balancer”. One caveat is that Hue’s underlying Thrift libraries reuse TCP connections in a pool, a single user session may not have the same Impala or Hive TCP connection. If a TCP connection is balanced away from the previously selected HiveServer2 or Impalad instance, the user session and its queries can be lost and trigger the “Results have expired” or “Invalid session Id” errors.
To prevent sessions from being lost, you need configure the load balancer with “source” algorithm to ensure each Hue instance sends all traffic to a single HiveServer2/Impalad instance. Yes, this is not true load balancing, but a configuration for failover High Availability. HiveSever2 or Impala coordinators already distribute the work across the cluster so this is not an issue.
To enable an optimal load distribution that works for everybody, you can create multiple profiles in our load balancer, per port for Hue clients and non-Hue clients like Hive or Impala. You can configure non-Hue clients to distribute loads with “roundrobin” or “leastconn” and configure Hue clients with “source” (source IP Persistence) on dedicated ports, for example, 10015 for Hive beeline commands, 10016 for Hue, 21051 for Hue-Impala interactions while 25003 for Impala shell.
You can configure the HaProxy to have two different ports associated with different load balancing algorithms. Here is a sample configuration (haproxy.cfg) for Hive and Impala HA on a secure cluster.
frontend hiveserver2_front
bind *:10015 ssl crt /path/to/cert_key.pem
mode tcp
option tcplog
default_backend hiveserver2
backend hiveserver2
balance roundrobin
mode tcp
server hs2_1 host-2.com:10000 ssl ca-file /path/to/truststore.pem check
server hs2_2 host-3.com:10000 ssl ca-file /path/to/truststore.pem check
server hs2_3 host-1.com:10000 ssl ca-file /path/to/truststore.pem check
frontend hivejdbc_front
bind *:10016 ssl crt /path/to/cert_key.pem
mode tcp
option tcplog
stick match src
stick-table type ip size 200k expire 30m
default_backend hivejdbc
backend hivejdbc
balance source
mode tcp
server hs2_1 host-2.com:10000 ssl ca-file /path/to/truststore.pem check
server hs2_2 host-3.com:10000 ssl ca-file /path/to/truststore.pem check
server hs2_3 host-1.com:10000 ssl ca-file /path/to/truststore.pem check
And here is an example for impala HA configuration on a secure cluster.
frontend impala_front
bind *:25003 ssl crt /path/to/cert_key.pem
mode tcp
option tcplog
default_backend impala
backend impala
balance leastconn
mode tcp
server impalad1 host-3.com:21000 ssl ca-file /path/to/truststore.pem check
server impalad2 host-2.com:21000 ssl ca-file /path/to/truststore.pem check
server impalad3 host-4.com:21000 ssl ca-file /path/to/truststore.pem check
frontend impalajdbc_front
bind *:21051 ssl crt /path/to/cert_key.pem
mode tcp
option tcplog
stick match src
stick-table type ip size 200k expire 30m
default_backend impalajdbc
backend impalajdbc
balance source
mode tcp
server impalad1 host-3.com:21050 ssl ca-file /path/to/truststore.pem check
server impalad2 host-2.com:21050 ssl ca-file /path/to/truststore.pem check
server impalad3 host-4.com:21050 ssl ca-file /path/to/truststore.pem check
Note: “check” is required at end of each line to ensure HaProxy can detect any unreachable Impalad/HiveServer2 server, so HA failover can be successful. Without TCP check, you may hit the “TSocket reads 0 byte” error when the Impalad/HiveServer2 server Hue tries to connect is down.
After editing the /etc/haproxy/haproxy.cfg file, run following commands to restart HaProxy service and check the service restarts successfully.
service haproxy restart service haproxy status
Also we need add following blocks into hue.ini.
[impala] server_port=21051Read more about it in the How to optimally configure your Analytic Database for High Availability with Hue and other SQL clients post.[beeswax] hive_server_port=10016
Hue currently requires that the machines within your cluster can connect to each other freely over TCP. The machines outside your cluster must be able to open TCP port 8888 on the Hue Server (or the configured Hue web HTTP port) to interact with the system.
Hue supports one HDFS cluster. That cluster should be defined
under the [[[default]]] sub-section.
fs_defaultfs::
This is the equivalence of fs.defaultFS (aka fs.default.name) in
Hadoop configuration.
webhdfs_url:: You can also set this to be the HttpFS url. The default value is the HTTP port on the NameNode.
hadoop_conf_dir::
This is the configuration directory of the HDFS, typically
/etc/hadoop/conf.
Hue’s filebrowser can now allow users to explore, manage, and upload data in an S3 account, in addition to HDFS.
Read more about it in the S3 User Documentation.
In order to add an S3 account to Hue, you’ll need to configure Hue with valid S3 credentials, including the access key ID and secret access key: AWSCredentials
These keys can securely stored in a script that outputs the actual access key and secret key to stdout to be read by Hue (this is similar to how Hue reads password scripts). In order to use script files, add the following section to your hue.ini configuration file:
[aws] [[aws_accounts]] [[[default]]] access_key_id_script=/path/to/access_key_script secret_access_key_script= /path/to/secret_key_script allow_environment_credentials=false region=us-east-1
Alternatively (but not recommended for production or secure environments), you can set the access_key_id and secret_access_key values to the plain-text values of your keys:
[aws] [[aws_accounts]] [[[default]]] access_key_id=s3accesskeyid secret_access_key=s3secretaccesskey allow_environment_credentials=false region=us-east-1
The region should be set to the AWS region corresponding to the S3 account. By default, this region will be set to ‘us-east-1’.
Hue’s file browser can now allow users to explore, manage, and upload data in an ADLS, in addition to HDFS and S3.
Read more about it in the ADLS User Documentation.
In order to add an ADLS account to Hue, you’ll need to configure Hue with valid ADLS credentials, including the client ID, client secret and tenant ID. These keys can securely stored in a script that outputs the actual access key and secret key to stdout to be read by Hue (this is similar to how Hue reads password scripts). In order to use script files, add the following section to your hue.ini configuration file:
[adls] [[azure_accounts]] [[[default]]] client_id_script=/path/to/client_id_script.sh client_secret_script=/path/to/client_secret_script.sh tenant_id_script=/path/to/tenant_id_script.sh [[adls_clusters]] [[[default]]] fs_defaultfs=adl://.azuredatalakestore.net webhdfs_url=https://.azuredatalakestore.net
Alternatively (but not recommended for production or secure environments), you can set the client_secret value in plain-text:
[adls] [[azure_account]] [[[default]]] client_id=adlsclientid client_secret=adlsclientsecret tenant_id=adlstenantid [[adls_clusters]] [[[default]]] fs_defaultfs=adl://.azuredatalakestore.net webhdfs_url=https://.azuredatalakestore.net
Hue supports one or two Yarn clusters (two for HA). These clusters should be defined
under the [[[default]]] and [[[ha]]] sub-sections.
resourcemanager_host:: The host running the ResourceManager.
resourcemanager_port:: The port for the ResourceManager REST service.
logical_name:: NameNode logical name.
submit_to:: To enable the section, set to True.
In the [impala] section of the configuration file, you can
optionally specify the following:
server_host::
The hostname or IP that the Impala Server should bind to. By
default it binds to localhost, and therefore only serves local
IPC clients.
LDAP or PAM pass-through authentication with Hive or Impala and Impersonation .
In the [beeswax] section of the configuration file, you can
optionally specify the following:
beeswax_server_host::
The hostname or IP that the Hive Server should bind to. By
default it binds to localhost, and therefore only serves local
IPC clients.
hive_conf_dir::
The directory containing your hive-site.xml Hive
configuration file.
Use the query editor with any JDBC or Django-compatible database.
In the [liboozie] section of the configuration file, you should
specify:
oozie_url::
The URL of the Oozie service. It is the same as the OOZIE_URL
environment variable for Oozie.
In the [search] section of the configuration file, you should
specify:
solr_url:: The URL of the Solr service.
In the [hbase] section of the configuration file, you should
specify:
hbase_clusters:: Comma-separated list of HBase Thrift servers for clusters in the format of "(name|host:port)".
Hue can detect certain invalid configuration.
To view the configuration of a running Hue instance, navigate to
http://myserver:8888/hue/dump_config, also accessible through the About
application.
Now that you've installed and started Hue, you can feel free to skip ahead to the <> section. Administrators may want to refer to this section for more details about managing and operating a Hue installation.
Displays the Hue Server log and allows you to download the log to your local system in a zip file.
Read more on the Threads and Metrics pages blog post
Threads page can be very helpful in debugging purposes. It includes a daemonic thread and the thread objects serving concurrent requests. The host name, thread name identifier and current stack frame of each are displayed. Those are useful when Hue “hangs”, sometimes in case of a request too CPU intensive. There is also a REST API to get the dump of Threads using 'desktop/debug/threads'
Read more on the Threads and Metrics pages blog post
Hue uses the PyFormance Python library to collect the metrics. These metrics are represented as gauge, counters, meter, rate of events over time, histogram, statistical distribution of values. A REST API endpoint '/desktop/metrics/' to get all the metrics dump as json is also exposed
The below metrics of most concern to us are displayed on the page:
One of the most useful ones are the percentiles of response time of requests and the count of active users. Admins can either filter a particular property in all the metrics or select a particular metric for all properties
The User Admin application lets a superuser add, delete, and manage Hue users and groups, and configure group permissions. Superusers can add users and groups individually, or import them from an LDAP directory. Group permissions define the Hue applications visible to group members when they log into Hue and the application features available to them.
Click the User Admin icon in the top right navigation bar under your username.
LDAP or PAM pass-through authentication with Hive or Impala and Impersonation .
The User Admin application provides two levels of user privileges: superusers and users.
Superusers — The first user who logs into Hue after its initial installation becomes the first superuser. Superusers have permissions to perform administrative functions:
Users — can change their name, e-mail address, and password and log in to Hue and run Hue applications, subject to the permissions provided by the Hue groups to which they belong.
| Username | A user name that contains only letters, numbers, and underscores;
| ||||||||||||||||||||||||||||||||
| Password and Password confirmation | A password for the user. This is a required field. | ||||||||||||||||||||||||||||||||
| Create home directory | Indicate whether to create a directory named /user/username in HDFS.
Deleting a User
Editing a User
Importing Users from an LDAP Directory
Importing users from an LDAP directory does not import any password information. You must add passwords manually in order for a user to log in. To add a user from an external LDAP directory:
Syncing Users and Groups with an LDAP DirectoryYou can sync the Hue user database with the current state of the LDAP directory using the Sync LDAP users/groups function. This updates the user and group information for the already imported users and groups. It does not import any new users or groups.
GroupsSuperusers can add and delete groups, configure group permissions, and assign users to group memberships. Adding a GroupYou can add groups, and delete the groups you've added. You can also import groups from an LDAP directory.
Adding Users to a Group
Deleting a Group
Importing Groups from an LDAP Directory
PermissionsPermissions for Hue applications are granted to groups, with users gaining permissions based on their group membership. Group permissions define the Hue applications visible to group members when they log into Hue and the application features available to them.
Process HierarchyA script called
If you have installed other applications into your Hue instance, you may see other daemons running under the supervisor as well. You can see the supervised processes running in the output of
Note that the supervisor automatically restarts these processes if they fail for any reason. If the processes fail repeatedly within a short time, the supervisor itself shuts down. LoggingThe Hue logs are found in
If users on your cluster have problems running Hue, you can often find error
messages in these log files. If you are unable to start Hue from the init
script, the Viewing Recent Log MessagesIn addition to logging DatabaseHue requires a SQL database to store small amounts of data, including user account information as well as history of job submissions and Hive queries. By default, Hue is configured to use the embedded database SQLite for this purpose, and should require no configuration or management by the administrator. However, MySQL is the recommended database to use. This section contains instructions for configuring Hue to access MySQL and other databases. Inspecting the DatabaseThe default SQLite database used by Hue is located in:
It is strongly recommended that you avoid making any modifications to the database directly using SQLite, though this trick can be useful for management or troubleshooting. Backing up the DatabaseIf you use the default SQLite database, then copy the Configuring to Access Another DatabaseAlthough SQLite is the default database type, some advanced users may prefer to have Hue access an alternate database type. Note that if you elect to configure Hue to use an external database, upgrades may require more manual steps in the future. The following instructions are for MySQL, though you can also configure Hue to work with other common databases such as PostgreSQL and Oracle.
Note that Hue has only been tested with SQLite and MySQL database backends.
Configuring to Store Data in MySQLTo configure Hue to store data in MySQL:
Your system is now configured and you can start the Hue server as normal. Using HueAfter installation, you can use Hue by navigating to The link:user-guide/index.html[user guide] will help users go through the various installed applications. Supported BrowsersThe two latest LTS versions of each browsers:
FeedbackYour feedback is welcome. The best way to send feedback is to join the https://groups.google.com/a/cloudera.org/group/hue-user[mailing list], and send e-mail, to mailto:hue-user@cloudera.org[hue-user@cloudera.org]. Reporting BugsIf you find that something doesn't work, it'll often be helpful to include logs from your server. Please include the logs as a zip (or cut and paste the ones that look relevant) and send those with your bug reports.
|