Several ways to start hive

Source: Internet
Author: User
Tags xsl mysql database port number
1. Use the local metastore to start directly from the Hive command.

Hive-site.xml files are configured using local MySQL database storage Metastore

<property>  
    <name>hive.metastore.local</name>  
    <value>true</value><!-- Metadata is stored locally--  
</property>   
<property>  
    <name>javax.jdo.option.connectionurl</ Name>  
    <value>jdbc:mysql://127.0.0.1:3306/hive?createdatabaseifnotexist=true&usessl=false</ value>  
</property>  
<property>  
    <name>javax.jdo.option.ConnectionDriverName< /name>  
    <value>com.mysql.jdbc.Driver</value><!--JDBC Drive-  
</property>  
<property>  
     <name>javax.jdo.option.ConnectionUserName</name>  
     <value>root</ value><!--MySQL Account-  
</property>  
<property>  
     <name> javax.jdo.option.connectionpassword</name>  
     <value>rootpassword</value><!--mysql password-- >  
</property>  

Use the following command to turn on

$HIVE _home/bin/hive

The hive command, by default, starts the client service, which is equivalent to the following command

$HIVE _home/bin/hive--service CLI

No need to start the server, using the local metastore, you can do some simple data manipulation and testing. 2. Using the remote Metastore

Metastore and hive clients are not on a single machine.

Server 1 as configured in 1, using local Metastore

Server 1 starts the Metastore service

$HIVE _home/bin/hive--service Metastore

As on, the port number of the default 9083 Metastore service is started, and the port number can be specified by-p

$HIVE _home/bin/hive--service metastore-p 9083
Server 2 is configured as follows, using remote Metastore
<?xml version= "1.0" encoding= "UTF-8" standalone= "no"?>
<?xml-stylesheet type= "text/xsl" href= " Configuration.xsl "?>
<configuration>
    <property>
       <name>hive.metastore.uris< /name>
       <value>thrift://metastore_server_ip:9083</value><!--Here is the IP of server 1--
    </ Property>
</configuration>
Server 2 Launch CLI directly
$HIVE _home/bin/hive

You do not need to start the server, use remote Metastore 3. Start Hiveserver2 so that other services can access hive via thrift

Hive-site.xml as configured in 1

Hive-site.xml can be added to whether or not to verify the configuration, set here to none, for the time being no validation, testing.

<property>
    <name>hive.server2.authentication</name>
    <value>NONE</value>
</property>
Configuring Hadoop proxy users in the Core-site.xml file for Hadoop
<property>
    <name>hadoop.proxyuser.root.hosts</name>
    <value>*</value>
</property>
<property>
    <name>hadoop.proxyuser.root.groups</name>
    < Value>*</value>
</property>

This setting means that a task submitted by the root user can be executed on any machine as any user of any group.
If not set, subsequent connections are reported

Org.apache.hadoop.ipc.RemoteException (org.apache.hadoop.security.authorize.AuthorizationException):

Hadoop does not allow root users to access Hadoop with anonymous identities when security checks are in use.
But in fact, my Hadoop does not set authorization, why must be set root proxy user, here is a question for the time being.
After Setup, you need to restart Hadoop

$HADOOP _home/sbin/stop-dfs.sh
$HADOOP _home/sbin/start-dfs.sh
Start Hiveserver2
$HIVE _home/bin/hive--service Hiveserver2
Beeline tool test connects using JDBC Mode
$HIVE _home/bin/beeline-u jdbc:hive2://localhost:10000

Hiveserver Port number default is 10000
Use beeline to connect to a JDBC connection and then act like a client. Hiveserver2 will start a webui at the same time, the port number defaults to 10002 and can be accessed by http://localhost:10002/

Information such as Session/query/software can be seen in the interface. (This page is viewable only and cannot be manipulated by the Hive Data Warehouse) 4. Launch Hivewebinterface to access hive via Web page

Hive provides a Web page GUI to access the Hive Data Warehouse
You can start hwi with the following command, the default port number 9999

$HIVE _home/bin/hive--service Hwi

The HWI is no longer supported from Hive 2.2.0 and is therefore not mentioned. 5. (extension) Access hive using Hcatalog

Starting with hive version 0.11.0, Hive contains the Hcatalog
Hcatalog is a data sheet and storage Management service based on Apache Hadoop that supports cross-data processing tools such as pig,mapreduce,streaming,hive.
With Hcatalog, hive metadata can also be used for other Hadoop-based tools. No matter which data processing tool the user uses, through Hcatalog, they can manipulate the same data.

You can start hcatalog with the following command

$HIVE _home/hcatalog/sbin/hcat_server.sh Start

You can start the CLI interface of Hcatalog with the following command

$HIVE _home/hcatalog/bin/hcat

In addition, Hcatalog's Webhcat also provides a set of rest API interfaces to access hive data
You can start webhcat with the following command

$HIVE _home/hcatalog/sbin/webhcat_server.sh Start

API Interface Website address: https://cwiki.apache.org/confluence/display/Hive/WebHCat+Reference

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.