Connecting to Hive using Beeline

后端 未结 7 1156
傲寒
傲寒 2020-12-29 06:28

I am trying to connect to hive installed in my machine through Beeline client. when I give the \'beeline\' command & connect to Hive, the client is asking for user name

7条回答
  •  臣服心动
    2020-12-29 06:54

    Accessing HIVE via Beeline:

    Starting beeline client

    beeline --incremental=true
    

    Note: The command line option “—incremental=true” is optional, but will extend the amount of time that you can remain idle and not have your connection dropped.

    Connecting to hive2 server

    !connect jdbc:hive2://silver-server-
    hive.app.google.com:10000/default
    

    Note: You will be prompted for your username & password. USE user name and Password

    beeline> !connect jdbc:hive2:// silver-server-hive.app.google.com:10000/default
    scan complete in 3ms
    Connecting to jdbc:hive2:// silver-server-hive.app.google.com:10000/default
    Enter username for jdbc:hive2:// silver-server-hive.app.google.com:10000/default:suman
    Enter password for jdbc:hive2:// silver-server-hive.app.google.com:10000/default: *********
    

    Setting Your Queue (if any)

    set mapred.job.queue.name=; 
    

    Note: You need to set a queue in order to run queries.

    Setting Your Database

    USE google_map_data;
    

    Note: You should be in a database when executing queries.

    Reconnecting an inactive session

    !reconnect jdbc:hive2:// silver-server-hive.app.google.com:10000/default; 
    

    Quitting beeline client

    !quit
    

    Notes:

    • Loading beeline, the URL and providing your username & password in one command:

    beeline -u jdbc:hive2:// silver-server-hive.app.google.com:10000\ 
    -n  -p  --incremental=true**
    

    Basic Beeline Queries

    Beeline supports a rich set of SQL query functions.

    Getting Information About Data

    SHOW DATABASES;
    USE ;
    
    SHOW TABLES;
    DESC ;
    DESC FORMATTED 
    ;

    Simple limited select statements

    SELECT * FROM google_map_city limit 25;
    

    提交回复
    热议问题