title: How to access remote hive using pyhive
body: <p>Used this link to try to connect to a remote hive. Below is the code used. The error msg received is also given below</p>
  
  <p><a href="https://stackoverflow.com/questions/21370431/how-to-access-hive-via-python">How to Access Hive via Python?</a></p>
  
  <p>Code</p>
  
  <pre><code>   from pyhive import hive
      conn = hive.Connection(host="10.111.22.11", port=10000, username="user1" ,database="default")
  </code></pre>
  
  <p>Error msg</p>
  
  <pre><code>Could not connect to any of [('10.111.22.11', 10000)]
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "/opt/anaconda3/lib/python3.6/site-packages/pyhive/hive.py", line 131, in __init__
      self._transport.open()
    File "/opt/anaconda3/lib/python3.6/site-packages/thrift_sasl/__init__.py", line 61, in open
      self._trans.open()
    File "/opt/anaconda3/lib/python3.6/site-packages/thrift/transport/TSocket.py",line 113, in open
      raise TTransportException(TTransportException.NOT_OPEN, msg)
  thrift.transport.TTransport.TTransportException: Could not connect to any of [('10.111.22.11', 10000)]
  </code></pre>
  
  <p>What are the other requirements for successful connection? I am able to connect to the server directly (using putty) and run hive. But when tried from another server X i get this error. Also i can ping the hive server from server X. </p>
  
  <p>Could the port number be the problem? How do i check the correct port number?</p>
  
  <p>As discussed in the below answer i tried to start hiveserver2 . But the command doesnt seem to work. Any help is really appreciated. </p>
  
  <p>Also the port i see in the log when i execute a query from hive shell is <strong>8088</strong>. wonder if this should be the port instead of <strong>10000</strong>(both did not work anyway)</p>