manual.txt 21 KB

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