Last update: March 3rd 2016
Hue comes with a set of commands for simplifying the management of the service. Here is a quick guide about how to use them.
If using CM, export this variable in order to point to the correct Hue:
HUE_CONF_DIR=/var/run/cloudera-scm-agent/process/-hue-HUE_SERVER-id echo $HUE_CONF_DIR export HUE_CONF_DIR
If not using CM, just append the root of Hue home, normally:
You might need to have access to a local directory for the logs of the command, e.g.:
Starting in Cloudera Manager 5.5 passwords are not stored in configuration files in clear text anymore. As a result on Cloudera Manager 5.5 and higher you will need to know the password for Hue's DB connection to be able to run the Hue command line.
Running Hue command line on Cloudera Manager 5.5 and above
- This defines the password Hue should use to connect to the DB.
- HUE_IGNORE_PASSWORD_SCRIPT_ERRORS=1 - This configures the Hue command line to run even if there are other unknown passwords defined in the Cloudera Manager created hue.ini. Such as bind_password or ssl_password.
HUE_IGNORE_PASSWORD_SCRIPT_ERRORS=1 HUE_DATABASE_PASSWORD=password /opt/cloudera/parcels/CDH/lib/hue/build/env/bin/hue
- Note: When you include environment variables on the command line without a ";" between them as the above command does, they will only apply to that command. You won't have HUE_DATABASE_PASSWORD in the environment after the command finishes.
Example running changepassword:
[[email protected] ~]# export HUE_CONF_DIR="/var/run/cloudera-scm-agent/process/\`ls -1 /var/run/cloudera-scm-agent/process | grep HUE | sort -n | tail -1 \`" [[email protected] ~]# HUE_IGNORE_PASSWORD_SCRIPT_ERRORS=1 HUE_DATABASE_PASSWORD=password /opt/cloudera/parcels/CDH/lib/hue/build/env/bin/hue changepassword admin Changing password for user 'admin' Password: Password (again): Password changed successfully for user 'admin'
If you are performing command line actions that require other password, such as bind_password for syncing LDAP users and groups, you need to include environment variables to set those as well. Here is a list:
HUE_AUTH_PASSWORD = password used to authenticate to HS2/Impala. HUE_LDAP_PASSWORD = password used to authenticate to HS2/Impala. HUE_SSL_PASSWORD = password used for private key file. HUE_SMTP_PASSWORD = password used for SMTP. HUE_LDAP_BIND_PASSWORD = password used for Ldap Bind.
Running Hue command line on Cloudera Manager 5.4 and below
Example running changepassword.
[[email protected] tmp]# export HUE_CONF_DIR="/var/run/cloudera-scm-agent/process/\`ls -1 /var/run/cloudera-scm-agent/process | grep HUE | sort -n | tail -1 \`" [[email protected] tmp]# /opt/cloudera/parcels/CDH/lib/hue/build/env/bin/hue changepassword admin Changing password for user 'admin' Password: Password (again): Password changed successfully for user 'admin'
Executing the hue command with no argument will list them all:
./build/env/bin/hue ... [auth] changepassword createsuperuser [beeswax] beeswax_install_examples close_queries close_sessions [desktop] config_dump config_help config_upgrade create_desktop_app create_proxy_app create_test_fs kt_renewer runcherrypyserver runcpserver runpylint sync_documents test version [django] cleanup compilemessages createcachetable dbshell diffsettings dumpdata flush inspectdb loaddata makemessages reset runfcgi runserver shell sql sqlall sqlclear sqlcustom sqlflush sqlindexes sqlinitialdata sqlreset sqlsequencereset startapp startproject validate [django_extensions] clean_pyc compile_pyc create_app create_command create_jobs describe_form dumpscript export_emails generate_secret_key graph_models mail_debug passwd print_user_for_session reset_db runjob runjobs runprofileserver runscript runserver_plus set_fake_emails set_fake_passwords shell_plus show_templatetags show_urls sqldiff sync_media_s3 syncdata unreferenced_files [django_openid_auth] openid_cleanup [hbase] hbase_setup [indexer] indexer_setup [oozie] oozie_setup [pig] pig_setup [search] search_setup [south] convert_to_south datamigration graphmigrations migrate migrationcheck schemamigration startmigration syncdb testserver [spark] livy_server [useradmin] import_ldap_group import_ldap_user sync_ldap_users_and_groups useradmin_sync_with_unix
Starting the server
For stating the test server, defaulting to port 8000:
For stating the production server, defaulting to port 8888:
These commands are more detailed on the How to get started page.
Installing the examples
All the commands finishing by ‘_setup’ will install the example of the particular app.
In the case of Hive, in order to install the sample_07 and sample_08 tables and SQL queries, type:
These commands are also accessible directly from the Web UI.
Changing a password
This command is explained in more detail in the How to change or reset a forgotten password post:
Closing Hive queries
This command is explained in more detail in the Hive and Impala queries life cycle post:
Running the tests
This command is explained in more detail in the How to run the tests post:
Connect to the Database
This command is explained in more detail in the How to manage the database with the shell post:
Connect to the Python shell
In order to type any Django to Python:
./build/env/bin/hue shell < script.py
Have any questions? Feel free to contact us on hue-user or @gethue!