(7-1) hive-0.14.0 installation and command line operation

Source: Internet
Author: User
Tags hdfs dfs log4j



-------------------------------Use the default Derby embedded database, store metastore information, hive decompression can be used: extract: TAR-ZXVF apache-hive-0.14.0-bin.tar.gz Rename: MV Apache-hive-0.14.0-bin hive-0.14.0 View conf folder: Ll-rw-r--r--. 1 Baozi Games 1139 November 9 08:45 beeline-log4j.properties.template-rw-r--r--. 1 Baozi Games 144936 November 9 15:25 hive-default.xml.template-rw-r--r--. 1 Baozi Games 2378 November 9 08:44 hive-env.sh.template-rw-r--r--. 1 Baozi Games 2662 November 9 08:54 hive-exec-log4j.properties.template-rw-r--r--.


1 Baozi Games 3050 November 9 08:45 hive-log4j.properties.template copy a HIVE-ENV.SH:CP hive-env.sh.template hive-env.sh Modify Hive-env.sh:vim hive-env.sh export Hadoop_home=/usr/local/hadoop export JAVA_HOME=/USR/LOCAL/JDK export HIVE_HOME=/ usr/local/hive-0.14.0 boot hive: [root@i-love-you hive-0.14.0]# bin/hive Logging initialized using configuration in Jar:fi Le:/usr/local/hive-0.14.0/lib/hive-common-0.14.0.jar!/hive-log4j.properties Slf4j:class Path contains multiple
SLF4J bindings. Slf4j:found binding in [jar:file:/usr/local/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/ Staticloggerbinder.class] Slf4j:found binding in [jar:file:/usr/local/hive-0.14.0/lib/ Hive-jdbc-0.14.0-standalone.jar!/org/slf4j/impl/staticloggerbinder.class] Slf4j:see http://www.slf4j.org/
Codes.html#multiple_bindings for an explanation. Slf4j:actual binding is of type [org.slf4j.impl.Log4jLoggerFactory] hive> will find one more metastore_db folder: [root@i-love-you H ive-0.14.0]# ll total dosage 420 drwxr-xr-x. 3 root root 4096 April 19:23 bin Drwxr-xr-x. 2 root root 4096 April 19:34 conf-rw-r--r--. 1 root root 20964 April 19:40 derby.log drwxr-xr-x. 4 root root 4096 April 19:23 examples drwxr-xr-x. 7 root root 4096 April 19:23 hcatalog drwxr-xr-x. 4 root root 4096 April 19:23 lib-rw-r--r--. 1 Baozi Games 23828 November 9 08:45 LICENSE drwxr-xr-x. 5 root root 4096 April 19:40 metastore_db-rw-r--r--. 1 Baozi Games 277 November 9 10:37 notice-rw-r--r--. 1 Baozi Games 4048November 9 08:45 readme.txt-rw-r--r--. 1 Baozi Games 340611 November 9 10:35 release_notes.txt drwxr-xr-x.
3 root root 4096 April 19:23 scripts View all databases: hive> show databases;

OK default time taken:1.656 seconds, fetched:1 row (s) hive> Metastore is the central place to store hive metadata.  Metastore defaults to using the built-in Derby database as the storage Engine Derby engine disadvantage: Only one session can be opened at a time using MySQL as an external storage engine, multi-user simultaneous access to open a session started again, an error occurs: caused By:error XSDB6:



Another instance of Derby May has already booted the database/usr/local/hive-0.14.0/metastore_db.


-------------------------------change MySQL to metastore storage engine: Use the database on Windows here: Remember to shut down Windows Firewall when you use it. Copying a copy of HIVE-SITE.XML:CP hive-default.xml.template hive-site-xml configuring MySQL metastore modify $hive_home/conf/hive-site.xml < Property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://192.168.1.1:3306/ hive?createdatabaseifnotexist=true</value> </property> <property> <name> Javax.jdo.option.connectiondrivername</name> <value>com.mysql.jdbc.driver</value> </property> <property> <name> javax.jdo.option.connectionusername</name> <value>root</value> </property> <property > <name>javax.jdo.option.ConnectionPassword</name> <value>mysqladmin</value> </ property> configuration changes for temporary directories $hive_home/conf/hive-site.xml <property> <name>hive.querylog.location</name&
    
	Gt <value>/usr/local/hive-0.14.0/mydate</value> </property> <property> <name>hive.

  
