|
|
@@ -5,363 +5,217 @@ draft: false
|
|
|
weight: 1
|
|
|
---
|
|
|
|
|
|
-The goal of the Editor is to open-up data to more users by making self service querying easy and productive.
|
|
|
|
|
|
-It is available in Editor or Notebook mode and focuses on SQL. Dialects can be added to the main `[notebook]` section like this:
|
|
|
+These configuration variables are under the `[desktop]` section in
|
|
|
+the `hue.ini` configuration file.
|
|
|
|
|
|
- [notebook]
|
|
|
+## Specifying the HTTP port
|
|
|
|
|
|
- [[interpreters]]
|
|
|
+Hue uses CherryPy web server. You can use the following options to
|
|
|
+change the IP address and port that the web server listens on.
|
|
|
+The default setting is port 8888 on all configured IP addresses.
|
|
|
|
|
|
- [[[hive]]]
|
|
|
- # The name of the snippet.
|
|
|
- name=Hive
|
|
|
- # The backend connection to use to communicate with the server.
|
|
|
- interface=hiveserver2
|
|
|
+ # Webserver listens on this address and port
|
|
|
+ http_host=0.0.0.0
|
|
|
+ http_port=8888
|
|
|
|
|
|
- [[[mysqlalche]]]
|
|
|
- name = MySQL alchemy
|
|
|
- interface=sqlalchemy
|
|
|
- options='{"url": "mysql://root:root@localhost:3306/hue"}'
|
|
|
+[Gunicorn](https://gunicorn.org/) support is planned to come in via [HUE-8739](https://issues.cloudera.org/browse/HUE-8739).
|
|
|
|
|
|
+## Specifying the Secret Key
|
|
|
|
|
|
-Download and export options with limited scalability can be limited in the number of rows or bytes transferred using the following options respectively in your hue.ini:
|
|
|
+For security, you should also specify the secret key that is used for secure
|
|
|
+hashing in the session store. Enter a long series of random characters
|
|
|
+(30 to 60 characters is recommended).
|
|
|
|
|
|
- [beeswax]
|
|
|
- # A limit to the number of rows that can be downloaded from a query before it is truncated.
|
|
|
- # A value of -1 means there will be no limit.
|
|
|
- download_row_limit=-1
|
|
|
+ secret_key=jFE93j;2[290-eiw.KEiwN2s3['d;/.q[eIW^y#e=+Iei*@Mn<qW5o
|
|
|
|
|
|
- # A limit to the number of bytes that can be downloaded from a query before it is truncated.
|
|
|
- # A value of -1 means there will be no limit.
|
|
|
- download_bytes_limit=-1
|
|
|
+NOTE: If you don't specify a secret key, your session cookies will not be
|
|
|
+secure. Hue will run but it will also display error messages telling you to
|
|
|
+set the secret key.
|
|
|
|
|
|
-In addition, it is possible to disable the download and export feature in the editor, dashboard, as well as in the file browser with the following option in your hue.ini:
|
|
|
+## Disabling some apps
|
|
|
|
|
|
- [desktop]
|
|
|
- # Global setting to allow or disable end user downloads in all Hue.
|
|
|
- # e.g. Query result in Editors and Dashboards, file in File Browser...
|
|
|
- enable_download=false
|
|
|
+In the Hue ini configuration file, in the [desktop] section, you can enter the names of the app to hide:
|
|
|
|
|
|
-The download feature in the file browser can be disabled separately with the following options in your hue.ini:
|
|
|
+<pre>
|
|
|
+[desktop]
|
|
|
+# Comma separated list of apps to not load at server startup.
|
|
|
+app_blacklist=beeswax,impala,security,filebrowser,jobbrowser,rdbms,jobsub,pig,hbase,sqoop,zookeeper,metastore,spark,oozie,indexer
|
|
|
+</pre>
|
|
|
|
|
|
- [filebrowser]
|
|
|
- show_download_button=false
|
|
|
+[Read more about it here](http://gethue.com/mini-how-to-disabling-some-apps-from-showing-up/).
|
|
|
|
|
|
+## Authentication
|
|
|
|
|
|
-### Impala
|
|
|
+By default, the first user who logs in to Hue can choose any
|
|
|
+username and password and becomes an administrator automatically. This
|
|
|
+user can create other user and administrator accounts. User information is
|
|
|
+stored in the Django database in the Django backend.
|
|
|
|
|
|
- [impala]
|
|
|
- # Host of the Impala Server (one of the Impalad)
|
|
|
- ## server_host=localhost
|
|
|
+The authentication system is pluggable. For more information, see the [SDK Documentation](../sdk/sdk.html).
|
|
|
|
|
|
- # Port of the Impala Server
|
|
|
- ## server_port=21050
|
|
|
+List of some of the possible authentications:
|
|
|
+### Username / Password
|
|
|
+### LDAP
|
|
|
+### SAML
|
|
|
|
|
|
-[LDAP or PAM pass-through authentication with Hive or Impala and Impersonation
|
|
|
-](http://gethue.com/ldap-or-pam-pass-through-authentication-with-hive-or-impala/).
|
|
|
+[Read more about it](http://gethue.com/updated-saml-2-0-support/).
|
|
|
|
|
|
-### Hive
|
|
|
+### OpenId Connect
|
|
|
+### Multiple Authentication Backends
|
|
|
|
|
|
- [beeswax]
|
|
|
+For example, to enable Hue to first attempt LDAP directory lookup before falling back to the database-backed user model, we can update the hue.ini configuration file or Hue safety valve in Cloudera Manager with a list containing first the LdapBackend followed by either the ModelBackend or custom AllowFirstUserDjangoBackend (permits first login and relies on user model for all subsequent authentication):
|
|
|
|
|
|
- # Host where HiveServer2 is running.
|
|
|
- # If Kerberos security is enabled, use fully-qualified domain name (FQDN).
|
|
|
- ## hive_server_host=localhost
|
|
|
+<pre>
|
|
|
+[desktop]
|
|
|
+ [[auth]]
|
|
|
+ backend=desktop.auth.backend.LdapBackend,desktop.auth.backend.AllowFirstUserDjangoBackend
|
|
|
+</pre>
|
|
|
|
|
|
- # Port where HiveServer2 Thrift server runs on.
|
|
|
- ## hive_server_port=10000
|
|
|
+This tells Hue to first check against the configured LDAP directory service, and if the username is not found in the directory, then attempt to authenticate the user with the Django user manager.
|
|
|
|
|
|
-**Tez**
|
|
|
+[Read more about it here](http://gethue.com/configuring-hue-multiple-authentication-backends-and-ldap/).
|
|
|
|
|
|
-Requires support for sending multiple queries when using Tez (instead of a maximum of just one at the time). You can turn it on with this setting:
|
|
|
|
|
|
- [beeswax]
|
|
|
- max_number_of_sessions=10
|
|
|
+## Change your maps look and feel
|
|
|
|
|
|
+The properties we need to tweak are leaflet_tile_layer and leaflet_tile_layer_attribution, that can be configured in the hue.ini file:
|
|
|
|
|
|
-### MySQL
|
|
|
+<pre>
|
|
|
+[desktop]
|
|
|
+leaflet_tile_layer=https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}
|
|
|
+leaflet_tile_layer_attribution='Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
|
|
|
+</pre>
|
|
|
|
|
|
-Recommended way:
|
|
|
+[Read more about it here](http://gethue.com/change-your-maps-look-and-feel/).
|
|
|
|
|
|
- [[[mysql]]]
|
|
|
- name = MySQL Alchemy
|
|
|
- interface=sqlalchemy
|
|
|
- ## https://docs.sqlalchemy.org/en/latest/core/engines.html#sqlalchemy.create_engine
|
|
|
- ## https://docs.sqlalchemy.org/en/latest/dialects/mysql.html
|
|
|
- options='{"url": "mysql://root:root@localhost:3306/hue"}'
|
|
|
+## Configure a Proxy
|
|
|
|
|
|
-Alternative:
|
|
|
+We explained how to run Hue with NGINX serving the static files or under Apache. If you use another proxy, you might need to set these options:
|
|
|
|
|
|
- [[[mysqljdbc]]]
|
|
|
- name=MySql JDBC
|
|
|
- interface=jdbc
|
|
|
- ## Specific options for connecting to the server.
|
|
|
- ## The JDBC connectors, e.g. mysql.jar, need to be in the CLASSPATH environment variable.
|
|
|
- ## If 'user' and 'password' are omitted, they will be prompted in the UI.
|
|
|
- options='{"url": "jdbc:mysql://localhost:3306/hue", "driver": "com.mysql.jdbc.Driver", "user": "root", "password": "root"}'
|
|
|
- ## options='{"url": "jdbc:mysql://localhost:3306/hue", "driver": "com.mysql.jdbc.Driver"}'
|
|
|
+<pre>
|
|
|
+ [desktop]
|
|
|
+ # Enable X-Forwarded-Host header if the load balancer requires it.
|
|
|
+ use_x_forwarded_host=false
|
|
|
|
|
|
-### Presto
|
|
|
+ # Support for HTTPS termination at the load-balancer level with SECURE_PROXY_SSL_HEADER.
|
|
|
+ secure_proxy_ssl_header=false
|
|
|
+</pre>
|
|
|
|
|
|
-Direct interface:
|
|
|
+## Configuring SSL
|
|
|
|
|
|
- [[[presto]]]
|
|
|
- name=Presto SQL
|
|
|
- interface=presto
|
|
|
- ## Specific options for connecting to the Presto server.
|
|
|
- ## The JDBC driver presto-jdbc.jar need to be in the CLASSPATH environment variable.
|
|
|
- ## If 'user' and 'password' are omitted, they will be prompted in the UI.
|
|
|
- options='{"url": "jdbc:presto://localhost:8080/catalog/schema", "driver": "io.prestosql.jdbc.PrestoDriver", "user": "root", "password": "root"}'
|
|
|
+You can configure Hue to serve over HTTPS.
|
|
|
|
|
|
-The Presto JDBC client driver is maintained by the Presto Team and can be downloaded here: https://prestodb.io/docs/current/installation/jdbc.html
|
|
|
+1. Configure Hue to use your private key by adding the following
|
|
|
+options to the `hue.ini` configuration file:
|
|
|
|
|
|
- [[[presto]]]
|
|
|
- name=Presto JDBC
|
|
|
- interface=jdbc
|
|
|
- options='{"url": "jdbc:presto://localhost:8080/", "driver": "com.facebook.presto.jdbc.PrestoDriver"}'
|
|
|
+ ssl_certificate=/path/to/certificate
|
|
|
+ ssl_private_key=/path/to/key
|
|
|
|
|
|
-### Oracle
|
|
|
+2. Ideally, you would have an appropriate key signed by a Certificate Authority.
|
|
|
+If you're just testing, you can create a self-signed key using the `openssl`
|
|
|
+command that may be installed on your system:
|
|
|
|
|
|
-### PostgreSQL
|
|
|
+Create a key:
|
|
|
|
|
|
-First, in your hue.ini file, you will need to add the relevant database connection information under the librdbms section:
|
|
|
+ openssl genrsa 1024 > host.key
|
|
|
|
|
|
- [librdbms]
|
|
|
- [[databases]]
|
|
|
- [[[postgresql]]]
|
|
|
- nice_name=PostgreSQL
|
|
|
- name=music
|
|
|
- engine=postgresql_psycopg2
|
|
|
- port=5432
|
|
|
- user=hue
|
|
|
- password=hue
|
|
|
- options={}
|
|
|
+Create a self-signed certificate:
|
|
|
|
|
|
-Secondly, we need to add a new interpreter to the notebook app. This will allow the new database type to be registered as a snippet-type in the Notebook app. For query editors that use a Django-compatible database, the name in the brackets should match the database configuration name in the librdbms section (e.g. – postgresql). The interface will be set to rdbms. This tells Hue to use the librdbms driver and corresponding connection information to connect to the database. For example, with the above postgresql connection configuration in the librdbms section, we can add a PostgreSQL interpreter with the following notebook configuration:
|
|
|
+ openssl req -new -x509 -nodes -sha1 -key host.key > host.cert
|
|
|
|
|
|
- [notebook]
|
|
|
- [[interpreters]]
|
|
|
- [[[postgresql]]]
|
|
|
- name=PostgreSQL
|
|
|
- interface=rdbms
|
|
|
|
|
|
-### AWS Athena
|
|
|
+<div class="note">
|
|
|
+Self-signed Certificates and File Uploads
|
|
|
|
|
|
-Same as Presto.
|
|
|
+To upload files using the Hue File Browser over HTTPS requires
|
|
|
+using a proper SSL Certificate. Self-signed certificates don't
|
|
|
+work.
|
|
|
+</div>
|
|
|
|
|
|
-### Teradata
|
|
|
+Note: The security vulnerability SWEET32 is also called Birthday attacks against TLS ciphers with 64bit block size and it is assigned CVE-2016-2183. This is due to legacy block ciphers
|
|
|
+having block size of 64 bits are vulnerable to a practical collision attack when used in CBC mode.
|
|
|
|
|
|
- [[[teradata]]]
|
|
|
- name=Teradata JDBC
|
|
|
- interface=jdbc
|
|
|
- options='{"url": "jdbc:teradata://sqoop-teradata-1400.sjc.cloudera.com/sqoop", "driver": "com.teradata.jdbc.TeraDriver", "user": "sqoop", "password": "sqoop"}'
|
|
|
+DES/3DES are the only ciphers has block size of 64-bit. One way to config Hue not to use them:
|
|
|
+<pre>
|
|
|
+ [desktop]
|
|
|
+ ssl_cipher_list=DEFAULT:!DES:!3DES
|
|
|
+</pre>
|
|
|
|
|
|
-### DB2
|
|
|
+## SASL
|
|
|
|
|
|
- [[[db2]]]
|
|
|
- name=DB2 JDBC
|
|
|
- interface=jdbc
|
|
|
- options='{"url": "jdbc:db2://db2.vpc.cloudera.com:50000/SQOOP", "driver": "com.ibm.db2.jcc.DB2Driver", "user": "DB2INST1", "password": "cloudera"}'
|
|
|
+When getting a bigger result set from Hive/Impala or bigger files like images from HBase, the response requires to increase
|
|
|
+the buffer size of SASL lib for thrift sasl communication.
|
|
|
|
|
|
-### Spark SQL
|
|
|
+<pre>
|
|
|
+ [desktop]
|
|
|
+ # This property specifies the maximum size of the receive buffer in bytes in thrift sasl communication,
|
|
|
+ # default value is 2097152 (2 MB), which equals to (2 * 1024 * 1024)
|
|
|
+ sasl_max_buffer=2097152
|
|
|
+</pre>
|
|
|
|
|
|
-Via [Apache Livy](https://livy.incubator.apache.org/) (recommended):
|
|
|
+## User Admin Configuration
|
|
|
+In the `[useradmin]` section of the configuration file, you can
|
|
|
+_optionally_ specify the following:
|
|
|
|
|
|
- [[[sparksql]]]
|
|
|
- name=SparkSql
|
|
|
- interface=livy
|
|
|
+default_user_group::
|
|
|
+ The name of a default group that is suggested when creating a
|
|
|
+ user manually. If the LdapBackend or PamBackend are configured
|
|
|
+ for doing user authentication, new users will automatically be
|
|
|
+ members of the default group.
|
|
|
|
|
|
- ...
|
|
|
|
|
|
- [spark]
|
|
|
- # The Livy Server URL.
|
|
|
- livy_server_url=http://localhost:8998
|
|
|
+## Banner
|
|
|
+You can add a custom banner to the Hue Web UI by applying HTML directly to the property, banner_top_html. For example:
|
|
|
|
|
|
-Via native HiveServer2 API:
|
|
|
+ banner_top_html=<H4>My company's custom Hue Web UI banner</H4>
|
|
|
|
|
|
- [[[sparksql]]]
|
|
|
- name=SparkSql
|
|
|
- interface=hiveserver2
|
|
|
+## Splash Screen
|
|
|
+You can customize a splash screen on the login page by applying HTML directly to the property, login_splash_html. For example:
|
|
|
|
|
|
-### Kafka SQL
|
|
|
+ [desktop]
|
|
|
+ [[custom]]
|
|
|
+ login_splash_html=WARNING: You are required to have authorization before you proceed.
|
|
|
|
|
|
- [[[kafkasql]]]
|
|
|
- name=Kafka SQL
|
|
|
- interface=kafka
|
|
|
|
|
|
-### SQLServer
|
|
|
+## Custom Logo
|
|
|
|
|
|
-Microsoft’s SQL Server JDBC drivers can be downloaded from the official site: [Microsoft JDBC Driver](https://msdn.microsoft.com/en-us/sqlserver/aa937724.aspx)
|
|
|
+There is also the possibility to change the logo for further personalization.
|
|
|
|
|
|
- [[[sqlserver]]]
|
|
|
- name=SQLServer JDBC
|
|
|
- interface=jdbc
|
|
|
- options='{"url": "jdbc:microsoft:sqlserver://localhost:1433", "driver": "com.microsoft.jdbc.sqlserver.SQLServerDriver", "user": "admin": "password": "pass"}'
|
|
|
+ [desktop]
|
|
|
+ [[custom]]
|
|
|
+ # SVG code to replace the default Hue logo in the top bar and sign in screen
|
|
|
+ # e.g. <image xlink:href="/static/desktop/art/hue-logo-mini-white.png" x="0" y="0" height="40" width="160" />
|
|
|
+ logo_svg=
|
|
|
|
|
|
-### Vertica
|
|
|
+You can go crazy and write there any SVG code you want. Please keep in mind your SVG should be designed to fit in a 160×40 pixels space. To have the same ‘hearts logo' you can see above, you can type this code
|
|
|
|
|
|
-Vertica’s JDBC client drivers can be downloaded here: [Vertica JDBC Client Drivers](https://my.vertica.com/download/vertica/client-drivers/). Be sure to download the driver for the right version and OS.
|
|
|
+ [desktop]
|
|
|
+ [[custom]]
|
|
|
+ logo_svg='<g><path stroke="null" id="svg_1" d="m44.41215,11.43463c-4.05017,-10.71473 -17.19753,-5.90773 -18.41353,-0.5567c-1.672,-5.70253 -14.497,-9.95663 -18.411,0.5643c-4.35797,11.71793 16.891,22.23443 18.41163,23.95773c1.5181,-1.36927 22.7696,-12.43803 18.4129,-23.96533z" fill="#ffffff"/> <path stroke="null" id="svg_2" d="m98.41246,10.43463c-4.05016,-10.71473 -17.19753,-5.90773 -18.41353,-0.5567c-1.672,-5.70253 -14.497,-9.95663 -18.411,0.5643c-4.35796,11.71793 16.891,22.23443 18.41164,23.95773c1.5181,-1.36927 22.76959,-12.43803 18.41289,-23.96533z" fill="#FF5A79"/> <path stroke="null" id="svg_3" d="m154.41215,11.43463c-4.05016,-10.71473 -17.19753,-5.90773 -18.41353,-0.5567c-1.672,-5.70253 -14.497,-9.95663 -18.411,0.5643c-4.35796,11.71793 16.891,22.23443 18.41164,23.95773c1.5181,-1.36927 22.76959,-12.43803 18.41289,-23.96533z" fill="#ffffff"/> </g>'
|
|
|
|
|
|
- [[[vertica]]]
|
|
|
- name=Vertica JDBC
|
|
|
- interface=jdbc
|
|
|
- options='{"url": "jdbc:vertica://localhost:5433/example", "driver": "com.vertica.jdbc.Driver", "user": "admin", "password": "pass"}'
|
|
|
+Read more about it in [Hue with a custom logo](http://gethue.com/hue-with-a-custom-logo/) post.
|
|
|
|
|
|
-### Phoenix
|
|
|
|
|
|
-The Phoenix JDBC client driver is bundled with the Phoenix binary and source release artifacts, which can be downloaded here: [Apache Phoenix Downloads](https://phoenix.apache.org/download.html). Be sure to use the Phoenix client driver that is compatible with your Phoenix server version.
|
|
|
+## Storing passwords in file script
|
|
|
|
|
|
- [[[phoenix]]]
|
|
|
- name=Phoenix JDBC
|
|
|
- interface=jdbc
|
|
|
- options='{"url": "jdbc:phoenix:localhost:2181/hbase", "driver": "org.apache.phoenix.jdbc.PhoenixDriver", "user": "", "password": ""}'
|
|
|
+This [article details how to store passwords in a script](http://gethue.com/storing-passwords-in-script-rather-than-hue-ini-files/) launched from the OS rather than have clear text passwords in the hue*.ini files.
|
|
|
|
|
|
-**Note**: Currently, the Phoenix JDBC connector for Hue only supports read-only operations (SELECT and EXPLAIN statements).
|
|
|
+Some passwords go in Hue ini configuration file making them easily visible to Hue admin user or by users of cluster management software. You can use the password_script feature to prevent passwords from being visible.
|
|
|
|
|
|
-### Redshift
|
|
|
+## Idle session timeout
|
|
|
|
|
|
-### BigQuery
|
|
|
+Hue now offers a new property, idle_session_timeout, that can be configured in the hue.ini file:
|
|
|
|
|
|
-### Drill
|
|
|
+ [desktop]
|
|
|
+ [[auth]]
|
|
|
+ idle_session_timeout=600
|
|
|
|
|
|
-The [Drill JDBC driver](http://maprdocs.mapr.com/home/Hue/ConfigureHuewithDrill.html) can be used.
|
|
|
+When idle_session_timeout is set, users will automatically be logged out after N (e.g. – 600) seconds of inactivity and be prompted to login again:
|
|
|
|
|
|
- [[[drill]]]
|
|
|
- name=Drill JDBC
|
|
|
- interface=jdbc
|
|
|
- ## Specific options for connecting to the server.
|
|
|
- ## The JDBC connectors, e.g. mysql.jar, need to be in the CLASSPATH environment variable.
|
|
|
- ## If 'user' and 'password' are omitted, they will be prompted in the UI.
|
|
|
- options='{"url": "<drill-jdbc-url>", "driver": "org.apache.drill.jdbc.Driver", "user": "admin", "password": "admin"}'</code>
|
|
|
+[Read more about it here](http://gethue.com/introducing-the-new-login-modal-and-idle-session-timeout/).
|
|
|
|
|
|
-### Solr SQL
|
|
|
+## Auditing
|
|
|
|
|
|
- [[[solr]]]
|
|
|
- name = Solr SQL
|
|
|
- interface=solr
|
|
|
- ## Name of the collection handler
|
|
|
- # options='{"collection": "default"}'
|
|
|
+Read more about [Auditing User Administration Operations with Hue and Cloudera Navigator](http://gethue.com/auditing-user-administration-operations-with-hue-and-cloudera-navigator-2/).
|
|
|
|
|
|
-### Kylin
|
|
|
-
|
|
|
- [[[kylin]]]
|
|
|
- name=kylin JDBC
|
|
|
- interface=jdbc
|
|
|
- options='{"url": "jdbc:kylin://172.17.0.2:7070/learn_kylin", "driver": "org.apache.kylin.jdbc.Driver", "user": "ADMIN", "password": "KYLIN"}'
|
|
|
-
|
|
|
-### Clickhouse
|
|
|
-
|
|
|
- [[[clickhouse]]]
|
|
|
- name=ClickHouse
|
|
|
- interface=jdbc
|
|
|
- ## Specific options for connecting to the ClickHouse server.
|
|
|
- ## The JDBC driver clickhouse-jdbc.jar and its related jars need to be in the CLASSPATH environment variable.
|
|
|
- options='{"url": "jdbc:clickhouse://localhost:8123", "driver": "ru.yandex.clickhouse.ClickHouseDriver", "user": "readonly", "password": ""}'
|
|
|
-
|
|
|
-### SQL Alchemy
|
|
|
-SQL Alchemy is a robust [connector](https://docs.sqlalchemy.org/en/latest/core/engines.html#sqlalchemy.create_engine) that supports
|
|
|
-many [SQL dialects](https://docs.sqlalchemy.org/en/latest/dialects/mysql.html).
|
|
|
-
|
|
|
- [[[mysql]]]
|
|
|
- name = MySQL Alchemy
|
|
|
- interface=sqlalchemy
|
|
|
- options='{"url": "mysql://root:root@localhost:3306/hue"}'
|
|
|
-
|
|
|
-### Django DB Connectors
|
|
|
-Those rely on the `[dbms]` lib an dedicated Python libs.
|
|
|
-
|
|
|
-Note, SQL Alchemy should be prefered.
|
|
|
-
|
|
|
-Hue’s query editor can easily be configured to work with any database backend that [Django](https://docs.djangoproject.com/en/1.9/topics/install/#database-installation) supports, including PostgreSQL, MySQL, Oracle and SQLite. Some of you may note that these are the same backends supported by Hue’s DBQuery app and in fact, adding a new query editor for these databases starts with the same configuration step.
|
|
|
-
|
|
|
-First, in your hue.ini file, you will need to add the relevant database connection information under the librdbms section:
|
|
|
-
|
|
|
- [librdbms]
|
|
|
- [[databases]]
|
|
|
- [[[postgresql]]]
|
|
|
- nice_name=PostgreSQL
|
|
|
- name=music
|
|
|
- engine=postgresql_psycopg2
|
|
|
- port=5432
|
|
|
- user=hue
|
|
|
- password=hue
|
|
|
- options={}
|
|
|
-
|
|
|
-Secondly, we need to add a new interpreter to the notebook app. This will allow the new database type to be registered as a snippet-type in the Notebook app. For query editors that use a Django-compatible database, the name in the brackets should match the database configuration name in the librdbms section (e.g. – postgresql). The interface will be set to rdbms. This tells Hue to use the librdbms driver and corresponding connection information to connect to the database. For example, with the above postgresql connection configuration in the librdbms section, we can add a PostgreSQL interpreter with the following notebook configuration:
|
|
|
-
|
|
|
- [notebook]
|
|
|
- [[interpreters]]
|
|
|
- [[[postgresql]]]
|
|
|
- name=PostgreSQL
|
|
|
- interface=rdbms
|
|
|
-
|
|
|
-After updating the configuration and restarting Hue, we can access the new PostgreSQL interpreter in the Notebook app:
|
|
|
-
|
|
|
-### JDBC
|
|
|
-Use the query editor with any JDBC database.
|
|
|
-
|
|
|
-Note, SQL Alchemy should be prefered.
|
|
|
-
|
|
|
-The “rdbms” interface works great for MySQL, PostgreSQL, SQLite, and Oracle, but for other JDBC-compatible databases Hue now finally supports a “jdbc” interface to integrate such databases with the new query editor!
|
|
|
-
|
|
|
-Integrating an external JDBC database involves a 3-step process:
|
|
|
-
|
|
|
-Download the compatible client driver JAR file for your specific OS and database. Usually you can find the driver files from the official database vendor site; for example, the MySQL JDBC connector for Mac OSX can be found here: https://dev.mysql.com/downloads/connector/j/. (NOTE: In the case of MySQL, the JDBC driver is platform independent, but some drivers are specific to certain OSes and versions so be sure to verify compatibility.)
|
|
|
-Add the path to the driver JAR file to your Java CLASSPATH. Here, we set the CLASSPATH environment variable in our `.bash_profile` script.
|
|
|
-
|
|
|
- # MySQL
|
|
|
- export MYSQL_HOME=/Users/hue/Dev/mysql
|
|
|
- export CLASSPATH=$MYSQL_HOME/mysql-connector-java-5.1.38-bin.jar:$CLASSPATH
|
|
|
-
|
|
|
-Add a new interpreter to the notebook app and supply the “name”, set “interface” to jdbc, and set “options” to a JSON object that contains the JDBC connection information. For example, we can connect a local MySQL database named “hue” running on `localhost` and port `8080` via JDBC with the following configuration:
|
|
|
-
|
|
|
- [notebook]
|
|
|
- [[interpreters]]
|
|
|
- [[[mysql]]]
|
|
|
- name=MySQL JDBC
|
|
|
- interface=jdbc
|
|
|
- options='{"url": "jdbc:mysql://localhost:3306/hue", "driver": "com.mysql.jdbc.Driver", "user": "root", "password": ""}'
|
|
|
-
|
|
|
-Technically the JDBC is connecting to the database to query via a Java Proxy powered with Py4j. It will automatically
|
|
|
-be started if any interpreter is using it.
|
|
|
-
|
|
|
- ## Main flag to override the automatic starting of the DBProxy server.
|
|
|
- enable_dbproxy_server=true
|
|
|
-
|
|
|
-**Tip**: Testing JDBC Configurations
|
|
|
-Before adding your interpreter’s JDBC configurations to hue.ini, verify that the JDBC driver and connection settings work in a SQL client like SQuirrel SQL.
|
|
|
-
|
|
|
-**Tip**: Prompt for JDBC authentication
|
|
|
-You can leave out the username and password in the JDBC options, and Hue will instead prompt the user for a username and password. This allows administrators to provide access to JDBC sources without granting all Hue users the same access.
|
|
|
-
|
|
|
-
|
|
|
-### Spark
|
|
|
-
|
|
|
- [[[pyspark]]]
|
|
|
- name=PySpark
|
|
|
- interface=livy
|
|
|
-
|
|
|
- [[[sparksql]]]
|
|
|
- name=SparkSql
|
|
|
- interface=livy
|
|
|
-
|
|
|
- [[[spark]]]
|
|
|
- name=Scala
|
|
|
- interface=livy
|
|
|
-
|
|
|
- [[[r]]]
|
|
|
- name=R
|
|
|
- interface=livy
|
|
|
-
|
|
|
- ...
|
|
|
-
|
|
|
- [spark]
|
|
|
- # The Livy Server URL.
|
|
|
- livy_server_url=http://localhost:8998
|
|
|
-
|
|
|
-### Pig
|
|
|
-
|
|
|
- [[[pig]]]
|
|
|
- name=Pig
|
|
|
- interface=oozie
|