Hive Hiveserver2 Configuration Run

Source: Internet
Author: User
Tags time in milliseconds

1: Run

Command-line mode:

Hive--service Hiveserver2--hiveconf hive.server2.thrift.port=10001

Service mode:

Hiveserver2 start

[Jifeng@feng01 conf]$ hive--service hiveserver2--hiveconf hive.server2.thrift.port=10001
starting HiveServer2
15/03/05 16:59:33 WARN conf. Hiveconf:deprecated:hive.metastore.ds.retry.* no longer have any effect.  Use hive.hmshandler.retry.* instead


2: Permissions issue Java JDBC Connection error:

Exception in thread "main" java.sql.SQLException:Error and compiling statement:FAILED:RuntimeException cannot make di Rectory:hdfs://feng01:9000/tmp/hive-jifeng/hive_2015-03-05_17-04-43_349_5945847416346775092-3 at
	Org.apache.hive.jdbc.Utils.verifySuccess (utils.java:121) at
	Org.apache.hive.jdbc.Utils.verifySuccessWithInfo (utils.java:109) at
	Org.apache.hive.jdbc.HiveStatement.execute (hivestatement.java:231) at
	Org.apache.hive.jdbc.HiveStatement.executeQuery (hivestatement.java:355) at
	Demo.test.Pretest.main ( PRETEST.JAVA:28)

The server also sees errors
Failed:runtimeexception cannot make directory:hdfs://feng01:9000/tmp/hive-jifeng/hive_2015-03-05_17-04-43_349_ 5945847416346775092-3
Create directories without permissions, modify users and passwords to manage Hadoop

After modification

3:for input string: "5000L"

JDBC Connection report:

Exception in thread "main" Java.sql.SQLException:For input string: ' 5000L ' at
	Org.apache.hive.jdbc.Utils.verifySuccess (utils.java:121) at
	Org.apache.hive.jdbc.Utils.verifySuccessWithInfo (utils.java:109) at
	Org.apache.hive.jdbc.HiveStatement.execute (hivestatement.java:263) at
	Org.apache.hive.jdbc.HiveStatement.executeQuery (hivestatement.java:355) at
	Demo.test.Pretest.main ( PRETEST.JAVA:28)
To modify the configuration:

Put Hive-site.xml

This configuration file in Hive.server2.long.polling.timeout This parameter is 5000L, changed to 5000

[Jifeng@feng01 conf]$ VI hive-site.xml 

  <name>hive.server2.long.polling.timeout</name>
  < Value>5000</value>
  <description>time in milliseconds that HiveServer2 would wait, before responding To asynchronous calls this use
 long polling</description>
</property>
4:jdbc Connecting Hive OK

Package demo.test;

Import java.sql.*; public class Pretest {public static void main (String args[]) throws SQLException, Classnotfoundexcep

	    	    tion {String jdbcdriver= "org.apache.hive.jdbc.HiveDriver";

	    	    String jdbcurl= "jdbc:hive2://feng01:10001";
	    	    String username= "Jifeng";		
	    	    String password= "Jifeng";
	    	    Class.forName (Jdbcdriver); 
		        Connection C = drivermanager.getconnection (Jdbcurl,username,password);
		       Statement st = C.createstatement ();  SELECT * from firewall where idauto=16600918 "));//print (" num should is 1 ", St.executequery (" SELECT * FROM
		        Course "));
		        ("Select Id,name,vip from the users order by ID limit 5");
				        TODO indexing} static void print (String name, ResultSet res) throws SQLException {
				        SYSTEM.OUT.PRINTLN (name);				        
		                ResultSetMetaData Meta=res.getmetadata (); System.out.pRintln ("\ T" +res.getrow () + "record");
		                String str= "";
		                	for (int i=1;i<=meta.getcolumncount (); i++) {str+=meta.getcolumnname (i) + "";
		                System.out.println (Meta.getcolumnname (i) + "");
		                } System.out.println ("\ t" +str);
				        Str= "";   while (Res.next ()) {for (int i=1;i<=meta.getcolumncount (); i++) {str+= res.getstring (i) + "				        	";
				        	} System.out.println ("\ t" +str);
				        Str= ""; }
				    }	    
}
Operation Result:
	Course.id   course.c1   course.c2   course.c3   course.c4   
	1   English   Chinese   French   Japanese   
	2   Chinese   French         
	3   Chinese   French   Japanese      
	4   Chinese   French   Latin      
	5   Chinese   French   German      





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.