1 system Environment
Ubuntu 14.10
JDK-7
Hadoop 2.6.0
2 installation Step 2.1 Download hive
The first time I installed, the download is Hive-1.2.1, after configuration, always error
[ERROR] Terminal initialization failed; falling back to Unsupportedjava.lang.IncompatibleClassChangeError:Found classJLine. Terminal, butInterfaceWas expected at JLine. Terminalfactory.create (Terminalfactory.java:101) at JLine. Terminalfactory.get (Terminalfactory.java:158) at Jline.console.ConsoleReader.<init> (consolereader.java:229) at Jline.console.ConsoleReader.<init> (consolereader.java:221) at Jline.console.ConsoleReader.<init> (consolereader.java:209) at Org.apache.hadoop.hive.cli.CliDriver.getConsoleReader (Clidriver.java:773) at Org.apache.hadoop.hive.cli.CliDriver.executeDriver (Clidriver.java:715) at Org.apache.hadoop.hive.cli.CliDriver.run (Clidriver.java:675) at Org.apache.hadoop.hive.cli.CliDriver.main (Clidriver.java:615) at Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at Sun.reflect.NativeMethodAccessorImpl.invoke (Nativemethodaccessorimpl.java:57) at Sun.reflect.DelegatingMethodAccessorImpl.invoke (Delegatingmethodaccessorimpl.java:43) at Java.lang.reflect.Method.invoke (Method.java:30S) at Org.apache.hadoop.util.RunJar.run (Runjar.java:221) at Org.apache.hadoop.util.RunJar.main (Runjar.java:136) Exception in thread"Main" Java.lang.IncompatibleClassChangeError:FoundclassJLine. Terminal, butInterfaceWas expected at Jline.console.ConsoleReader.<init> (consolereader.java:230) at Jline.console.ConsoleReader.<init> (consolereader.java:221) at Jline.console.ConsoleReader.<init> (consolereader.java:209) at Org.apache.hadoop.hive.cli.CliDriver.getConsoleReader (Clidriver.java:773) at Org.apache.hadoop.hive.cli.CliDriver.executeDriver (Clidriver.java:715) at Org.apache.hadoop.hive.cli.CliDriver.run (Clidriver.java:675) at Org.apache.hadoop.hive.cli.CliDriver.main (Clidriver.java:615) at Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at Sun.reflect.NativeMethodAccessorImpl.invoke (Nativemethodaccessorimpl.java:57) at Sun.reflect.DelegatingMethodAccessorImpl.invoke (Delegatingmethodaccessorimpl.java:43) at Java.lang.reflect.Method.invoke (Method.java:30S) at Org.apache.hadoop.util.RunJar.run (Runjar.java:221) at Org.apache.hadoop.util.RunJar.main (Runjar.java:136)
For this error, many people do this by replacing the JLine in Hadoop/share/hadoop/yarn/lib with a higher version, such as 2.x in hive
1.Delete JLine from the Hadoop Lib directory (it's only pulled in transitively from ZooKeeper). 2.export HADOOP_USER_CLASSP Ath_first=True
But after I replaced, or error, and later changed a lower version of the HIve-1.0.1, it is good, so if the above error is not necessarily a jar problem, it may be a version problem.
: http://mirrors.hust.edu.cn/apache/hive/hive-1.0.1/apache-hive-1.0.1-bin.tar.gz
2.2 Configure hive2.2.1 Copy one copy of hive-env.sh, set hadoop_home2.2.2 copy of a hive-site.xml
Mainly modify the following parameters
< Property> <name>Javax.jdo.option.ConnectionURL</name> <value>Jdbc:mysql://localhost:3306/hive</value> </ Property> < Property> <name>Javax.jdo.option.ConnectionDriverName</name> <value>Com.mysql.jdbc.Driver</value> </ Property>< Property> <name>Javax.jdo.option.ConnectionPassword</name> <value>Hive</value> </ Property> < Property> <name>Hive.hwi.listen.port</name> <value>9999</value> <Description>This is the port the Hive Web Interface would listen on</descript Ion> </ Property> < Property> <name>Datanucleus.autocreateschema</name> <value>True</value> </ Property> < Property> <name>Datanucleus.fixeddatastore</name> <value>False</value> </ Property> </ Property> < Property> <name>Javax.jdo.option.ConnectionUserName</name> <value>Hive</value> <Description>Username to use against Metastore database</Description> </ Property> < Property> <name>Hive.exec.local.scratchdir</name> <value>/home/hdpsrc/hive/iotmp</value> <Description>Local scratch space for Hive jobs</Description> </ Property> < Property> <name>Hive.downloaded.resources.dir</name> <value>/home/hdpsrc/hive/iotmp</value> <Description>Temporary local directory for added resources in the remote file system.</Description> </ Property> < Property> <name>Hive.querylog.location</name> <value>/home/hdpsrc/hive/iotmp</value> <Description>Location of Hive run time structured log file</Description> </ Property>
2.3 Copying a copy of hive-log4j.properties
Here I just set the path of the log file
2.4 Create the relevant folder, that is, set in 2.2 of the 2.5 in HDFs to establish the relevant folders
$HADOOP _home/bin/hadoop FS-mkdir /tmp $HADOOP _home/bin/hadoop FS- mkdir /user/hive/Warehouse $HADOOP _home/bin/hadoop FS-chmod g+w /tmp $HADOOP _home/bin/hadoop FS-chmod g+w /user/hive/warehouse
2.3 Installing MySQL
Because the relational database here is MySQL, you need to install MySQL and create a new database with the new hive user configured above.
Install MySQL reference: http://www.cnblogs.com/liuchangchun/p/4099003.html
New User reference: Http://www.cnblogs.com/liuchangchun/p/4431426.html
Because the encoding was set to UTF8 after installing MySQL, the following error was reported when starting hive:
long; Max key length is 767 bytes
This error requires modifying the encoding of the hive database:
Alter Database character set latin1;
2.4 Copy the MySQL drive jar package to Hive/lib below
If you do not copy, you will get an error: Cannot find the jar package
caused by:org.datanucleus.store.rdbms.connectionpool.DatastoreDriverNotFoundException:The specified datastore Driver ("Com.mysql.jdbc.Driver") was wasn't found in theCLASSPATH. Please check your CLASSPATH specification, and the name of the driver. At Org.datanucleus.store.rdbms.connectionpool.AbstractConnectionPoolFactory.loadDriver ( Abstractconnectionpoolfactory.java:+ +) at Org.datanucleus.store.rdbms.connectionpool.BoneCPConnectionPoolFactory.createConnectionPool ( Bonecpconnectionpoolfactory.java:si) at Org.datanucleus.store.rdbms.ConnectionFactoryImpl.generateDataSources (Connectionfactoryimpl.java:238) More
2.5 Starting Hive
Make sure HDFs is up before you start.
At the command line execute: Hive, you can enter the Hive command line interface, if there is no error, congratulations, OK.
If HDFs is not up, then the error may be ...
Reference:
Https://cwiki.apache.org/confluence/display/Hive/GettingStarted#GettingStarted-InstallationandConfiguration
http://blog.csdn.net/an342647823/article/details/46048403
http://blog.csdn.net/keljony/article/details/43371995
http://sunjia-704471770-qq-com.iteye.com/blog/1631430
http://blog.csdn.net/jdplus/article/details/46493553
Ubuntu 14.10 under Hive configuration