manual.txt 20 KB

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