"Hadoop" Hadoop2.7.3 installing hive 2.1.0

Source: Internet
Author: User
Tags ssl connection

Original articles, reproduced please mark from http://blog.csdn.net/lsttoy/article/details/53406710.

The first step :
Download the latest hive and go directly to Apache to find hive2.1.0 download on the line.

Step two , unzip to the server

Tar zxvf apache-hive-2.0.0-bin.tar.gz 
 mv apache-hive-2.0.0-bin/home/hive
 

The third step is to modify the Conf. This only concerns the configuration of Hadoop and hive, and other Java hbase configurations are based on their own

Vi/etc/profile 

#for Hadoop
export hadoop_home=/home/hadoop/hadoop-2.7.3
export hadoop_common_lib_ native_dir= $HADOOP _home/lib/native
export hadoop_opts= "-djava.library.path= $HADOOP _home/lib"
export path = $PATH:/home/hadoop/hadoop-2.7.3/bin 
export path= $PATH:/home/hadoop/hadoop-2.7.3/sbin  

#for Hive    
Export hive_home=/home/hive                               export path= $HADOOP _home/bin: $JAVA _home/bin: $HBASE _home/bin: $HIVE _home/bin:$ PATH

Fourth step , download and set up the JDBC connector.
I used the newest mysql-connector-java-5.1.40.tar.gz here.
Remember to put the extracted jar into the lib of hive

Fifth Step , configure the Hive-site.xml file
Files from Hive-default.xml.template
That

CP Hive-default.xml.template Hive-site.xml

And then find

<name>javax.jdo.option.ConnectionURL</name>

Modify its value

     <value>jdbc:mysql://139.196.xxx.xxx:3306/hive?characterEncoding=UTF8&amp;useSSL=false&amp; Createdatabaseifnotexist=true</value>

Also, be careful to modify the account password of the corresponding database, or you will get an error executing hive.

    <property>
        <name>javax.jdo.option.ConnectionUserName</name>
        <value>root</ value>
    </property>
    <property>
        <name>javax.jdo.option.connectionpassword</ name>
        <value>123456</value>
    </property>

Sixth step running the hive client

Cd/home/hive/bin
Hive

Seventh step, Initialize DB
Schematool-initschema-dbtype MySQL

Eighth step, view the metadata after the success
You can see the corresponding database hive, with a variety of initial tables

Nineth step, start the Master,node node

Start a stand-alone
Hive
Start the cluster
Hive-hiveconf Hbase.zookeeper.quorum=slave1,slave2,slave3

————————————————————————————————————————————
The following are the possible errors:
One, if you execute hive, the error of reporting the account password
Then remember to modify the Hive-site.xml account password, refer to the fifth step of the content.
Second, if a db is not initialized, such as

Exception in thread "main" java.lang.RuntimeException:org.apache.hadoop.hive.ql.metadata.HiveException: Org.apache.hadoop.hive.ql.metadata.HiveException:MetaException (message:hive Metastore database is not initialized. Please use Schematool (e.g./schematool-initschema-dbtype ...) to create the schema. If needed, don ' t forget to include the option to auto-create the underlying database in your JDBC connection string (e.g. ? createdatabaseifnotexist=true for MySQL))

When you do this, initialize DB first.
Three, if prompted
SSL-related content, please set SSL to false when configuring JDBC link
Jdbc:mysql://139.196.xxx.xxx:3306/hive?usessl=false&createdatabaseifnotexist=true

Wed 14:24:50 CST warn:establishing SSL connection without server ' s identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must is established by default if explicit Opti On isn ' t set. For compliance with existing applications not using SSL, the Verifyservercertificate property was set to ' false '. You need either to explicitly disable SSL by setting Usessl=false, or set usessl=true and provide truststore for server CE
Rtificate verification. Wed 14:24:55 CST warn:establishing SSL connection without server ' s identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must is established by default if explicit Opti On isn ' t set. For compliance with existing applications not using SSL, the Verifyservercertificate property was set to ' false '. You need either to explicitly disable SSL by setting Usessl=false, or set usessl=true and provide truststore for sErver Certificate verification. 

Four, when you encounter hive error.

[Fatal Error] Hive-site.xml:26:5: The element type "value" must is terminated by the matching End-tag "</value>". 
  exception in thread "main" java.lang.RuntimeException:org.xml.sax.SAXParseException; Systemid:file:/home/hive/conf/hive-site.xml; linenumber:26; Columnnumber:5; The element type "value" must is terminated by the matching End-tag "</value>".
Logging initialized using configuration in Jar:file:/home/hive/lib/hive-common-2.1.0.jar!/hive-log4j2.properties Async:true
Exception in thread "main" java.lang.IllegalArgumentException:java.net.URISyntaxException:Relative Path in absolute URI: ${system:java.io.tmpdir%7d/$%7bsystem:user.name%7d
Here is the configuration file Hive-site.xml, modify the System:java.io.tmpdir, specify a directory for the system to exist.

There are two additional start-up options available for you to use for hive testing.

Hive provides four ways to run hive, namely:

**hive CLI
HiveServer2 and beeline**
Hcatalog
Webhcat (Templeton)

Here we mainly introduce the first two types of
First, thehive CLI

Because the path variable has been added to the bin directory of hive, it can be started directly using the Hive command:
Hive
Once you have entered the command, you can perform hive operations directly.

The second kind of HiveServer2 and Beeline

Beeline provides a multi-user, more secure service, so Beeline is used more.
Hiveserver2 the default address at startup is "localhost:10000", so you need to use "jdbc:hive2://localhost:10000" as a parameter when using Beeline connections.
The relevant commands are as follows:

Hiveserver2
beeline-u jdbc:hive2://localhost:10000

You can also launch Beeline and HiveServer2 in the same process for testing:
Beeline-u jdbc:hive2://
However, if you use a custom account password, you must configure it in the configuration file Hive-site.xml.
The fifth step above has already carried on the related introduction, may refer to.

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.