Exec.local.scratchdir</name> <value>/usr/local/hive-0.14.0/mydate</value> </property> <property> <name>hive.downloaded.resources.dir</name> <value>/usr/local/hive-0.14.0/m
Ydate</value> </property> Don't forget to start Hadoop ... [Root@i-love-you hive-0.14.0]# JPS 2473 jobhistoryserver 4021 JPS 2248 DataNode 2418 applicationhistoryserver 2309 ResOurcemanager 2192 NameNode 2363 nodemanager 3845 Runjar First terminal login: [root@i-love-you hive-0.14.0]# bin/hive Logging Initia
lized using configuration in Jar:file:/usr/local/hive-0.14.0/lib/hive-common-0.14.0.jar!/hive-log4j.properties
Slf4j:class path contains multiple slf4j bindings. Slf4j:found Binding in [jar:file:/usr/local/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/ Impl/staticloggerbinder.class] Slf4j:found binding in [jar:file:/usr/local/hive-0.14.0/lib/ Hive-jdbc-0.14.0-standalone.jar!/org/slf4j/impl/staticloggerbinder.class] Slf4j:see http://www.slf4j.org/
Codes.html#multiple_bindings for an explanation.
Slf4j:actual binding is of type [org.slf4j.impl.Log4jLoggerFactory] hive> show databases; OK default time taken:1.48 seconds, fetched:1 row (s) hive> second terminal login: [root@i-love-you hive-0.14.0]# bin/hive Loggi ng initialized using configuration in jar:file:/usr/local/hive-0.14.0/lib/hive-common-0.14.0.jar!/ Hive-log4j.properties Slf4j:class Path conTains multiple SLF4J bindings. Slf4j:found Binding in [jar:file:/usr/local/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/ Impl/staticloggerbinder.class] Slf4j:found binding in [jar:file:/usr/local/hive-0.14.0/lib/ Hive-jdbc-0.14.0-standalone.jar!/org/slf4j/impl/staticloggerbinder.class] Slf4j:see http://www.slf4j.org/
Codes.html#multiple_bindings for an explanation.
Slf4j:actual binding is of type [org.slf4j.impl.Log4jLoggerFactory] hive> show databases; OK default time taken:1.888 seconds, fetched:1 row (s) hive> command-line mode run: CREATE TABLE: hive> Create a table T1 (name string
);
OK time taken:1.134 seconds hive> show tables;
OK T1 time taken:0.066 seconds, fetched:1 row (s) hive> hive> CREATE TABLE t2 (id int);
OK time taken:0.288 seconds hive> drop table T1; Moved: ' Hdfs://192.168.1.10:9000/user/hive/warehouse/t1 ' to trash at:hdfs://192.168.1.10:9000/user/root/. Trash/current OK time taken:30.15 seconds hive> default in directory/user/hive/warehouse, can be in HIVE-default.xml.template Modify Parameter: Hive.metastore.warehouse.dir [root@i-love-you hive-0.14.0]# HDFs dfs-ls/user/hive Found 1 Items drwxr-xr-x-root supergroup 0 2015-04-19 21:00/user/hive/warehouse [root@i-love-you hive-0.14.0]# HDF S dfs-ls-r/user/hive drwxr-xr-x-root supergroup 0 2015-04-19 21:00/user/hive/warehouse drwxr-xr-x-ro OT supergroup 0 2015-04-19 20:59/user/hive/warehouse/t2 [root@i-love-you hive-0.14.0]# Creating database: hive> Create
Database Baozi; OK time taken:0.238 seconds hive> [root@i-love-you hive-0.14.0]# hdfs dfs-ls-r/user/hive drwxr-xr-x-root sup Ergroup 0 2015-04-19 21:03/user/hive/warehouse drwxr-xr-x-root supergroup 0 2015-04-19 21:03/user/ Hive/warehouse/baozi.db drwxr-xr-x-root supergroup 0 2015-04-19 20:59/user/hive/warehouse/t2 [root@i-love-yo





 U hive-0.14.0]#


Table of hive database inside the local MySQL:





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.