Hive常用命令
2019-12-15 本文已影响0人
叶逸灵
hive官网:http://hive.apache.org/
基础内容学习:
- https://cwiki.apache.org/confluence/display/Hive/GettingStarted
-
https://cwiki.apache.org/confluence/display/Hive
- DDL主要对库表的操作;DML主要对数据的操作
hive配置
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://bigdata-pro01/metastore?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>123456</value>
</property>
<!--设置显示当前数据库及表列名-->
<property>
<name>hive.cli.print.header</name>
<value>true</value>
</property>
<property>
<name>hive.cli.print.current.db</name>
<value>true</value>
</property>
<!-- hive 通过这个参数与 hbase 集成 -->
<property>
<name>hbase.zookeeper.quorum</name>
<value>bigdata-pro01,bigdata-pro02,bigdata-pro03</value>
</property>
</configuration>
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL
- show databases;
- create database db_hive;
- drop database db_hive;
- use db_hive;
- show tables;
- CREATE TABLE u_data (
userid INT,
movieid INT,
rating STRING,
unixtime STRING)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
STORED AS TEXTFILE; - load data local inpath '/opt/datas/ratings.txt' into table u_data;