<?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: UNIX sudo with beeline is not working. in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/UNIX-sudo-with-beeline-is-not-working/m-p/289229#M214121</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/73892"&gt;@S_Waseem&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I tried to insert the following statement to my hive table customer using your approach and it worked with a slight modification in your command.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Insert into customer values (5000, "CustFive", "BRN");&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So can you please check and compare it with your command?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Changes:&lt;/STRONG&gt;&lt;BR /&gt;Using the sudo approach which you mentioned by supplying the username and password to beeline using &lt;EM&gt;&lt;STRONG&gt;-n and -p options&lt;/STRONG&gt;&lt;/EM&gt; as following. The values in &lt;EM&gt;&lt;STRONG&gt;quotation mark&lt;/STRONG&gt;&lt;/EM&gt; were changed from "CustFive" to \"CustFive\" as they are surrounded by the -c " statement"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Example Output:&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[root@newhwx1 ~]# export user_hive=hive

[root@newhwx1 ~]# echo ${user_hive}
hive

[root@newhwx1 ~]# sudo su - ${user_hive} -c "beeline -n hive -p hive -u 'jdbc:hive2://newhwx1.example.com:2181,newhwx2.example.com:2181,newhwx3.example.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2' -e 'insert into customer values (5000, \"CustFive\", \"BRN\")'"


Connecting to 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
INFO : Tez session hasn't been created yet. Opening session
INFO : Dag name: insert into customer values (5000, ..."BRN")(Stage-1)
INFO : Status: Running (Executing on YARN cluster with App id application_1579040432494_27933)

INFO : Loading data to table default.customer from hdfs://My-NN-HA/apps/hive/warehouse/customer/.hive-staging_hive_2020-02-05_22-12-33_107_183476754828623767-2/-ext-10000
--------------------------------------------------------------------------------
VERTICES STATUS TOTAL COMPLETED RUNNING PENDING FAILED KILLED
--------------------------------------------------------------------------------
Map 1 .......... SUCCEEDED 1 1 0 0 0 0
--------------------------------------------------------------------------------
VERTICES: 01/01 [==========================&amp;gt;&amp;gt;] 100% ELAPSED TIME: 6.46 s 
--------------------------------------------------------------------------------
INFO : Table default.customer stats: [numFiles=5, numRows=5, totalSize=90, rawDataSize=85]
No rows affected (22.328 seconds)
Beeline version 1.2.1000.2.6.5.0-292 by Apache Hive
Closing: 0: jdbc:hive2://newhwx1.example.com:2181,newhwx2.example.com:2181,newhwx3.example.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Output of "select * from customer" later.&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[root@newhwx1 ~]# sudo su - ${user_hive} -c "beeline -n hive -p hive -u 'jdbc:hive2://newhwx1.example.com:2181,newhwx2.example.com:2181,newhwx3.example.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2' -e 'select * from customer'"


Connecting to 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
+------------------+--------------------+----------------+--+
| customer.custid | customer.custname | customer.city |
+------------------+--------------------+----------------+--+
| 1000 | CustOne | BLR |
| 2000 | CustTwo | PUNE |
| 3000 | CustThree | HYD |
| 4000 | CustFour | NSW |
| 5000 | CustFive | BRN |
+------------------+--------------------+----------------+--+
5 rows selected (1.108 seconds)
Beeline version 1.2.1000.2.6.5.0-292 by Apache Hive
Closing: 0: jdbc:hive2://newhwx1.example.com:2181,newhwx2.example.com:2181,newhwx3.example.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 05 Feb 2020 22:20:01 GMT</pubDate>
    <dc:creator>jsensharma</dc:creator>
    <dc:date>2020-02-05T22:20:01Z</dc:date>
    <item>
      <title>UNIX sudo with beeline is not working.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/UNIX-sudo-with-beeline-is-not-working/m-p/289192#M214100</link>
      <description>&lt;P&gt;sudo su - ${user} -c "beeline -u 'jdbc:hive2://server:port,connectionstring' -e 'insert statement'; "&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;above line works fine if I take out sudo, with sudo it doesnt work, any help or advice is much appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2020 14:50:22 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/UNIX-sudo-with-beeline-is-not-working/m-p/289192#M214100</guid>
      <dc:creator>S_Waseem</dc:creator>
      <dc:date>2020-02-05T14:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: UNIX sudo with beeline is not working.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/UNIX-sudo-with-beeline-is-not-working/m-p/289229#M214121</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/73892"&gt;@S_Waseem&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I tried to insert the following statement to my hive table customer using your approach and it worked with a slight modification in your command.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Insert into customer values (5000, "CustFive", "BRN");&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So can you please check and compare it with your command?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Changes:&lt;/STRONG&gt;&lt;BR /&gt;Using the sudo approach which you mentioned by supplying the username and password to beeline using &lt;EM&gt;&lt;STRONG&gt;-n and -p options&lt;/STRONG&gt;&lt;/EM&gt; as following. The values in &lt;EM&gt;&lt;STRONG&gt;quotation mark&lt;/STRONG&gt;&lt;/EM&gt; were changed from "CustFive" to \"CustFive\" as they are surrounded by the -c " statement"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Example Output:&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[root@newhwx1 ~]# export user_hive=hive

