'thrift.transport.TTransport.TTransportException: Could not connect to any of [port , 10000] PyHive

I am having issues with my python code. When I run my code. It says

[2022-02-11 09:58:28,740] ERROR in app: Exception on /process_file [POST]
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1518, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.6/dist-packages/flask_cors/extension.py", line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/usr/local/lib/python3.6/dist-packages/flask_restful/__init__.py", line 271, in error_router
    return original_handler(e)
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1502, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/usr/local/lib/python3.6/dist-packages/flask_cors/decorator.py", line 128, in wrapped_function
    resp = make_response(f(*args, **kwargs))
  File "apicall-backup.py", line 1746, in process_file
    create_tmp_table(res['file_path'], table_name,res['file_delimiter'],filename)
  File "apicall-backup.py", line 187, in create_tmp_table
    conn = hive.Connection(host=str(config.hive_host), port=int(config.hive_port), username=str(config.hive_username))
  File "/usr/local/lib/python3.6/dist-packages/pyhive/hive.py", line 243, in __init__
    self._transport.open()
  File "/usr/local/lib/python3.6/dist-packages/thrift_sasl/__init__.py", line 74, in open
    self._trans.open()
  File "/usr/local/lib/python3.6/dist-packages/thrift/transport/TSocket.py", line 146, in open
    raise TTransportException(type=TTransportException.NOT_OPEN, message=msg)
thrift.transport.TTransport.TTransportException: Could not connect to any of [('port', 10000)]
10.2.2.200 - - [11/Feb/2022 09:58:28] "POST /process_file HTTP/1.1" 500 -

I have looked around for a solution to find whether hive is running or not? I found it to be running. I used beeline to access hive. applied some commands. the commands were responded properly. here is a screenshot

Screenshot 01

At a place I read that, this error may occur due to Zookeeper service failure. I tried that too and the results are as follows.

enter image description here

Any help in this regard!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source