Support Questions

Find answers, ask questions, and share your expertise

In Horotonworks sandbox 2.5 how to open HIVE & PIG in command prompt

avatar
New Contributor
 
1 ACCEPTED SOLUTION

avatar
Guru

For Hive, make sure the HiveServer2 service is running (use Ambari) and then use the beeline command line shell: https://cwiki.apache.org/confluence/display/Hive/HiveServer2+Clients

(Note: beeline replaces an older Hive CLI. Beeline is the preferred way moving forward).

For Pig, write your script to a file and then use pig <pigscriptFileName>

See the following for more (including passing parameters, running locally or against hadoop, etc)

http://pig.apache.org/docs/r0.16.0/

https://www.tutorialspoint.com/apache_pig/apache_pig_execution.htm

http://pig.apache.org/docs/r0.16.0/start.html#run

https://community.hortonworks.com/articles/51884/pig-doing-yoga-how-to-build-superflexible-pig-scri....

(For the Pig tutorials http://hortonworks.com/hadoop-tutorial/how-to-use-basic-pig-commands/ you will see pig scripts written in Pig View in Ambari. You can run these on the command line simply by placing them in their own file and run as shown above).

Let me know this is what you are looking for by accepting the answer; else let me know what gaps remain.

View solution in original post

3 REPLIES 3

avatar
Guru

For Hive, make sure the HiveServer2 service is running (use Ambari) and then use the beeline command line shell: https://cwiki.apache.org/confluence/display/Hive/HiveServer2+Clients

(Note: beeline replaces an older Hive CLI. Beeline is the preferred way moving forward).

For Pig, write your script to a file and then use pig <pigscriptFileName>

See the following for more (including passing parameters, running locally or against hadoop, etc)

http://pig.apache.org/docs/r0.16.0/

https://www.tutorialspoint.com/apache_pig/apache_pig_execution.htm

http://pig.apache.org/docs/r0.16.0/start.html#run

https://community.hortonworks.com/articles/51884/pig-doing-yoga-how-to-build-superflexible-pig-scri....

(For the Pig tutorials http://hortonworks.com/hadoop-tutorial/how-to-use-basic-pig-commands/ you will see pig scripts written in Pig View in Ambari. You can run these on the command line simply by placing them in their own file and run as shown above).

Let me know this is what you are looking for by accepting the answer; else let me know what gaps remain.

avatar
Super Collaborator

With the new Sandbox, you should be able to access http://localhost:8888, which will bring you to a to the Sandbox start page. I suggest clicking into the Advanced HDP page. From there you will see a link to a web-based ssh client. You could launch the Pig and Hive command lines clients from there.

avatar
Guru

To fill out the possibilities, in addition to @bhagan access route you can use the shell of your choice and ssh via the command: ssh root@127.0.0.1 -p 2222 in which case you will be prompted for root password.