CLI hive

作者: satyrs_sh | 来源:发表于2017-11-04 19:10 被阅读0次
    schematool -dbType mysql -initSchema;
    
    describe formatted test;
    
    create table test (id int,name string) clustered buy(id) into 12 buckets;
    
    create table test(id int,name string,zipcode int) skewed by (zipcode) on (223003,200099) stored as directories;
    
    set hive.exec.mode.local.auto.tasks.max=10;
    
    set hive.cli.print.header = True;
    
    set mapreduce.job.reduces=2;
    
    set mapred.reduce.tasks=<number>;
    
    set hive.cli.print.header=true;
    
    hive -f myscript.hive -hiveconf mapreduce.job.reduces=2;
    
    beeline> !connect jdbc:hive2://myservername1:2181,myhiveservername2:2222/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2
    
    beeline -u url -n username -p pass;
    
    select * from names where age =${age};
    
    hive -f myscript.hive -hivevar age =33;
    
    select /*+MAPJOIN(static)*/ customers.*,states.* from customers join states on(customers.state=states.state);
    
    select a.key from a left outer join b on a.key=b.key where b.key1 is null   --(not in)
    
    set hive.exec.parallel=true;  //打开任务并行执行
    
    set hive.exec.parallel.thread.number=16; //同一个sql允许最大并行度,默认为8。
    
    //更多命令:
    //http://blog.csdn.net/joseph_happy/article/details/50428858
    
    满足如下条件才能真正使用本地模式:
    
    set hive.exec.mode.local.auto=true;  //开启本地mr
    
    //设置local mr的最大输入数据量,当输入数据量小于这个值的时候会采用local  mr的方式
    
    set hive.exec.mode.local.auto.inputbytes.max=50000000;
    
    //设置local mr的最大输入文件个数,当输入文件个数小于这个值的时候会采用local mr的方式
    

    相关文章

      网友评论

          本文标题:CLI hive

          本文链接:https://www.haomeiwen.com/subject/wbkqmxtx.html