manual.txt 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  1. <link rel="stylesheet" href="docbook.css" type="text/css" media="screen" title="no title" charset="utf-8"></link>
  2. <link rel="stylesheet" href="bootplus.css" type="text/css" media="screen" title="no title" charset="utf-8"></link>
  3. <h1><a href=index.html>Doc</a> > Hue Installation Guide</h1>
  4. <div class="row-fluid">
  5. <div class="span3">
  6. [TOC]
  7. </div>
  8. <div class="span9">
  9. Introduction
  10. ------------
  11. Hue is a graphical user interface to operate and develop applications for
  12. performing self-service data analytics. Hue applications are delivered as a Web application,
  13. requiring no additional installation for individual users.
  14. This guide describes how to install and configure a Hue tarball or packages.
  15. There is also a companion SDK guide that describes how to develop
  16. new Hue applications:
  17. link:sdk/sdk.html[Hue SDK Documentation]
  18. Hue Installation Instructions
  19. -----------------------------
  20. The following instructions describe how to install the Hue tarball on a
  21. multi-node cluster. You need to also install Hadoop and its satellite components
  22. (Oozie, Hive...) and update some Hadoop configuration files before running Hue.
  23. Install Hue
  24. ~~~~~~~~~~~
  25. Hue consists of a web service that runs on a special node in your cluster.
  26. Choose one node where you want to run Hue. This guide refers to that node as
  27. the _Hue Server_. For optimal performance, this should be one of the nodes
  28. within your cluster, though it can be a remote node as long as there are no
  29. overly restrictive firewalls. For small clusters of less than 10 nodes,
  30. you can use your existing master node as the Hue Server.
  31. You can download the Hue tarball here:
  32. https://github.com/cloudera/hue/releases
  33. Hue Dependencies
  34. ^^^^^^^^^^^^^^^^
  35. Hue employs some Python modules which use native code and requires
  36. certain development libraries be installed on your system. To install from the
  37. tarball, you must have the following installed:
  38. .Required Dependencies
  39. The full list is here: https://github.com/cloudera/hue#development-prerequisites
  40. Build
  41. ^^^^^
  42. Configure `$PREFIX` with the path where you want to install Hue by running:
  43. PREFIX=/usr/share make install
  44. cd /usr/share/hue
  45. You can install Hue anywhere on your system, and run Hue as a non-root user.
  46. It is a good practice to create a new user for Hue and either install Hue in
  47. that user's home directory, or in a directory within `/usr/share`.
  48. Troubleshooting the Hue Tarball Installation
  49. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  50. .Q: I moved my Hue installation from one directory to another and now Hue no
  51. longer functions correctly.
  52. A: Due to the use of absolute paths by some Python packages, you must run a
  53. series of commands if you move your Hue installation. In the new location, run:
  54. ----
  55. rm app.reg
  56. rm -r build
  57. make apps
  58. ----
  59. .Q: Why does "make install" compile other pieces of software?
  60. A: In order to ensure that Hue is stable on a variety of distributions and
  61. architectures, it installs a Python virtual environment which includes its
  62. dependencies. This ensures that the software can depend on specific versions
  63. of various Python libraries and you don't have to be concerned about missing
  64. software components.
  65. Install Hadoop
  66. -~~~~~~~~~~~~~
  67. Depending on which apps you need, you need to make sure that some Hadoop services
  68. are already setup (that way Hue can talk to them).
  69. .Dependency
  70. [grid="rows"]
  71. `-----------------------------------------------------------------------
  72. Component Applications
  73. ------------------------------------------------------------------------
  74. Editor SQL (Hive, Impala, any database...), Pig, Spark...
  75. Browsers YARN, Oozie, Impala, HBase, Livy
  76. Scheduler Oozie
  77. Dashboard Solr, SQL (Impala, Hive...)
  78. ------------------------------------------------------------------------
  79. Hadoop Configuration
  80. ~~~~~~~~~~~~~~~~~~~~
  81. Configure WebHdfs
  82. ^^^^^^^^^^^^^^^^^
  83. You need to enable WebHdfs or run an HttpFS server. To turn on WebHDFS,
  84. add this to your `hdfs-site.xml` and *restart* your HDFS cluster.
  85. Depending on your setup, your `hdfs-site.xml` might be in `/etc/hadoop/conf`.
  86. <property>
  87. <name>dfs.webhdfs.enabled</name>
  88. <value>true</value>
  89. </property>
  90. You also need to add this to `core-site.xml`.
  91. <property>
  92. <name>hadoop.proxyuser.hue.hosts</name>
  93. <value>*</value>
  94. </property>
  95. <property>
  96. <name>hadoop.proxyuser.hue.groups</name>
  97. <value>*</value>
  98. </property>
  99. If you place your Hue Server outside the Hadoop cluster, you can run
  100. an HttpFS server to provide Hue access to HDFS. The HttpFS service requires
  101. only one port to be opened to the cluster.
  102. Also add this in `httpfs-site.xml` which might be in `/etc/hadoop-httpfs/conf`.
  103. <property>
  104. <name>httpfs.proxyuser.hue.hosts</name>
  105. <value>*</value>
  106. </property>
  107. <property>
  108. <name>httpfs.proxyuser.hue.groups</name>
  109. <value>*</value>
  110. </property>
  111. Configure Oozie
  112. ^^^^^^^^^^^^^^^
  113. Hue submits MapReduce jobs to Oozie as the logged in user. You need to
  114. configure Oozie to accept the `hue` user to be a proxyuser. Specify this in
  115. your `oozie-site.xml` (even in a non-secure cluster), and restart Oozie:
  116. <property>
  117. <name>oozie.service.ProxyUserService.proxyuser.hue.hosts</name>
  118. <value>*</value>
  119. </property>
  120. <property>
  121. <name>oozie.service.ProxyUserService.proxyuser.hue.groups</name>
  122. <value>*</value>
  123. </property>
  124. Configuring Your Firewall for Hue
  125. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  126. Hue currently requires that the machines within your cluster can connect to
  127. each other freely over TCP. The machines outside your cluster must be able to
  128. open TCP port 8888 on the Hue Server (or the configured Hue web HTTP port)
  129. to interact with the system.
  130. Hive Configuration
  131. ~~~~~~~~~~~~~~~~~~
  132. Hue's Hive SQL Editor application helps you use Hive to query your data.
  133. It depends on a Hive Server 2 running in the cluster. Please read
  134. this section to ensure a proper integration.
  135. Your Hive data is stored in HDFS, normally under `/user/hive/warehouse`
  136. (or any path you specify as `hive.metastore.warehouse.dir` in your
  137. `hive-site.xml`). Make sure this location exists and is writable by
  138. the users whom you expect to be creating tables. `/tmp` (on the local file
  139. system) must be world-writable (1777), as Hive makes extensive use of it.
  140. [NOTE]
  141. In `hue.ini`, modify `hive_conf_dir` to point to the
  142. directory containing `hive-site.xml`.
  143. Configuring Hue
  144. ---------------
  145. Hue ships with a default configuration that will work for
  146. pseudo-distributed clusters. If you are running on a real cluster, you must
  147. make a few changes to the `hue.ini` configuration file (`/etc/hue/hue.ini` when installed from the
  148. package version) or `pseudo-distributed.ini` in `desktop/conf` when in development mode).
  149. The following sections describe the key configuration options you must make to configure Hue.
  150. [TIP]
  151. .Listing all Configuration Options
  152. ============================================================
  153. To list all available configuration options, run:
  154. $ /usr/share/hue/build/env/bin/hue config_help | less
  155. This commands outlines the various sections and options in the configuration,
  156. and provides help and information on the default values.
  157. ============================================================
  158. [TIP]
  159. .Viewing Current Configuration Options
  160. ============================================================
  161. To view the current configuration from within Hue, open:
  162. http://<hue>/hue/dump_config
  163. ============================================================
  164. [TIP]
  165. .Using Multiple Files to Store Your Configuration
  166. ============================================================
  167. Hue loads and merges all of the files with extension `.ini`
  168. located in the `/etc/hue` directory. Files that are alphabetically later
  169. take precedence.
  170. ============================================================
  171. Web Server Configuration
  172. ~~~~~~~~~~~~~~~~~~~~~~~~
  173. These configuration variables are under the `[desktop]` section in
  174. the `hue.ini` configuration file.
  175. Specifying the Hue HTTP Address
  176. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  177. Hue uses CherryPy web server. You can use the following options to
  178. change the IP address and port that the web server listens on.
  179. The default setting is port 8888 on all configured IP addresses.
  180. # Webserver listens on this address and port
  181. http_host=0.0.0.0
  182. http_port=8888
  183. Specifying the Secret Key
  184. ^^^^^^^^^^^^^^^^^^^^^^^^^
  185. For security, you should also specify the secret key that is used for secure
  186. hashing in the session store. Enter a long series of random characters
  187. (30 to 60 characters is recommended).
  188. secret_key=jFE93j;2[290-eiw.KEiwN2s3['d;/.q[eIW^y#e=+Iei*@Mn<qW5o
  189. NOTE: If you don't specify a secret key, your session cookies will not be
  190. secure. Hue will run but it will also display error messages telling you to
  191. set the secret key.
  192. Authentication
  193. ^^^^^^^^^^^^^^
  194. By default, the first user who logs in to Hue can choose any
  195. username and password and becomes an administrator automatically. This
  196. user can create other user and administrator accounts. User information is
  197. stored in the Django database in the Django backend.
  198. The authentication system is pluggable. For more information, see the
  199. link:sdk/sdk.html[Hue SDK Documentation].
  200. Configuring Hue for SSL
  201. ^^^^^^^^^^^^^^^^^^^^^^^
  202. You can configure Hue to serve over HTTPS.
  203. 1. Configure Hue to use your private key by adding the following
  204. options to the `hue.ini` configuration file:
  205. ssl_certificate=/path/to/certificate
  206. ssl_private_key=/path/to/key
  207. 2. Ideally, you would have an appropriate key signed by a Certificate Authority.
  208. If you're just testing, you can create a self-signed key using the `openssl`
  209. command that may be installed on your system:
  210. ### Create a key
  211. $ openssl genrsa 1024 > host.key
  212. ### Create a self-signed certificate
  213. $ openssl req -new -x509 -nodes -sha1 -key host.key > host.cert
  214. [NOTE]
  215. .Self-signed Certificates and File Uploads
  216. ============================================================
  217. To upload files using the Hue File Browser over HTTPS requires
  218. using a proper SSL Certificate. Self-signed certificates don't
  219. work.
  220. ============================================================
  221. Hue Configuration for Hadoop
  222. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  223. These configuration variables are under the `[hadoop]` section in
  224. the `hue.ini` configuration file.
  225. HDFS Cluster
  226. ^^^^^^^^^^^^
  227. Hue supports one HDFS cluster. That cluster should be defined
  228. under the `[[[default]]]` sub-section.
  229. fs_defaultfs::
  230. This is the equivalence of `fs.defaultFS` (aka `fs.default.name`) in
  231. Hadoop configuration.
  232. webhdfs_url::
  233. You can also set this to be the HttpFS url. The default value is the HTTP
  234. port on the NameNode.
  235. hadoop_conf_dir::
  236. This is the configuration directory of the HDFS, typically
  237. `/etc/hadoop/conf`.
  238. Yarn (MR2) Cluster
  239. ^^^^^^^^^^^^^^^^^^
  240. Hue supports one or two Yarn clusters (two for HA). These clusters should be defined
  241. under the `[[[default]]]` and `[[[ha]]]` sub-sections.
  242. resourcemanager_host::
  243. The host running the ResourceManager.
  244. resourcemanager_port::
  245. The port for the ResourceManager REST service.
  246. logical_name::
  247. NameNode logical name.
  248. submit_to::
  249. To enable the section, set to True.
  250. Impala Configuration
  251. ~~~~~~~~~~~~~~~~~~~~
  252. In the `[impala]` section of the configuration file, you can
  253. _optionally_ specify the following:
  254. server_host::
  255. The hostname or IP that the Impala Server should bind to. By
  256. default it binds to `localhost`, and therefore only serves local
  257. IPC clients.
  258. Hive Configuration
  259. ~~~~~~~~~~~~~~~~~~
  260. In the `[beeswax]` section of the configuration file, you can
  261. _optionally_ specify the following:
  262. beeswax_server_host::
  263. The hostname or IP that the Hive Server should bind to. By
  264. default it binds to `localhost`, and therefore only serves local
  265. IPC clients.
  266. hive_conf_dir::
  267. The directory containing your `hive-site.xml` Hive
  268. configuration file.
  269. Oozie Configuration
  270. ~~~~~~~~~~~~~~~~~~~
  271. In the `[liboozie]` section of the configuration file, you should
  272. specify:
  273. oozie_url::
  274. The URL of the Oozie service. It is the same as the `OOZIE_URL`
  275. environment variable for Oozie.
  276. Solr Configuration
  277. ~~~~~~~~~~~~~~~~~~
  278. In the `[search]` section of the configuration file, you should
  279. specify:
  280. solr_url::
  281. The URL of the Solr service.
  282. HBase Configuration
  283. ~~~~~~~~~~~~~~~~~~~
  284. In the `[hbase]` section of the configuration file, you should
  285. specify:
  286. hbase_clusters::
  287. Comma-separated list of HBase Thrift servers for clusters in the format of "(name|host:port)".
  288. UserAdmin Configuration
  289. ~~~~~~~~~~~~~~~~~~~~~~~
  290. In the `[useradmin]` section of the configuration file, you can
  291. _optionally_ specify the following:
  292. default_user_group::
  293. The name of a default group that is suggested when creating a
  294. user manually. If the LdapBackend or PamBackend are configured
  295. for doing user authentication, new users will automatically be
  296. members of the default group.
  297. Configuration Validation
  298. ~~~~~~~~~~~~~~~~~~~~~~~~
  299. Hue can detect certain invalid configuration.
  300. To view the configuration of a running Hue instance, navigate to
  301. `http://myserver:8888/hue/dump_config`, also accessible through the About
  302. application.
  303. Starting Hue from the Tarball
  304. -----------------------------
  305. After your cluster is running with the plugins enabled, you can start Hue on
  306. your Hue Server by running:
  307. build/env/bin/supervisor
  308. This will start several subprocesses, corresponding to the different Hue
  309. components. Your Hue installation is now running.
  310. Administering Hue
  311. -----------------
  312. Now that you've installed and started Hue, you can feel free to skip ahead
  313. to the <<usage,Using Hue>> section. Administrators may want to refer to this
  314. section for more details about managing and operating a Hue installation.
  315. Hue Processes
  316. ~~~~~~~~~~~~~
  317. Process Hierarchy
  318. ^^^^^^^^^^^^^^^^^
  319. A script called `supervisor` manages all Hue processes. The supervisor is a
  320. watchdog process -- its only purpose is to spawn and monitor other processes.
  321. A standard Hue installation starts and monitors the following processes:
  322. * `runcpserver` - a web server based on CherryPy that provides the core web
  323. functionality of Hue
  324. If you have installed other applications into your Hue instance, you may see
  325. other daemons running under the supervisor as well.
  326. You can see the supervised processes running in the output of `ps -f -u hue`:
  327. UID PID PPID C STIME TTY TIME CMD
  328. hue 8685 8679 0 Aug05 ? 00:01:39 /usr/share/hue/build/env/bin/python /usr/share/hue/build/env/bin/desktop runcpserver
  329. Note that the supervisor automatically restarts these processes if they fail for
  330. any reason. If the processes fail repeatedly within a short time, the supervisor
  331. itself shuts down.
  332. [[logging]]
  333. Hue Logging
  334. ~~~~~~~~~~~
  335. The Hue logs are found in `/var/log/hue`, or in a `logs` directory under your
  336. Hue installation root. Inside the log directory you can find:
  337. * An `access.log` file, which contains a log for all requests against the Hue
  338. web server.
  339. * A `supervisor.log` file, which contains log information for the supervisor
  340. process.
  341. * A `supervisor.out` file, which contains the stdout and stderr for the
  342. supervisor process.
  343. * A `.log` file for each supervised process described above, which contains
  344. the logs for that process.
  345. * A `.out` file for each supervised process described above, which contains
  346. the stdout and stderr for that process.
  347. If users on your cluster have problems running Hue, you can often find error
  348. messages in these log files. If you are unable to start Hue from the init
  349. script, the `supervisor.log` log file can often contain clues.
  350. Viewing Recent Log Messages Online
  351. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  352. In addition to logging `INFO` level messages to the `logs` directory, the Hue
  353. web server keeps a small buffer of log messages at all levels in memory. You can
  354. view these logs by visiting `http://myserver:8888/hue/logs`. The `DEBUG` level
  355. messages shown can sometimes be helpful in troubleshooting issues.
  356. The Hue Database
  357. ~~~~~~~~~~~~~~~~
  358. Hue requires a SQL database to store small amounts of data, including user
  359. account information as well as history of job submissions and Hive queries.
  360. By default, Hue is configured to use the embedded database SQLite for this
  361. purpose, and should require no configuration or management by the administrator.
  362. However, MySQL is the recommended database to use. This section contains
  363. instructions for configuring Hue to access MySQL and other databases.
  364. Inspecting the Hue Database
  365. ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  366. The default SQLite database used by Hue is located in: `/usr/share/hue/desktop/desktop.db`.
  367. You can inspect this database from the command line using the `sqlite3`
  368. program or typing `/usr/share/hue/build/env/bin/hue dbshell'. For example:
  369. sqlite3 /usr/share/hue/desktop/desktop.db
  370. SQLite version 3.6.22
  371. Enter ".help" for instructions
  372. Enter SQL statements terminated with a ";"
  373. sqlite> select username from auth_user;
  374. admin
  375. test
  376. sample
  377. sqlite>
  378. It is strongly recommended that you avoid making any modifications to the
  379. database directly using SQLite, though this trick can be useful for management
  380. or troubleshooting.
  381. Backing up the Hue Database
  382. ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  383. If you use the default SQLite database, then copy the `desktop.db` file to
  384. another node for backup. It is recommended that you back it up on a regular
  385. schedule, and also that you back it up before any upgrade to a new version of
  386. Hue.
  387. Configuring Hue to Access Another Database
  388. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  389. Although SQLite is the default database type, some advanced users may prefer
  390. to have Hue access an alternate database type. Note that if you elect to
  391. configure Hue to use an external database, upgrades may require more manual
  392. steps in the future.
  393. The following instructions are for MySQL, though you can also configure Hue to
  394. work with other common databases such as PostgreSQL and Oracle.
  395. [NOTE]
  396. .Tested Database Backends
  397. ============================================================
  398. Note that Hue has only been tested with SQLite and MySQL database backends.
  399. ============================================================
  400. Configuring Hue to Store Data in MySQL
  401. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  402. To configure Hue to store data in MySQL:
  403. 1. Create a new database in MySQL and grant privileges to a Hue user to manage
  404. this database.
  405. mysql> create database hue;
  406. Query OK, 1 row affected (0.01 sec)
  407. mysql> grant all on hue.* to 'hue'@'localhost' identified by 'secretpassword';
  408. Query OK, 0 rows affected (0.00 sec)
  409. 2. Shut down Hue if it is running.
  410. 3. To migrate your existing data to MySQL, use the following command to dump the
  411. existing database data to a text file. Note that using the ".json" extension
  412. is required.
  413. /usr/share/hue/build/env/bin/hue dumpdata > <some-temporary-file>.json
  414. 4. Open the `hue.ini` file in a text editor. Directly below the
  415. `[[database]]` line, add the following options (and modify accordingly for
  416. your MySQL setup):
  417. host=localhost
  418. port=3306
  419. engine=mysql
  420. user=hue
  421. password=secretpassword
  422. name=hue
  423. 5. As the Hue user, configure Hue to load the existing data and create the
  424. necessary database tables:
  425. /usr/share/hue/build/env/bin/hue syncdb --noinput
  426. mysql -uhue -psecretpassword -e "DELETE FROM hue.django_content_type;"
  427. /usr/share/hue/build/env/bin/hue loaddata <temporary-file-containing-dumped-data>.json
  428. Your system is now configured and you can start the Hue server as normal.
  429. [[usage]]
  430. Using Hue
  431. ---------
  432. After installation, you can use Hue by navigating to `http://myserver:8888/`.
  433. The link:user-guide/index.html[user guide] will help users go through the various installed applications.
  434. Supported Browsers
  435. ~~~~~~~~~~~~~~~~~~
  436. The two latest LTS versions of each browsers.
  437. * IE/Edge
  438. * Safari
  439. * Chrome
  440. * Firefox
  441. Feedback
  442. ~~~~~~~~
  443. Your feedback is welcome. The best way to send feedback is to join the
  444. https://groups.google.com/a/cloudera.org/group/hue-user[mailing list], and
  445. send e-mail, to mailto:hue-user@cloudera.org[hue-user@cloudera.org].
  446. Reporting Bugs
  447. ~~~~~~~~~~~~~~
  448. If you find that something doesn't work, it'll often be helpful to include logs
  449. from your server. (See the <<logging,Hue Logging>> section. Please include the
  450. logs as a zip (or cut and paste the ones that look relevant) and send those with
  451. your bug reports.
  452. image:images/logs.png[]
  453. </div>
  454. </div>