Questions Guide:
1. What three user access interfaces are provided by hive.
2, how to manually build the Hive-hwi-*.war installation package.
3, HWI service Start command is what.
4. Which two packages need to be copied to the Lib of the Hive installation directory before hwi start.
5. Before using the HWI Web to access the Hive database, which service needs to be started first.
6. The default listening port for Hwi is.
Hive provides three user interfaces: CLI, HWI, and client mode. One of the most common is when CLI,CLI starts, it initiates a hive copy at the same time. The client is the guest of hive, and the user connects to the Hive Server. When you start the client mode, you need to indicate the node where the hive server is located and start hive Server on that node. Hwi is a browser that accesses hive. This article describes the Hive Web Access interface.
HWI is the short name for Hive Web interface, and the version of Hive I'm using is Hive0.13.1.
first, terminal start HWI service
[Hadoopuser@secondmgt conf]$ hive--service hwi ls:cannot access/home/hadoopuser/cloud/hive/apache-hive-0.13.1-bin/ Lib/hive-hwi-*.war:no such file or directory 15/01/09 15:49:35 INFO hwi. Hwiserver:hwi is starting up 15/01/09 15:49:35 INFO Configuration.deprecation:mapred.reduce.tasks is deprecated. Instead, use mapreduce.job.reduces 15/01/09 15:49:35 INFO Configuration.deprecation:mapred.min.split.size are Deprecated. Instead, use mapreduce.input.fileinputformat.split.minsize 15/01/09 15:49:35 INFO configuration.deprecation: Mapred.reduce.tasks.speculative.execution is deprecated. Instead, use mapreduce.reduce.speculative 15/01/09 15:49:35 INFO configuration.deprecation: Mapred.min.split.size.per.node is deprecated. Instead, use Mapreduce.input.fileinputformat.split.minsize.per.node 15/01/09 15:49:35 INFO configuration.deprecation : Mapred.input.dir.recursive is deprecated. Instead, use mapreduce.input.fileinputformat.input.dir.recursive 15/01/09 15:49:35 INFO Configuration.deprecaTion:mapred.min.split.size.per.rack is deprecated. Instead, use Mapreduce.input.fileinputformat.split.minsize.per.rack 15/01/09 15:49:35 INFO configuration.deprecation : Mapred.max.split.size is deprecated. Instead, use mapreduce.input.fileinputformat.split.maxsize 15/01/09 15:49:35 INFO configuration.deprecation: Mapred.committer.job.setup.cleanup.needed is deprecated. Instead, use mapreduce.job.committer.setup.cleanup.needed 15/01/09 15:49:35 INFO mortbay.log:Logging to Org.slf4j.impl.Log4jLoggerAdapter (Org.mortbay.log) via Org.mortbay.log.Slf4jLog 15/01/09 15:49:35 INFO mortbay.log: jetty-6.1.26 15/01/09 15:49:35 INFO mortbay.log:Started socketconnector@0.0.0.0:9999
From the above, we use Hive--service hwi to start the HWI service at the terminal, but began to report an exception error, Hive-hwi-*.war packet does not exist.
Note: The reason for the report error is that there is no HWI War package file in Hive's current distribution, which exists on both 0.13 and 0.14, and the HWI service cannot be started without this war package.
Workaround: Manually build the war package from the source code, as a second step.
second, build the Hive Hwi War package manually
1, download the hive corresponding version of the source code apache-hive-0.13.1-src.tar.gz from the Hive official website, download and unzip, and enter the HWI directory. The Web directory under the Hwi directory is the HWI Web interface directory, as follows:
[Hadoopuser@secondmgt downloads]$ tar-zxvf apache-hive-0.13.1-src.tar.gz
[hadoopuser@secondmgt hwi]$ pwd
/ Home/hadoopuser/downloads/apache-hive-0.13.1-src/hwi
[Hadoopuser@secondmgt hwi]$ jar cvfM0 hive-hwi-0.13.1.war-c web/. adding:navbar.jsp (in = 1345) (out= 1345) (stored 0) adding:session_remove.jsp (in = 2359) (out= 2359) (stored 0) adding: session_kill.jsp (in = 2236) (out= 2236) (stored 0) adding:show_database.jsp (in = 2346) (out= 2346) (stored 0) adding:ses sion_list.jsp (in = 2298) (out= 2298) (stored 0) adding:left_navigation.jsp (in = 1553) (out= 1553) (stored 0) adding:sess ion_result.jsp (in = 2488) (out= 2488) (stored 0) adding:view_file.jsp (in = 2653) (out= 2653) (stored 0) Adding:session_c reate.jsp (in = 2690) (out= 2690) (stored 0) adding:web-inf/(in = 0) (out= 0) (stored 0) adding:web-inf/web.xml (in = 1438
) (out= 1438) (stored 0) adding:authorize.jsp (in = 2729) (out= 2729) (stored 0) adding:css/(in = 0) (out= 0) (stored 0%) Adding:css/bootstrap.min.css (in = 90193) (out= 90193) (stored 0) adding:img/(in = 0) (out= 0) (stored 0) adding:img/gly Phicons-halflings.png (in = 4352) (out= 4352) (stored 0) adding:img/glyphicons-halflings-white.png (in = 4352) (out= 4352) (stored 0) adding:session_manage.jsp (in = 6738) (out= 6738) (stored 0) adding : diagnostics.jsp (in = 2365) (out= 2365) (stored 0) adding:show_table.jsp (in = 4996) (out= 4996) (stored 0) adding:index . jsp (in = 1876) (out= 1876) (stored 0) adding:error_page.jsp (in = 1867) (out= 1867) (stored 0) adding:show_databases.jsp (in = 2096) (out= 2096) (stored 0) adding:session_diagnostics.jsp (in = 2489) (out= 2489) (stored 0) adding:session_history.jsp (in = 3150) (out= 3150) (stored 0%)
2. Execute jar cvfM0 hive-hwi-0.13.1.war-c web/. Package command to generate the Hive-hwi-0.13.1-war we need and copy it to the Hive installation directory Lib directory as follows:
[Hadoopuser@secondmgt hwi]$ ls
hive-hwi-0.13.1.war hive-hwi.iml pom.xml src web
Third, add HWI configuration in Hive-site.xml
We need to configure some of the default configurations for HWI in Hive-default.xml in Hive-site.xml as per your requirements. The configuration for HWI in Hive-site.xml is as follows:
<property>
<name>hive.hwi.war.file</name>
<value>lib/hive-hwi-0.13.1.war</ Value>
<description>this Sets the path to the HWI war file, relative to ${hive_home}. </description>
</property>
<property>
<name>hive.hwi.listen.host</name>
<value> 192.168.2.133</value>
<description>this is the host address the Hive Web Interface would listen On</des cription>
</property>
<property>
<name>hive.hwi.listen.port</name>
<value>9999</value>
<description>this is the port the Hive Web Interface would listen on< /description>
</property>
The Hive.hwi.war.file property is the location of the specified hive Web user interface program installation package, which is the second packaged file for us.
Iv. Restart the HWI service
[Hadoopuser@secondmgt conf]$ hive--service hwi 15/01/09 16:17:13 INFO hwi. Hwiserver:hwi is starting up 15/01/09 16:17:14 INFO Configuration.deprecation:mapred.reduce.tasks is deprecated. Instead, use mapreduce.job.reduces 15/01/09 16:17:14 INFO Configuration.deprecation:mapred.min.split.size are Deprecated. Instead, use mapreduce.input.fileinputformat.split.minsize 15/01/09 16:17:14 INFO configuration.deprecation: Mapred.reduce.tasks.speculative.execution is deprecated. Instead, use mapreduce.reduce.speculative 15/01/09 16:17:14 INFO configuration.deprecation: Mapred.min.split.size.per.node is deprecated. Instead, use Mapreduce.input.fileinputformat.split.minsize.per.node 15/01/09 16:17:14 INFO configuration.deprecation : Mapred.input.dir.recursive is deprecated. Instead, use mapreduce.input.fileinputformat.input.dir.recursive 15/01/09 16:17:14 INFO configuration.deprecation: Mapred.min.split.size.per.rack is deprecated. Instead, use Mapreduce.input.fileinputformat.split.minsize.per.Rack 15/01/09 16:17:14 INFO Configuration.deprecation:mapred.max.split.size is deprecated. Instead, use mapreduce.input.fileinputformat.split.maxsize 15/01/09 16:17:14 INFO configuration.deprecation: Mapred.committer.job.setup.cleanup.needed is deprecated. Instead, use mapreduce.job.committer.setup.cleanup.needed 15/01/09 16:17:14 INFO mortbay.log:Logging to Org.slf4j.impl.Log4jLoggerAdapter (Org.mortbay.log) via Org.mortbay.log.Slf4jLog 15/01/09 16:17:14 INFO mortbay.log: jetty-6.1.26 15/01/09 16:17:14 INFO mortbay.log:extract/home/hadoopuser/cloud/hive/apache-hive-0.13.1-bin/lib/ Hive-hwi-0.13.1.war To/tmp/jetty_192_168_2_133_9999_hive.hwi.0.13.1.war__hwi__gybk6o/webapp 15/01/09 16:17:14 INFO Mortbay.log:Started socketconnector@192.168.2.133:9999
From the start-up log, start normal, no longer report the first step of the error.
v. Start Hive Metastore Service
Note: Whether you access hive using the Hive CLI, the client, or HWI, you will need to start the Hive Metadata service first, or you will not be able to access the hive database. As follows:
[Hadoopuser@secondmgt ~]$ Hive--service metastore
starting hive metastore Server
15/01/09 16:38:52 INFO Configuration.deprecation:mapred.reduce.tasks is deprecated. Instead, use mapreduce.job.reduces
15/01/09 16:38:52 INFO Configuration.deprecation:mapred.min.split.size are Deprecated. Instead, use mapreduce.input.fileinputformat.split.minsize
15/01/09 16:38:52 INFO configuration.deprecation: Mapred.reduce.tasks.speculative.execution is deprecated. Instead, use mapreduce.reduce.speculative
15/01/09 16:38:52 INFO configuration.deprecation: Mapred.min.split.size.per.node is deprecated. Instead, use Mapreduce.input.fileinputformat.split.minsize.per.node
15/01/09 16:38:52 INFO Configuration.deprecation:mapred.input.dir.recursive is deprecated. Instead, use Mapreduce.input.fileinputformat.input.dir.recursive
v. Using Web pages to access hive
1, we enter in the browser: http://192.168.2.133:9999/hwi,192.168.2.133 is my hive installed host IP, can be modified to your corresponding host IP. Hive Web functionality is relatively simple, the interface is relatively humble, the home page is as follows:
2. Click "Browse Schema" to view the database in hive, as shown in the figure below, my hive has two databases, namely default and hive
3. Click "Hive" to see what tables are in the hive database, as follows, there is only one "querysglog" table in my Hive database:
Vi. performing HQL operations in the Web interface
1. Create session
We perform some hive query operations on the web and feel the Hive Web user interface. Before executing the query, you need to create a session, click "Create Session", create a session, and named Gxnzx, as follows:
2, check the session, click "List Sessions", as follows
3, in the image above, click "Manager", enter the result file name, and query statement, execute the commit can execute the query operation, the result will remain in the created file name.
Note: Be sure to separate multiple statements with semicolons.
4. Click "View File" above to view the results of the query.
Summary:
If a friend who has used the CLI has seen the above introduction, it will certainly find a very serious problem: the execution of the process is not prompted. We don't know when a query execution ended. However, you can see the execution process log information at the service terminal.
In summary, using Hive's Web Hwi user interface is inconvenient, and generally we use the CLI to operate hive.
Report:
While using the hive Web process, you may also encounter some other problems and exception errors, and I would like to summarize the exceptions and errors I encountered and the solution to the following:
1, Tools.jar problem
When entering Http://192.168.2.133:9999/hwi in the browser, the page does not open and reports the following error
Unable to find a javac compiler;
Com.sun.tools.javac.Main isn't on the classpath.
Perhaps Java_home does not point to the JDK.
It is currently set to "/home/hadoopuser/cloud/jdk/jdk1.7.0_60/jre"
This problem occurs because Java.home refers to the $java_home/jre, and the Tools.jar under the Lib is not the same as $java_home/lib/tools.jar, when compiling the JSP needs to use the latter.
workaround: Will $java_home/lib/tools. The jar is copied to the Lib directory of Hive, as follows:
cp/usr/java/jdk1.7.0_55/lib/tools.jar/usr/local/hive/lib/
Hive--service hwi reboot.
2. The metadata service for hive was not started and reported the following error:
15/01/09 16:37:58 INFO hive.metastore:Trying to connect to Metastore with URI thrift://192.168.2.133:9083
15/01/09 16 : 37:58 WARN hive.metastore:Failed to connect to the Metastore Server
... 15/01/09 16:37:58 INFO hive.metastore:Waiting 1 seconds before next connection attempt.
Workaround:Regardless of the way you access hive, you need to start hive's Metaserver service first.