Hive

Hive常用命令

2019-12-15  本文已影响0人  叶逸灵

hive官网:http://hive.apache.org/

基础内容学习:

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
  1. show databases;
  2. create database db_hive;
  3. drop database db_hive;
  4. use db_hive;
  5. show tables;
  6. CREATE TABLE u_data (
    userid INT,
    movieid INT,
    rating STRING,
    unixtime STRING)
    ROW FORMAT DELIMITED
    FIELDS TERMINATED BY ','
    STORED AS TEXTFILE;
  7. load data local inpath '/opt/datas/ratings.txt' into table u_data;
上一篇下一篇

猜你喜欢

热点阅读