Introduction to Hive and what it is to install hive
Hive is a data warehouse that uses SQL scripts to
Hive contains several engines
Interpreter, compiler, optimizer, etc.
Contact Hive
First we go into the appropriate official document, the command to contact Hive uses https://cwiki.apache.org/confluence/display/Hive/LanguageManual
Then we open the command line mode
Usage:hive
-d,--define <key=value> Variable substitution to apply to hiveCommands. e.g.-D a=b or--define a=b-e <quoted-query-string> SQL from command line-F <filename> SQL from Files- H,--help Print Help information-h connecting to Hive Server on remote host--hiveconf <property=value> use value for given property--hivevar <key=value> Variable substitution to apply to hiveCommands. e.g.--hivevar a=b-I <filename> initialization SQL file-p <port> connecting to Hive Server on port number- S,--silent silent mode in interactive shell-v,--verbose verbose mode (echo executed SQL to theConsole
This SQL is not the SQL used in our database but the SQL in hive is just like the SQL in the database
Start Installing Hive
Install Hadoop.
First we have to install Hadoop before we can.
Installing Hive
Unzip my hive compression pack
Building a soft chain
To configure
Hive-default.xml.template copy it, change the name to Hive-site.xml.
We have to configure the environment variables for Hadoop.
Modify the corresponding Hive-site.xml file after you have finished with it.
Since we are using hive1.2 relatively new, please refer to starting hive error 2
Use hive, please.
Abnormal:
1. Report abnormal when starting hive
ExceptioninchThread"Main"Java. Lang. RuntimeException: Java. Lang. IllegalArgumentException: Java. NET. URISyntaxException: Relative PathinchAbsolute URI: ${system:java. IO. Tmpdir%7d/$%7Bsystem:user. Name%7D at org. Apache. Hadoop. Hive. QL. Session. sessionstate. Start(sessionstate. Java:522) at Org. Apache. Hadoop. Hive. CLI. Clidriver. Run(Clidriver. Java:677) at Org. Apache. Hadoop. Hive. CLI. Clidriver. Main(Clidriver. Java:621) at Sun. Reflect. Nativemethodaccessorimpl. Invoke0 (Native Method) at Sun. Reflect. Nativemethodaccessorimpl. Invoke(Nativemethodaccessorimpl. Java: $) at Sun. Reflect. Delegatingmethodaccessorimpl. Invoke(Delegatingmethodaccessorimpl. Java: +) at Java. Lang. Reflect. Method. Invoke(Method. Java:606) at Org. Apache. Hadoop. Util. Runjar. Main(Runjar. Java:212) caused By:java. Lang. IllegalArgumentException: Java. NET. URISyntaxException: Relative PathinchAbsolute URI: ${system:java. IO. Tmpdir%7d/$%7Bsystem:user. Name%7D at org. Apache. Hadoop. FS. Path. Initialize(Path. Java:206) at Org. Apache. Hadoop. FS. Path.<init> (Path. Java:172) at Org. Apache. Hadoop. Hive. QL. Session. sessionstate. Createsessiondirs(sessionstate. Java:563) at Org. Apache. Hadoop. Hive. QL. Session. sessionstate. Start(sessionstate. Java:508) ...7Morecaused By:java. NET. URISyntaxException: Relative PathinchAbsolute URI: ${system:java. IO. Tmpdir%7d/$%7Bsystem:user. Name%7D at Java. NET. URI. Checkpath(URI. Java:1804) at Java. NET. URI.<init> (URI. Java:752) at Org. Apache. Hadoop. FS. Path. Initialize(Path. Java:203) ...TenMore
Workaround:
The solution is as follows:
1. View the Hive-site.xml configuration and see the configuration value with "System:java.io.tmpdir" configured
2. Create a new folder/home/grid/hive-0.14.0-bin/iotmp
3. Change the value of the configuration item containing "System:java.io.tmpdir" to the address above
Launch Hive, Success!
2. Start Hive times error 2
[ERROR] Terminal initialization failed; falling back to unsupportedJava.lang.IncompatibleClassChangeError:Found class JLine. Terminal, but interface is 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. Setupconsolereader(Clidriver. Java:787) at Org. Apache. Hadoop. Hive. CLI. Clidriver. Executedriver(Clidriver. Java:721) at Org. Apache. Hadoop. Hive. CLI. Clidriver. Run(Clidriver. Java:681) at Org. Apache. Hadoop. Hive. CLI. Clidriver. Main(Clidriver. Java:621) at Sun. Reflect. Nativemethodaccessorimpl. Invoke0 (Native Method) at Sun. Reflect. Nativemethodaccessorimpl. Invoke(Nativemethodaccessorimpl. Java: $) at Sun. Reflect. Delegatingmethodaccessorimpl. Invoke(Delegatingmethodaccessorimpl. Java: +) at Java. Lang. Reflect. Method. Invoke(Method. Java:606) at Org. Apache. Hadoop. Util. Runjar. Main(Runjar. Java:212) ExceptioninchThread"Main"Java. Lang. Incompatibleclasschangeerror: Found class JLine. Terminal, but interface is expected at JLine. Console. Consolereader.<init> (Consolereader. Java: the) at JLine. Console. Consolereader.<init> (Consolereader. Java:221) at JLine. Console. Consolereader.<init> (Consolereader. Java:209) at Org. Apache. Hadoop. Hive. CLI. Clidriver. Setupconsolereader(Clidriver. Java:787) at Org. Apache. Hadoop. Hive. CLI. Clidriver. Executedriver(Clidriver. Java:721) at Org. Apache. Hadoop. Hive. CLI. Clidriver. Run(Clidriver. Java:681) at Org. Apache. Hadoop. Hive. CLI. Clidriver. Main(Clidriver. Java:621) at Sun. Reflect. Nativemethodaccessorimpl. Invoke0 (Native Method) at Sun. Reflect. Nativemethodaccessorimpl. Invoke(Nativemethodaccessorimpl. Java: $) at Sun. Reflect. Delegatingmethodaccessorimpl. Invoke(Delegatingmethodaccessorimpl. Java: +) at Java. Lang. Reflect. Method. Invoke(Method. Java:606) at Org. Apache. Hadoop. Util. Runjar. Main(Runjar. Java:212)
Workaround:
The reason is that the old version of JLine exists in the Hadoop directory:
/hadoop-2.5.2/share/hadoop/yarn/lib:
-rw-r–r–1 root root 87325 Mar 18:10 Jline-0.9.94.jar
The workaround is to:
Copy the new version of JLine's jar package under Hive to Hadoop:
Cp/hive/apache-hive-1.1.0-bin/lib/jline-2.12.jar./
/hadoop-2.5.2/share/hadoop/yarn/lib:
-rw-r–r–1 root root 87325 Mar 18:10 Jline-0.9.94.jar.bak
-rw-r–r–1 root root 213854 Mar 22:22 Jline-2.12.jar
Http://www.mamicode.com/info-detail-516526.html
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
"Hadoop" 15, Hive Installation