[root@newhwx1 ~]# echo ${user_hive}
hive

[root@newhwx1 ~]# sudo su - ${user_hive} -c "beeline -n hive -p hive -u 'jdbc:hive2://newhwx1.example.com:2181,newhwx2.example.com:2181,newhwx3.example.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2' -e 'insert into customer values (5000, \"CustFive\", \"BRN\")'"


Connecting to 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
INFO : Tez session hasn't been created yet. Opening session
INFO : Dag name: insert into customer values (5000, ..."BRN")(Stage-1)
INFO : Status: Running (Executing on YARN cluster with App id application_1579040432494_27933)

INFO : Loading data to table default.customer from hdfs://My-NN-HA/apps/hive/warehouse/customer/.hive-staging_hive_2020-02-05_22-12-33_107_183476754828623767-2/-ext-10000
--------------------------------------------------------------------------------
VERTICES STATUS TOTAL COMPLETED RUNNING PENDING FAILED KILLED
--------------------------------------------------------------------------------
Map 1 .......... SUCCEEDED 1 1 0 0 0 0
--------------------------------------------------------------------------------
VERTICES: 01/01 [==========================&amp;gt;&amp;gt;] 100% ELAPSED TIME: 6.46 s 
--------------------------------------------------------------------------------
INFO : Table default.customer stats: [numFiles=5, numRows=5, totalSize=90, rawDataSize=85]
No rows affected (22.328 seconds)
Beeline version 1.2.1000.2.6.5.0-292 by Apache Hive
Closing: 0: jdbc:hive2://newhwx1.example.com:2181,newhwx2.example.com:2181,newhwx3.example.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Output of "select * from customer" later.&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[root@newhwx1 ~]# sudo su - ${user_hive} -c "beeline -n hive -p hive -u 'jdbc:hive2://newhwx1.example.com:2181,newhwx2.example.com:2181,newhwx3.example.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2' -e 'select * from customer'"


Connecting to 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
+------------------+--------------------+----------------+--+
| customer.custid | customer.custname | customer.city |
+------------------+--------------------+----------------+--+
| 1000 | CustOne | BLR |
| 2000 | CustTwo | PUNE |
| 3000 | CustThree | HYD |
| 4000 | CustFour | NSW |
| 5000 | CustFive | BRN |
+------------------+--------------------+----------------+--+
5 rows selected (1.108 seconds)
Beeline version 1.2.1000.2.6.5.0-292 by Apache Hive
Closing: 0: jdbc:hive2://newhwx1.example.com:2181,newhwx2.example.com:2181,newhwx3.example.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2020 22:20:01 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/UNIX-sudo-with-beeline-is-not-working/m-p/289229#M214121</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2020-02-05T22:20:01Z</dc:date>
    </item>
    <item>
      <title>Re: UNIX sudo with beeline is not working.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/UNIX-sudo-with-beeline-is-not-working/m-p/289301#M214161</link>
      <description>&lt;P&gt;Hello Sir,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It worked... thank you so much!!!&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 19:25:25 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/UNIX-sudo-with-beeline-is-not-working/m-p/289301#M214161</guid>
      <dc:creator>S_Waseem</dc:creator>
      <dc:date>2020-02-06T19:25:25Z</dc:date>
    </item>
  </channel>
</rss>

