SHARE
TWEET

Untitled

a guest Jan 26th, 2019 108 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Initialize schema
  2. # schematool –dbType <db_type> -initSchema
  3. To start Hive server (note that we don’t do it in our virtual machines, skip to Hive CLI)
  4. # hiveserver2 &
  5. It will start Hive server. As we configured metastore as local, it will also instantiate a Derby instance for metastore
  6. # ls /root/opt/data/hive/metastore_db
  7.  
  8. Hive CLI
  9.  
  10. Start Hive CLI
  11. # hive
  12. hive >
  13. Hive 2 uses Beeline as CLI
  14. # beeline –u jdbc:hive2://localhost:10000
  15. 0: jdbc:hive2://localhost:10000>
  16.  
  17. Silent mode
  18. # hive -S -e "SELECT * FROM mytable"
  19. something
  20. Output to file
  21. # hive -S -e "SELECT * FROM mytable" > output.txt
  22. # cat output.txt
  23. Run query from file
  24. # hive -S -f /path/to/hive.sql
  25. something
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top