Hive Installation (hadoop2.6.0 hive 1.2.1)Website address: http://hive.apache.org/downloads.html
three different modesInline mode: Metadata is kept in the inline derby mode, allowing only one session to connect to local standalone mode: Install MySQL locally, bar metadata in MySQL remote mode: Meta data placed in remote MySQL database
1. Embedded mode:
(1), modify/home/lin/hadoop/apache-hive-1.2.1-bin/bin/hive-config.sh Add Java environment variables:
Export java_home=/usr/soft/jdk1.7.0_79
Export hadoop_home=/home/lin/hadoop/hadoop-2.6.1 Export Hive_home=/home/lin/hadoop/apache-hive-1.2.1-bin
(2), edit hive-site.xml (/home/lin/hadoop/apache-hive-1.2.1-bin/conf/hive-default.xml.template copy to Hive-site.xml)
Modify the following parameters:
The specified directory on the Hive.metastore.warehouse.dir HDFs
Temporary files directory on Hive.exec.scratchdir HDFs
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
</property>
<property>
<name>hive.exec.scratchdir</name>
<value>/tmp/hive</value>
</property>
<property>
<name>hive.server2.logging.operation.log.location</name>
<value>/tmp/hive/operation_logs</value>
<description>top level directory where operation logs are stored if logging functionality is Enabled</description >
</property>
<property>
<name>hive.exec.local.scratchdir</name>
<value>/tmp/hive</value>
<description>local Scratch spaces for Hive jobs</description>
</property>
<property>
<name>hive.downloaded.resources.dir</name>
<value>/tmp/hive/resources</value>
<description>temporary Local directory for added the remote file system.</description>
</property>
(3), configure Hive log4j:conf CP hive-log4j.properties.template hive-log4j.properties
#log4j. Appender.eventcounter=org.apache.hadoop.hive.shims.hiveeventcounter
Log4j.appender.eventcounter=org.apache.hadoop.log.metrics.eventcounter
Otherwise there will be a warning: WARN conf. Hiveconf:hiveconf of name hive.metastore.local does not exist
WARNING:org.apache.hadoop.metrics.jvm.EventCounter is deprecated. Please use Org.apache.hadoop.log.metrics.EventCounter in the log4j.properties files.
(4), start hive bin/hive
Error encountered at startup: [ERROR] Terminal initialization failed; Falling back to unsupported Java.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) & nbsp 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) & nbsp at Sun.reflect.NativeMethodAccessorImpl.invoke (nativemethodaccessorimpl.java:57) & nbsp at Sun.reflect.DelegatingMethodAccessorImpl.invoke (delegatingmethodaccessorimpl.java:43) at Java.lang.reflect.Method.invoke (method.java:606) at Org.apache.hadoop.util.RunJar.run (runjar.java:221) at Org.apache.hadoop.util.RunJar.main (runjar.java:136)
Found that JLine has problems, and finally found, the original Hadoop inside is jline0.0.94 hive inside is jline2.12 put/home/lin/hadoop/apache-hive-1.2.1-bin/lib The inside jline2.12 replaces the/home/lin/hadoop/hadoop-2.6.1/share/hadoop/yarn/lib jline0.0.94 in Hadoop to succeed.
2. Independent mode
Set up accounts for hive in MySQL and grant sufficient privileges, such as hive account number, grant all privileges login MySQL with above account, create database, such as name Hive, for storing hive metadata to install MySQL client locally Configure Hive-site.xml, indicating the use of the local MySQL database, as well as connection agreements, accounts, passwords, etc. mysql-connector-java.jar copy to the hive Lib directory to start hive can enter the shell to represent success
(1), install MySQL and start the service
Networking installation:
sudo apt-get install CMake
sudo apt-get install Libncurses5-dev
1. sudo apt-get install mysql-server 2. sudo apt-get isntall mysql-client 3. sudo apt-get install Libmysqlclient-dev
To see if the installation was successful:
sudo netstat-tap | grep MySQL
After checking with the above command, if you see a socket with MySQL in listen state, the installation is successful.
Login to MySQL Database
Mysql-u root-p
To create a database:
1) Build database: Create DATABASE hivedb;
2 Build the user, empower: Grant all privileges on *.* to hivedb@ "%" identified by "Hivedb" with GRANT option;
3 Delete database: Drop DB hivedb;
View MySQL version
Mysqladmin-u root-p Version
To view a database:
show databases;
View the current character set:
Show variables like ' character% ';
Stop MySQL:
sudo service MySQL stop
Start MySQL:
sudo service MySQL start
**************************************************************
Start MySQL: Use the command to try to connect to MySQL