orchestracities / ngsi-timeseries-api

QuantumLeap: a FIWARE Generic Enabler to support the usage of NGSIv2 (and NGSI-LD experimentally) data in time-series databases
https://quantumleap.rtfd.io/
MIT License
38 stars 49 forks source link

crate-export script - Connection refused #553

Closed diego-gv closed 3 years ago

diego-gv commented 3 years ago

Describe the problem I have a CrateDB deployed with ports 4200 and 4300 accessible and an mttest.etnoiselevelobserved table with about 100 rows.

When running the script it gives a connection error. I have tried to specify all the parameters explicitly.

Command and result

$ python3.6 crate-export.py --schema mttest --table etnoiselevelobserved
Traceback (most recent call last):
  File "crate-export.py", line 379, in <module>
    run()
  File "crate-export.py", line 362, in run
    query_results = CrateClient().run(query)
  File "crate-export.py", line 340, in run
    self._conn.request('POST', '/_sql?types', body, headers)
  File "/usr/lib/python3.6/http/client.py", line 1287, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1333, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1282, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1042, in _send_output
    self.send(msg)
  File "/usr/lib/python3.6/http/client.py", line 980, in send
    self.connect()
  File "/usr/lib/python3.6/http/client.py", line 952, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib/python3.6/socket.py", line 724, in create_connection
    raise err
  File "/usr/lib/python3.6/socket.py", line 713, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

Thanks,

chicco785 commented 3 years ago

the script is not well maintained, since it used ad-hoc. my first guess is that with new versions of crate asks for user, and this is not passed now. if you are decent at python, that's a 5 minutes fix, and we welcome a pr.

diego-gv commented 3 years ago

I'm using Crate version 3.3

I will test it and if the error is fixed I will do a PR.

Thanks.

chicco785 commented 3 years ago

I'm using Crate version 3.3

I will test it and if the error is fixed I will do a PR.

Thanks.

mmm, with crate 3.3 should not be an issue, is the host configured?

        p.add_argument('--host', type=ne, required=False,
                       default='localhost',
                       help='Hostname of the Crate server')
diego-gv commented 3 years ago

Hello, it's already fixed. It seems that there was a problem with the Docker network, so after restarting the docker daemon the script works correctly.

Thanks and I close issue.