How to Run Hue Shell Commands

You may need to administer Hue programmatically, for example, to reset the superuser password. This page addresses managed deployments of CDH 5.5 and higher.

  1. Gather the following information:
    • Hue server database password (embedded or external).
    • Path to /build/env/bin/hue:
      # Parcels (e.g., /opt/cloudera/parcels/CDH-5.9.0-1.cdh5.9.0.p0.23/lib/hue)
      realpath /opt/cloudera/parcels/`ls -l /opt/cloudera/parcels | grep CDH | tail -1 | awk '{print $9}'`/lib/hue
      
      # Packages
      /usr/lib/hue
    • Path to the current Hue process directory (with Hue configuration files):
      #Example path: /var/run/cloudera-scm-agent/process/56-hue-HUE_SERVER/
      realpath /var/run/cloudera-scm-agent/process/`ls -alrt /var/run/cloudera-scm-agent/process | grep HUE | tail -1 | awk '{print $9}'`



  2. 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 | tail -1 | awk '{print $9}'`"
    echo $HUE_CONF_DIR
  3. 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).

    Parcels

    • List available subcommands
      HUE_IGNORE_PASSWORD_SCRIPT_ERRORS=1 HUE_DATABASE_PASSWORD=<db_password> /opt/cloudera/parcels/`ls -l /opt/cloudera/parcels | grep CDH | tail -1 | awk '{print $9}'`/lib/hue/build/env/bin/hue
    • Run the interactive Hue Python shell (Ctrl+D to quit)
      HUE_IGNORE_PASSWORD_SCRIPT_ERRORS=1 HUE_DATABASE_PASSWORD=<db_password> /opt/cloudera/parcels/`ls -l /opt/cloudera/parcels | grep CDH | tail -1 | awk '{print $9}'`/lib/hue/build/env/bin/hue shell
    • Change a user password
      HUE_IGNORE_PASSWORD_SCRIPT_ERRORS=1 HUE_DATABASE_PASSWORD=<db_password> /opt/cloudera/parcels/`ls -l /opt/cloudera/parcels | grep CDH | tail -1 | awk '{print $9}'`/lib/hue/build/env/bin/hue changepassword <username>
    Packages
    • List available subcommands
      HUE_IGNORE_PASSWORD_SCRIPT_ERRORS=1 HUE_DATABASE_PASSWORD=<db_password> /usr/lib/hue/build/env/bin/hue
    • Run the interactive Hue Python shell (Ctrl+D to quit)
      HUE_IGNORE_PASSWORD_SCRIPT_ERRORS=1 HUE_DATABASE_PASSWORD=<db_password> /usr/lib/hue/build/env/bin/hue shell
    • Change a user password
      HUE_IGNORE_PASSWORD_SCRIPT_ERRORS=1 HUE_DATABASE_PASSWORD=<db_password> /usr/lib/hue/build/env/bin/hue changepassword <username>