Hive Common Commands Collation

Source: Internet
Author: User
Tags mysql query port number

Hive common commands to organize---coco


1. After the row-to-column function is turned on:
Set hive.cli.print.header=true; Print column names
Set hive.cli.print.row.to.vertical=true; Turn on row to column function, if you must turn on the Print column name function
Set hive.cli.print.row.to.vertical.num=1; Set the number of columns to display per row


2. Errors during use:
hive-hiveconf hive.root.logger=debug,console//restart debugging.


3. The three ways to start a hive are different:
1,hive command line mode, enter the/hive/bin/hive execution program directly, or enter the Hive–service CLI
For Linux Platform command-line queries, query statements are basically similar to MySQL query statements
2,hive Web interface Start-up mode, Hive–service HWI
Used to access hive through a browser, it doesn't feel much use
3,hive Remote Service (port number 10000) Start mode, Nohup Hive–service Hiveserver &
Using Java and other programs to access the hive through JDBC and other drivers using this kind of starting mode, this is the most necessary way for programmers
Start HIVE service: $HIVE _home/bin/hive--service hiveserver 10001 >/dev/null 2>/dev/null &

4. Hive insertion in the 2 mode:
Basic Insert Syntax:
INSERT OVERWRITE TABLE tablename [Partiton (Partcol1=val1,partclo2=val2)]select_statement from From_statement
Insert Overwrite table Test_insert select * from test_table;
Insert operations on multiple tables:
From Fromstatte
INSERT OVERWRITE TABLE tablename1 [Partiton (Partcol1=val1,partclo2=val2)]select_statement1
INSERT OVERWRITE TABLE tablename2 [Partiton (Partcol1=val1,partclo2=val2)]select_statement2


5. Add Metastore startup script bin/hive-metastore.sh
#!/bin/sh
Nohup./hive--service metastore >> metastore.log 2>&1 &
Echo $! > Hive-metastore.pid


Add Hive Server Startup script bin/hive-server.sh
Nohup./hive--service hiveserver >> hiveserver.log 2>&1 &
Echo $! > Hive-server.pid


Start Metastore and Hive server
./hive-metastore.sh
./hive-server.sh

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.