manual.txt 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  1. Hue Tarball Installation Guide
  2. ==============================
  3. == Introduction
  4. Hue is a graphical user interface to operate and develop applications for
  5. Hadoop. Hue applications are collected into a desktop-style environment and
  6. delivered as a Web application, requiring no additional installation for
  7. individual users.
  8. This guide describes how to install and configure a Hue tarball. For
  9. information about installing Hue packages, see
  10. https://wiki.cloudera.com/display/DOC/Installing+Hue[Installing Hue].
  11. There is also a companion SDK guide that describes how to develop
  12. new Hue applications:
  13. http://archive.cloudera.com/cdh3/hue/sdk/sdk.html[Hue SDK Documentation]
  14. IMPORTANT: Hue requires the Cloudera Distribution for Hadoop (CDH), version 2 or 3.
  15. .Conventions Used in this Guide:
  16. * Commands that must be run with +root+ permission have a +#+ command prompt.
  17. * Commands that do not require +root+ permission have a +$+ command prompt.
  18. == Installation Instructions
  19. The following instructions describe how to install the Hue tarball on a
  20. multi-node cluster. You must install CDH2 or CDH3 first and update some
  21. Hadoop configuration files before installing Hue.
  22. IMPORTANT: You'll need to install the Hue Plug-ins
  23. on _every_ machine that's running Hadoop daemons.
  24. === Install CDH2 or CDH3
  25. To use Hue, you must be running the Cloudera Distribution for Hadoop
  26. with a version number of at least `0.20.1+133`. If you are not running this
  27. version of CDH or later, upgrade your cluster before proceeding.
  28. === Install Hue
  29. Hue consists of a web service that runs on a special node in your cluster.
  30. Choose one node where you want to run Hue. This guide refers to that node as
  31. the _Hue Server_. For optimal performance, this should be one of the nodes
  32. within your cluster, though it can be a remote node as long as there are no
  33. overly restrictive firewalls. For small clusters of less than 10 nodes,
  34. you can use your existing master node as the Hue Server.
  35. You can download the Hue tarball here:
  36. http://github.com/downloads/cloudera/hue/hue-latest.tgz[tarball].
  37. ==== Hue Dependencies
  38. Hue employs some Python modules which use native code and requires
  39. certain development libraries be installed on your system. To install from the
  40. tarball, you must have the following installed:
  41. .Required Dependencies
  42. [grid="rows"]
  43. ``~
  44. Redhat,Debian
  45. ~~~~~~~~~~
  46. gcc,gcc
  47. libxml2-devel,libxml2-dev
  48. libxslt-devel,libxslt-dev
  49. mysql-devel,librarysqlclient-dev
  50. python-devel,python-dev
  51. python-setuptools,python-setuptools
  52. sqlite-devel,libsqlite3-dev
  53. ~~~~~~~~~~
  54. ==== Build
  55. Configure `$HADOOP_HOME` and `$PREFIX` with the path of your Hadoop
  56. installation and the path where you want to install Hue by running:
  57. ----
  58. $ HADOOP_HOME=/path/to/hadoop-0.20 PREFIX=/path/to/install/into make install
  59. ----
  60. You can install Hue anywhere on your system - it does not need root permission
  61. although additional thirdparty SDK applications may.
  62. It is a good practice to create a new user for Hue and either install Hue in
  63. that user's home directory, or in a directory within `/usr/local`.
  64. ==== Install Hadoop Plugins
  65. In order to communicate with Hadoop, Hue requires a plug-in jar that you must
  66. install and configure. This jar is: `desktop/libs/hadoop/java-lib/hue-plugins-0.9.jar`,
  67. relative to the Hue installation directory.
  68. Run these commands to create a symlink your Hadoop lib directory
  69. (`/usr/lib/hadoop-0.20/lib` if you installed CDH via a Debian or RPM package)
  70. to this jar:
  71. ----
  72. $ cd /usr/lib/hadoop/lib
  73. $ ln -s /usr/share/hue/desktop/libs/hadoop/java-lib/hue*jar .
  74. # Restart Hadoop
  75. ----
  76. NOTE: On a multi-node cluster, you must install the plug-in jar on every
  77. node. You do not need to install all of the Hue components on every node.
  78. ==== Restart Hadoop
  79. After making the changes in your Hadoop configuration, restart the Hadoop daemons:
  80. ----
  81. # /etc/init.d/hadoop-0.20-datanode restart
  82. # /etc/init.d/hadoop-0.20-namenode restart
  83. # /etc/init.d/hadoop-0.20-jobtracker restart
  84. # /etc/init.d/hadoop-0.20-secondarynamenode restart
  85. # /etc/init.d/hadoop-0.20-tasktracker restart
  86. ----
  87. ==== Starting Hue
  88. To start Hue, use `build/env/bin/supervisor`. This will start
  89. several subprocesses, corresponding to the different Hue components.
  90. ==== Troubleshooting the Hue Tarball Installation
  91. .Q: I moved my Hue installation from one directory to another and now Hue no longer functions correctly.
  92. A: Due to the use of absolute paths by some Python packages, you must run a series of commands if you move your Hue installation. In the new location, run:
  93. ----
  94. $ rm app.reg
  95. $ rm -r build
  96. $ make apps
  97. ----
  98. .Q: Why does "make install" compile other pieces of software?
  99. A: In order to ensure that Hue is stable on a variety of distributions and architectures, it installs a Python virtual environment which includes its dependencies. This ensures that the software can depend on specific versions of various Python libraries and you don't have to be concerned about missing software components.
  100. === Configuring Hadoop for Hue
  101. Hue requires that you install and configure some plugins in your
  102. Hadoop installation. In order to enable the plugins, you must make some
  103. small additions to your configuration files. Make these configuration changes
  104. on each node in your cluster by editing the following files
  105. in: `/etc/hadoop-0.20/conf/`
  106. ==== `hdfs-site.xml`
  107. Add the following configuration properties to `hdfs-site.xml`:
  108. ----
  109. <property>
  110. <name>dfs.namenode.plugins</name>
  111. <value>org.apache.hadoop.thriftfs.NamenodePlugin</value>
  112. <description>Comma-separated list of namenode plug-ins to be activated.
  113. </description>
  114. </property>
  115. <property>
  116. <name>dfs.datanode.plugins</name>
  117. <value>org.apache.hadoop.thriftfs.DatanodePlugin</value>
  118. <description>Comma-separated list of datanode plug-ins to be activated.
  119. </description>
  120. </property>
  121. <property>
  122. <name>dfs.thrift.address</name>
  123. <value>0.0.0.0:9090</value>
  124. </property>
  125. -----
  126. ==== `mapred-site.xml`
  127. Add the following configuration properties to mapred-site.xml:
  128. ----
  129. <property>
  130. <name>jobtracker.thrift.address</name>
  131. <value>0.0.0.0:9290</value>
  132. </property>
  133. <property>
  134. <name>mapred.jobtracker.plugins</name>
  135. <value>org.apache.hadoop.thriftfs.ThriftJobTrackerPlugin</value>
  136. <description>Comma-separated list of jobtracker plug-ins to be activated.
  137. </description>
  138. </property>
  139. ----
  140. ==== `hadoop-metrics.properties`
  141. To enable full monitoring in the Health application, the metrics
  142. contexts must not be NullContext. You can configure `hadoop-metrics.properties` as shown below:
  143. ----
  144. # Exposes /metrics URL endpoint for metrics information.
  145. dfs.class=org.apache.hadoop.metrics.spi.NoEmitMetricsContext
  146. mapred.class=org.apache.hadoop.metrics.spi.NoEmitMetricsContext
  147. jvm.class=org.apache.hadoop.metrics.spi.NoEmitMetricsContext
  148. rpc.class=org.apache.hadoop.metrics.spi.NoEmitMetricsContext
  149. ----
  150. === Further Hadoop Configuration and Caveats
  151. ==== `HADOOP_CLASSPATH` Caveat
  152. If you are setting `$HADOOP_CLASSPATH` in your `hadoop-env.sh`, be sure
  153. to set it in such a way that user-specified options are preserved. For example,
  154. Correct:
  155. ----
  156. # HADOOP_CLASSPATH=<your_additions>:$HADOOP_CLASSPATH
  157. ----
  158. Incorrect:
  159. ----
  160. # HADOOP_CLASSPATH=<your_additions>
  161. ----
  162. This enables certain components of Hue to add to
  163. Hadoop's classpath using the environment variable.
  164. ==== `hadoop.tmp.dir`
  165. If your users are likely to be submitting jobs both using Hue
  166. and from the same machine via the command line interface, they will be doing so as the `hue`
  167. user if they're using Hue and via their own user account
  168. on the command line. This leads to some contention
  169. on the directory specified by `hadoop.tmp.dir`, which defaults
  170. to `/tmp/hadoop-${user.name}`.
  171. Specifically, `hadoop.tmp.dir` is used to unpack jars in `bin/hadoop jar`.
  172. One work around to this is
  173. to set `hadoop.tmp.dir` to `/tmp/hadoop-${user.name}-${hue.suffix}` in the core-site.xml file:
  174. ----
  175. <property>
  176. <name>hadoop.tmp.dir</name>
  177. <value>/tmp/hadoop-${user.name}${hue.suffix}</value>
  178. </property>
  179. ----
  180. Unfortunately, when the variable is unset, you'll end up
  181. with directories named `/tmp/hadoop-user_name-${hue.suffix}` in
  182. `/tmp`. The job submission daemon, however, will still work.
  183. === Restart Your Hadoop Cluster
  184. Restart all of the daemons in your cluster so that the plugins can be loaded.
  185. You can confirm that the plugins are running correctly by tailing the daemon logs:
  186. ----
  187. $ tail --lines=500 /var/log/hadoop-0.20/hadoop*namenode*.log | grep ThriftPlugin
  188. 2009-09-28 16:30:44,337 INFO org.apache.hadoop.thriftfs.ThriftPluginServer: Starting Thrift server
  189. 2009-09-28 16:30:44,419 INFO org.apache.hadoop.thriftfs.ThriftPluginServer:
  190. Thrift server listening on 0.0.0.0:9090
  191. ----
  192. [TIP]
  193. .Configuring Your Firewall for Hue
  194. ============================================================
  195. 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 8088 on the Hue Server to interact with the system.
  196. ============================================================
  197. == Configuring Hue
  198. Hue ships with a default configuration that will work for
  199. pseudo-distributed clusters. If you are running on a real cluster, you must make a few changes to the `/etc/hue/hue.ini` configuration file. The
  200. following sections describe the key configuration options you must make to configure Hue.
  201. [TIP]
  202. .Listing all Configuration Options
  203. ============================================================
  204. To list all available configuration options, run:
  205. ----
  206. /usr/share/hue/build/env/bin/desktop config_help | less
  207. ----
  208. This commands outlines the various sections and options in the configuration,
  209. and provides help and information on the default values.
  210. ============================================================
  211. [TIP]
  212. .Viewing Current Configuration Options
  213. ============================================================
  214. To view the current configuration from within Hue, open:
  215. ----
  216. http://<hue>/dump_config
  217. ----
  218. ============================================================
  219. [TIP]
  220. .Using Multiple Files to Store Your Configuration
  221. ============================================================
  222. Hue loads and merges all of the files with extension `.ini`
  223. located in the `/etc/hue/conf/` directory. Files that are alphabetically later
  224. take precedence.
  225. ============================================================
  226. === Web Server Configuration
  227. Hue uses the CherryPy web server. You can use the following options to
  228. change the IP address and port that the web server listens on. The default
  229. setting is port 8088 on all configured IP addresses.
  230. ----
  231. # Webserver listens on this address and port
  232. http_host=0.0.0.0
  233. http_port=8088
  234. ----
  235. === Authentication
  236. By default, the first user who logs in to Hue can choose any
  237. username and password and becomes an administrator automatically. This
  238. user can create other user and administrator accounts. User information is
  239. stored in the Django database in the Django backend.
  240. The authentication system is pluggable. For more information, see the
  241. http://archive.cloudera.com/cdh3/hue/sdk/sdk.html[Hue SDK Documentation].
  242. === Configuring Hue for SSL
  243. You can configure Hue to serve over HTTPS. To do so, you must install
  244. "pyOpenSSL" within Hue's context and configure your keys.
  245. To install `pyOpenSSL`, from the root of your Hue installation path,
  246. do the following steps:
  247. 1. Run this command:
  248. ----
  249. $ ./build/env/bin/easy_install pyOpenSSL
  250. ----
  251. 2. Configure Hue to use your private key by adding the following
  252. options to the `/etc/hue/hue.ini` configuration file:
  253. ----
  254. ssl_certificate=/path/to/certificate
  255. ssl_private_key=/path/to/key
  256. ----
  257. 3. Ideally, you would have an appropriate key signed by a Certificate Authority.
  258. If you're just testing, you can create a self-signed key using the `openssl`
  259. command that may be installed on your system:
  260. ----
  261. # Create a key
  262. $ openssl genrsa 1024 > host.key
  263. # Create a self-signed certificate
  264. $ openssl req -new -x509 -nodes -sha1 -key host.key > host.cert
  265. ----
  266. [NOTE]
  267. .Self-signed Certificates and File Uploads
  268. ============================================================
  269. To upload files using the Hue File Browser over HTTPS requires
  270. using a proper SSL Certificate. Self-signed certificates don't
  271. work.
  272. ============================================================
  273. === Pointing Hue to Your Master Nodes
  274. If your Hadoop cluster contains multiple nodes, you should configure
  275. Hue to point to the external hostnames of your NameNode and
  276. JobTracker. To do so, change the `namenode_host` and `jobtracker_host`
  277. lines in the `/etc/hue/hue.ini` configuration file. Refer to the inline comments in the configuration file for more information.
  278. == Starting Hue from the Tarball
  279. After your cluster is running with the plugins enabled, you can start Hue on your Hue Server by running:
  280. ----
  281. # build/env/bin/supervisor
  282. ----
  283. Your Hue installation is now running.
  284. == Administering Hue
  285. Now that you've installed and started Hue, you can feel free to skip ahead
  286. to the <<usage,Using Hue>> section. Administrators may want to refer to this section
  287. for more details about managing and operating a Hue installation.
  288. === Hue Processes
  289. ==== Process Hierarchy
  290. A script called `supervisor` manages all Hue processes. The supervisor is a watchdog process -- its only purpose is to spawn and monitor other processes.
  291. A standard Hue installation starts and monitors the following processes:
  292. * `runcpserver` - a web server based on CherryPy that provides the core web functionality of Hue
  293. * `jobsubd` - a daemon which handles submission of jobs to Hadoop
  294. * `beeswax server` - a daemon that manages concurrent Hive queries
  295. If you have installed other applications into your Hue instance, you may see other daemons running under the supervisor as well.
  296. You can see the supervised processes running in the output of `ps`:
  297. ------------------
  298. [todd@monster01 ~]$ ps -f -u hue
  299. UID PID PPID C STIME TTY TIME CMD
  300. hue 7899 1 0 12:14 ? 00:00:00 /usr/share/hue/build/build/env/bin/python2.4 \
  301. /usr/share/hue/desktop/build/env/bin/supervisor -p /var/run/hue/desktop/s
  302. hue 7903 7899 1 12:14 ? 00:02:59 /usr/share/hue/desktop/build/env/bin/python2.4 \
  303. /usr/share/hue/desktop/build/env/bin/desktop runcpserver
  304. hue 7906 7899 0 12:14 ? 00:00:00 /usr/share/hue/desktop/build/env/bin/python2.4 \
  305. /usr/share/hue/desktop/build/env/bin/desktop jobsubd
  306. hue 7907 7899 0 12:14 ? 00:00:12 /usr/share/hue/desktop/build/env/bin/python2.4 \
  307. /usr/share/hue/desktop/build/env/bin/desktop run_healthd
  308. ------------------
  309. 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.
  310. === Hue Logging
  311. The Hue logs are found in `<installation_directory>/logs`. Inside the log directory you can find:
  312. * An `access.log`, which contains a log for all requests against the Hue web server.
  313. * A `.log` file, which contains the logs for each of the processes described above.
  314. * A `.out` file, which contains the stdout and stderr for each of the processes described above.
  315. 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
  316. `supervisor.log` log file can often contain clues.
  317. ==== Viewing Recent Log Messages through your Web Browser
  318. In addition to logging `INFO` level messages to the `logs` directory, the Hue web server keeps a small buffer
  319. of log messages at all levels in memory. You can view these logs by visiting `http://myserver:8088/logs`.
  320. The `DEBUG` level messages shown can sometimes be helpful in troubleshooting issues.
  321. === The Hue Database
  322. Hue requires a SQL database to store small amounts of data, including user account information
  323. as well as history of job submissions and Hive queries. By default, Hue is configured to use the
  324. embedded database SQLite for this purpose, and should require no configuration or management by the
  325. administrator. However, MySQL is the recommended database to use; this section
  326. contains instructions for configuring Hue to access MySQL and other databases.
  327. ==== Inspecting the Hue Database
  328. The default SQLite database used by Hue is located in `/usr/share/hue/desktop/desktop.db`.
  329. You can inspect this database from the command line using the `sqlite3` program. For example:
  330. ---------
  331. # sqlite3 /usr/share/hue/desktop/desktop.db
  332. SQLite version 3.3.6
  333. Enter ".help" for instructions
  334. sqlite> select username from auth_user;
  335. admin
  336. test
  337. sample
  338. sqlite>
  339. ----------
  340. It is strongly recommended that you avoid making any modifications to the database directly using SQLite, though this trick
  341. can be useful for management or troubleshooting.
  342. ==== Backing up the Hue Database
  343. If you use the default SQLite database, then copy the `desktop.db` file to another node
  344. for backup. It is recommended that you back it up on a regular schedule,
  345. and also that you back it up before any upgrade to a new version of Hue.
  346. ==== Configuring Hue to Access Another Database
  347. Although SQLite is the default database type, some advanced users may prefer to have Hue access an
  348. alternate database type. Note that if you elect to configure Hue to use an external database,
  349. upgrades may require more manual steps in the future.
  350. The following instructions are for MySQL, though you can also configure Hue may to work with other common databases such as PostgreSQL and Oracle.
  351. But note that Hue has only been tested with SQLite and MySQL database backends.
  352. ===== Configuring Hue to Store Data in MySQL
  353. To configure Hue to store data in MySQL:
  354. 1. Create a new database in MySQL and grant privileges to a Hue user to manage this database.
  355. ----
  356. mysql> create database hue;
  357. Query OK, 1 row affected (0.01 sec)
  358. mysql> grant all on hue.* to 'hue'@'localhost' identified by 'secretpassword';
  359. Query OK, 0 rows affected (0.00 sec)
  360. ----
  361. 2. Shut down Hue if it is running.
  362. 3. To migrate your existing data to MySQL, use the following command to dump the
  363. existing database to a text file.
  364. ----
  365. $ /usr/share/hue/build/env/bin/desktop dumpdata
  366. ----
  367. 4. Open the `/etc/hue/hue.ini` file in a text editor. Directly below the `[desktop]` line, add the following options (and modify accordingly for your MySQL setup):
  368. ----
  369. [[database]]
  370. host=localhost
  371. port=3306
  372. engine=mysql
  373. user=hue
  374. password=secretpassword
  375. name=hue
  376. ----
  377. 5. Install the Python drivers for MySQL into Hue's environment:
  378. ----
  379. # su - hue -s /bin/bash
  380. $ /usr/share/hue/build/env/bin/easy_install MySQL-python
  381. ----
  382. `easy_install` will access the Internet to find MySQL-python.
  383. If you don't have network access, you may specify a path
  384. to a tarball (such as `/tmp/MySQL-python-1.2.2.tar.gz`) instead.
  385. 6. As the Hue user, configure Hue to load the existing data and create the
  386. necessary database tables:
  387. ----
  388. $ /usr/share/hue/build/env/bin/desktop loaddata
  389. $ /usr/share/hue/build/env/bin/desktop syncdb --noinput
  390. $ /usr/share/hue/build/env/bin/desktop migrate
  391. ----
  392. Your system is now configured and you can start the Hue server as normal.
  393. == Hue Applications
  394. This section includes documentation specific to built-in Hue applications.
  395. === Beeswax, the Hive UI
  396. ==== Introduction
  397. Beeswax is an application that is a component within Hue and helps you use Hive to query your data.
  398. ==== Installation
  399. Beeswax is installed as part of Hue.
  400. ==== Hive Configuration
  401. Beeswax, the Hive interface in Hue, includes Hive 0.5. You do
  402. not need an existing Hive installation.
  403. Your Hive data is stored in HDFS, normally under `/user/hive/warehouse`
  404. (or any path you specify as `hive.metastore.warehouse.dir` in your
  405. `hive-site.xml`). Make sure this location exists and is writable by
  406. the users whom you expect to be creating tables. `/tmp` (on the local file
  407. system) must be world-writable, as Hive makes extensive use of it.
  408. ==== Configuration
  409. ===== No Existing Hive Installation
  410. Familiarize yourself with the configuration options in
  411. `hive-site.xml` (see
  412. http://wiki.apache.org/hadoop/Hive/AdminManual/Configuration).
  413. Having a `hive-site.xml` is optional but often useful, particularly on setting
  414. up a http://wiki.apache.org/hadoop/Hive/AdminManual/MetastoreAdmin[metastore].
  415. You may store the `hive-site.xml` in `/etc/hue/conf`, or instruct
  416. Beeswax to locate it using the `hive_conf_dir` configuration variable. See
  417. `/etc/hue/conf/hue-beeswax.ini`.
  418. ===== Existing Hive Installation
  419. In `/etc/hue/conf/hue-beeswax.ini`, modify `hive_conf_dir` to point to the directory containing `hive-site.xml`.
  420. [[usage]]
  421. == Using Hue
  422. After installation, you can use Hue by navigating to `http://myserver:8088/`.
  423. The following login screen appears:
  424. image:images/login.png[]
  425. Launch applications on the bottom-right.
  426. image:images/open-apps.png[,width=50%]
  427. The Help application guides users through the various installed applications.
  428. === Supported Browsers
  429. Hue is primarily tested on Firefox 3.5 and Firefox 3.6, on Windows, Mac, and Linux.
  430. Google Chrome and Safari work as well.
  431. === Feedback
  432. Hue is currently at version 0.9. Your feedback is welcome.
  433. The best way to send feedback is to join the
  434. https://groups.google.com/a/cloudera.org/group/hue-user[mailing list], and send e-mail,
  435. to mailto:hue-user@cloudera.org[hue-user@cloudera.org].
  436. === Reporting Bugs
  437. If you find that something doesn't work, it'll often be helpful to include logs
  438. from your server. These are available at the +/logs+ URL on Hue's web server
  439. (not part of the graphical Hue UI). Please download the logs as a zip (or cut
  440. and paste the ones that look relevant) and send those with your bug reports.
  441. image:images/logs.png[]