How to Run Hue Shell Commands
You may need to administer Hue programmatically, for example, to reset the superuser password or assign an LDAP user superuser permissions. You must be logged in as root on a host with a Hue server to do so.
-
Set HUE_CONF_DIR to the latest Hue process directory:
export HUE_CONF_DIR="/var/run/cloudera-scm-agent/process/`ls -alrt /var/run/cloudera-scm-agent/process | grep HUE_SERVER | tail -1 | awk '{print $9}'`" echo $HUE_CONF_DIR
-
Set environment variables used to run the Hue webserver:
-
CentOS/RHEL:
for line in `strings /proc/$(lsof -i :8888|grep -m1 python|awk '{ print $2 }')/environ|egrep -v "^HOME=|^TERM=|^PWD="`;do export $line;done
-
Ubuntu:
for line in `strings /proc/$(lsof -i :8888|grep -m1 hue|awk '{ print $2 }')/environ|egrep -v "^HOME=|^TERM=|^PWD="`;do export $line;done
-
- Run shell subcommands
When true, HUE_IGNORE_PASSWORD_SCRIPT_ERRORS runs the Hue shell even if hue.ini contains passwords generated by Cloudera Manager (such as bind_password and ssl_password).Note: Do not export HUE_IGNORE_PASSWORD_SCRIPT_ERRORS or HUE_DATABASE_PASSWORD to ensure that they are not stored and only apply to this command.
For CDH parcel deployments:
- Run the interactive Hue Python shell (Ctrl+D to quit)
HUE_IGNORE_PASSWORD_SCRIPT_ERRORS=1 /opt/cloudera/parcels/CDH/lib/hue/build/env/bin/hue shell
Or with the database password:
HUE_IGNORE_PASSWORD_SCRIPT_ERRORS=1 HUE_DATABASE_PASSWORD=<your db password> /opt/cloudera/parcels/CDH/lib/hue/build/env/bin/hue shell
- Change a user password
HUE_IGNORE_PASSWORD_SCRIPT_ERRORS=1 /opt/cloudera/parcels/CDH/lib/hue/build/env/bin/hue changepassword admin
- Promote Hue user to superuser
HUE_IGNORE_PASSWORD_SCRIPT_ERRORS=1 /opt/cloudera/parcels/CDH/lib/hue/build/env/bin/hue shell
from django.contrib.auth.models import User a = User.objects.get(username='gwen') a.is_superuser = True a.save()
-
Count all of the documents of a certain user:
from django.contrib.auth.models import User from desktop.models import Document2 user=User.objects.get(username='demo') Document2.objects.documents(user=user).count() Out[X]: 1167
- List available subcommands
HUE_IGNORE_PASSWORD_SCRIPT_ERRORS=1 /opt/cloudera/parcels/CDH/lib/hue/build/env/bin/hue
For CDH package deployments:-
HUE_IGNORE_PASSWORD_SCRIPT_ERRORS=1 /usr/lib/hue/build/env/bin/hue shell
- Run the interactive Hue Python shell (Ctrl+D to quit)
For unmanaged and lower CDH versions, see:
Page generated August 29, 2019.
<< How to Enable S3 Cloud Storage in Hue | ©2016 Cloudera, Inc. All rights reserved | Hue Custom Databases >> |
Terms and Conditions Privacy Policy |