<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Connect to Hive with UNIX/HDFS user via beeline in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Connect-to-Hive-with-UNIX-HDFS-user-via-beeline/m-p/216391#M81758</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/92158/neagamaxim.html" nodeid="92158" target="_blank"&gt;@Maxim
 Neaga
&lt;/A&gt;&lt;/P&gt;&lt;P&gt;What error are you gettin while connecting to hive using beeling? &lt;/P&gt;&lt;P&gt;Are you sure that the URL which you entered is correct... Becaue looks like you are trying to connect to MySQL database instead of hiveServer2.&lt;/P&gt;&lt;P&gt;Following is what i tried:&lt;/P&gt;&lt;PRE&gt;# useradd test
# usermod -G hadoop test
# su - hdfs -c "hdfs dfs -mkdir /user/test"
# su - hdfs -c "hdfs dfs -chown -R test:hadoop /user/test"
&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;The connect to Beeline using test user:&lt;/P&gt;&lt;PRE&gt;# su - test
$ beeline
Beeline version 1.2.1000.2.6.5.0-292 by Apache Hive
beeline&amp;gt; !connect jdbc:hive2://newhwx1.example.com:2181,newhwx2.example.com:2181,newhwx3.example.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2
&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;Execute queries:&lt;/P&gt;&lt;PRE&gt;beeline&amp;gt; !connect jdbc:hive2://newhwx1.example.com:2181,newhwx2.example.com:2181,newhwx3.example.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2


Connecting to jdbc:hive2://newhwx1.example.com:2181,newhwx2.example.com:2181,newhwx3.example.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2
Enter username for jdbc:hive2://newhwx1.example.com:2181,newhwx2.example.com:2181,newhwx3.example.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2: 
Enter password for jdbc:hive2://newhwx1.example.com:2181,newhwx2.example.com:2181,newhwx3.example.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2: 
Connected to: Apache Hive (version 1.2.1000.2.6.5.0-292)
Driver: Hive JDBC (version 1.2.1000.2.6.5.0-292)
Transaction isolation: TRANSACTION_REPEATABLE_READ


0: jdbc:hive2://newhwx1.example.com:2181,newh&amp;gt; show databases;
+----------------+--+
| database_name  |
+----------------+--+
| default        |
+----------------+--+
1 row selected (0.627 seconds)&lt;/PRE&gt;&lt;P&gt;Here the URL needs to be correct. For example in above case i am connecting to HiveServer2 using the Zookeepre quorum which i found in the Ambari Hive Summary page.&lt;/P&gt;&lt;PRE&gt;jdbc:hive2://newhwx1.example.com:2181,newhwx2.example.com:2181,newhwx3.example.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;Hive URL you can get from here in Ambari UI:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="86387-hive-url.png" style="width: 2450px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/16236i41DBFE8189160DA0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="86387-hive-url.png" alt="86387-hive-url.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;</description>
    <pubDate>Sun, 18 Aug 2019 03:09:14 GMT</pubDate>
    <dc:creator>jsensharma</dc:creator>
    <dc:date>2019-08-18T03:09:14Z</dc:date>
    <item>
      <title>Connect to Hive with UNIX/HDFS user via beeline</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Connect-to-Hive-with-UNIX-HDFS-user-via-beeline/m-p/216390#M81757</link>
      <description>&lt;P&gt;How can I connect to Hive with a UNIX/HDFS user via beeline?&lt;/P&gt;&lt;P&gt;Let's say I have a UNIX user named "newuser". I tried the following, but apparently I am doing something wrong.&lt;/P&gt;&lt;PRE&gt;% su - newuser
% beeline
beeline&amp;gt;!connect -n newuser -p jdbc:mysql://my.host.com/hive&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Aug 2018 06:13:20 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Connect-to-Hive-with-UNIX-HDFS-user-via-beeline/m-p/216390#M81757</guid>
      <dc:creator>neagamaxim</dc:creator>
      <dc:date>2018-08-08T06:13:20Z</dc:date>
    </item>
    <item>
      <title>Re: Connect to Hive with UNIX/HDFS user via beeline</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Connect-to-Hive-with-UNIX-HDFS-user-via-beeline/m-p/216391#M81758</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/92158/neagamaxim.html" nodeid="92158" target="_blank"&gt;@Maxim
 Neaga
&lt;/A&gt;&lt;/P&gt;&lt;P&gt;What error are you gettin while connecting to hive using beeling? &lt;/P&gt;&lt;P&gt;Are you sure that the URL which you entered is correct... Becaue looks like you are trying to connect to MySQL database instead of hiveServer2.&lt;/P&gt;&lt;P&gt;Following is what i tried:&lt;/P&gt;&lt;PRE&gt;# useradd test
# usermod -G hadoop test
# su - hdfs -c "hdfs dfs -mkdir /user/test"
# su - hdfs -c "hdfs dfs -chown -R test:hadoop /user/test"
&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;The connect to Beeline using test user:&lt;/P&gt;&lt;PRE&gt;# su - test
$ beeline
Beeline version 1.2.1000.2.6.5.0-292 by Apache Hive
beeline&amp;gt; !connect jdbc:hive2://newhwx1.example.com:2181,newhwx2.example.com:2181,newhwx3.example.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2
&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;Execute queries:&lt;/P&gt;&lt;PRE&gt;beeline&amp;gt; !connect jdbc:hive2://newhwx1.example.com:2181,newhwx2.example.com:2181,newhwx3.example.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2


Connecting to jdbc:hive2://newhwx1.example.com:2181,newhwx2.example.com:2181,newhwx3.example.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2
Enter username for jdbc:hive2://newhwx1.example.com:2181,newhwx2.example.com:2181,newhwx3.example.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2: 
Enter password for jdbc:hive2://newhwx1.example.com:2181,newhwx2.example.com:2181,newhwx3.example.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2: 
Connected to: Apache Hive (version 1.2.1000.2.6.5.0-292)
Driver: Hive JDBC (version 1.2.1000.2.6.5.0-292)
Transaction isolation: TRANSACTION_REPEATABLE_READ


0: jdbc:hive2://newhwx1.example.com:2181,newh&amp;gt; show databases;
+----------------+--+
| database_name  |
+----------------+--+
| default        |
+----------------+--+
1 row selected (0.627 seconds)&lt;/PRE&gt;&lt;P&gt;Here the URL needs to be correct. For example in above case i am connecting to HiveServer2 using the Zookeepre quorum which i found in the Ambari Hive Summary page.&lt;/P&gt;&lt;PRE&gt;jdbc:hive2://newhwx1.example.com:2181,newhwx2.example.com:2181,newhwx3.example.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;Hive URL you can get from here in Ambari UI:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="86387-hive-url.png" style="width: 2450px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/16236i41DBFE8189160DA0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="86387-hive-url.png" alt="86387-hive-url.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 03:09:14 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Connect-to-Hive-with-UNIX-HDFS-user-via-beeline/m-p/216391#M81758</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2019-08-18T03:09:14Z</dc:date>
    </item>
  </channel>
</rss>

