- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Run HIVE queries in command shell (cmd), not in Ambari Hive View
- Labels:
-
Apache Ambari
-
Apache Hive
Created ‎11-27-2017 10:14 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have installed Ambari and I can use Hive View 2.0 for executing Hive Queries. Due to my hardware issues (less RAM), Ambari server is very slow sometimes. For this reason, I wana run Hive queries in a command shell not in Hive View in Ambari. Is it possible? If so, how is it possible?
I would appreciate any help.
Created ‎11-28-2017 01:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Mike Bit
If you want to use a CLI to access Hive, the recommend client tool to use is called beeline. It is normally included in the client tools installation, so you probably already have it ready to go. From your client tools machine/host/server, you will use the beeline client to connect to the HiveServer2 JDBC URL, and everything from there is the usual SQL commands.
In Ambari, you can easily copy the HiveServer2 JDBC URL directly from the Hive service config screen, and paste it right into a beeline connect string. So for example, if my machines were ssahi[0-2].hortonworks.com, where I was running ZooKeeper, and I was using hive/hive as the user/password, my beeline command to open the client and connect to Hive may look like:
beeline -u "jdbc:hive2://ssahi1.hortonworks.com:2181,ssahi0.hortonworks.com:2181,ssahi2.hortonworks.com:2181/;ServiceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2" -n hive -p hive
You can find more on Beeline from the project documentation here, including example syntax, and config to have things display nicer, etc:
Created ‎11-28-2017 01:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Mike Bit
If you want to use a CLI to access Hive, the recommend client tool to use is called beeline. It is normally included in the client tools installation, so you probably already have it ready to go. From your client tools machine/host/server, you will use the beeline client to connect to the HiveServer2 JDBC URL, and everything from there is the usual SQL commands.
In Ambari, you can easily copy the HiveServer2 JDBC URL directly from the Hive service config screen, and paste it right into a beeline connect string. So for example, if my machines were ssahi[0-2].hortonworks.com, where I was running ZooKeeper, and I was using hive/hive as the user/password, my beeline command to open the client and connect to Hive may look like:
beeline -u "jdbc:hive2://ssahi1.hortonworks.com:2181,ssahi0.hortonworks.com:2181,ssahi2.hortonworks.com:2181/;ServiceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2" -n hive -p hive
You can find more on Beeline from the project documentation here, including example syntax, and config to have things display nicer, etc:
