ElasticHQ / elasticsearch-HQ

Monitoring and Management Web Application for ElasticSearch instances and clusters.
http://www.elastichq.org
Other
4.96k stars 532 forks source link

Cannot Connect on new Windows Install #338

Closed mleonhard38 closed 6 years ago

mleonhard38 commented 6 years ago

Hey all,

it seems I run into a issue on the connect since Elastic is not running on localhost, after I type in the correct URL I am presented with this;


Arguments: (JSONDecodeError('Expecting value: line 1 column 1 (char 0)',),)
2018-02-15 15:46:45,352          ERROR   elastichq       exceptions._request_wrapper:37          Oops! Something bad happened.
Traceback (most recent call last):
  File "C:\ElasticHQ\elastichq\common\exceptions.py", line 29, in _request_wrapper
    return functor(*args, **kwargs)
  File "C:\ElasticHQ\elastichq\api\clusters.py", line 117, in post
    result = schema.dump(response)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\marshmallow\schema.py", line 436, in dump
    **kwargs
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\marshmallow\marshalling.py", line 147, in serialize
    index=(index if index_errors else None)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\marshmallow\marshalling.py", line 68, in call_and_store
    value = getter_func(data)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\marshmallow\marshalling.py", line 141, in <lambda>
    getter = lambda d: field_obj.serialize(attr_name, d, accessor=accessor)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\marshmallow\fields.py", line 252, in serialize
    return self._serialize(value, attr, obj)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\flask_marshmallow\fields.py", line 158, in _serialize
    return _rapply(self.schema, _url_val, key=attr, obj=obj)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\flask_marshmallow\fields.py", line 107, in _rapply
    for key, value in iteritems(d)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\flask_marshmallow\fields.py", line 107, in <dictcomp>
    for key, value in iteritems(d)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\flask_marshmallow\fields.py", line 110, in _rapply
    return func(d, *args, **kwargs)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\flask_marshmallow\fields.py", line 118, in _url_val
    return val.serialize(key, obj, **kwargs)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\marshmallow\fields.py", line 252, in serialize
    return self._serialize(value, attr, obj)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\flask_marshmallow\fields.py", line 78, in _serialize
    'attribute of {obj!r}'.format(attr_name=attr_name, obj=obj)
AttributeError: 'cluster_name' is not a valid attribute of None
2018-02-15 15:46:45,352          INFO    werkzeug        _internal._log:88       127.0.0.1 - - [15/Feb/2018 15:46:45] "POST /api/clusters/_connect HTTP/1.1" 500 -`
royrusso commented 6 years ago

Can you look further up in the log? There is likely an error with "Unable to create connection".

URL should be in the form of http://DOMAIN:PORT , and obviously the server running ElasticHQ should have access to the Elasticsearch server. You can test that with curl

mleonhard38 commented 6 years ago

Server has access, it‘s running on the same dev machine anyways. Domain entered is http://subdomain.domain:9200

Maybe because of the subdomain?

Roy Russo notifications@github.com schrieb am Do. 15. Feb. 2018 um 17:46:

Can you look further up in the log? There is likely an error with "Unable to create connection".

URL should be in the form of http://DOMAIN:PORT , and obviously the server running ElasticHQ should have access to the Elasticsearch server. You can test that with curl

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ElasticHQ/elasticsearch-HQ/issues/338#issuecomment-365988075, or mute the thread https://github.com/notifications/unsubscribe-auth/AC6m-fUmb2yTr4wdbpq8BIfiRMxLdb4Bks5tVF94gaJpZM4SG9ME .

royrusso commented 6 years ago

Subdomain should be fine. Is there are error/stacktrace further up in the log? The "None" cluster_name implies that HQ could not connect and threw an exception in ConnectionService.py

mleonhard38 commented 6 years ago

Full Logs from Console beyond. Maybe because of SearchGuard? Elastic is secured with Basic Auth.


2018-02-16 09:53:06,676          INFO    sqlalchemy.engine.base.Engine   base._cursor_execute:1254   SELECT CAST('test plain returns' AS VARCHAR(60)) AS anon_1
2018-02-16 09:53:06,676          INFO    sqlalchemy.engine.base.Engine   base._cursor_execute:1255   ()
2018-02-16 09:53:06,676          INFO    sqlalchemy.engine.base.Engine   base._cursor_execute:1254   SELECT CAST('test unicode returns' AS VARCHAR(60)) AS anon_1
2018-02-16 09:53:06,676          INFO    sqlalchemy.engine.base.Engine   base._cursor_execute:1255   ()
2018-02-16 09:53:06,676          INFO    sqlalchemy.engine.base.Engine   base._execute_context:1151      PRAGMA table_info("cluster")
2018-02-16 09:53:06,676          INFO    sqlalchemy.engine.base.Engine   base._execute_context:1154      ()
2018-02-16 09:53:06,801          INFO    werkzeug        _internal._log:88        * Restarting with stat
2018-02-16 09:53:07,536          INFO    sqlalchemy.engine.base.Engine   base._cursor_execute:1254   SELECT CAST('test plain returns' AS VARCHAR(60)) AS anon_1
2018-02-16 09:53:07,536          INFO    sqlalchemy.engine.base.Engine   base._cursor_execute:1255   ()
2018-02-16 09:53:07,536          INFO    sqlalchemy.engine.base.Engine   base._cursor_execute:1254   SELECT CAST('test unicode returns' AS VARCHAR(60)) AS anon_1
2018-02-16 09:53:07,536          INFO    sqlalchemy.engine.base.Engine   base._cursor_execute:1255   ()
2018-02-16 09:53:07,536          INFO    sqlalchemy.engine.base.Engine   base._execute_context:1151      PRAGMA table_info("cluster")
2018-02-16 09:53:07,536          INFO    sqlalchemy.engine.base.Engine   base._execute_context:1154      ()
2018-02-16 09:53:07,661          INFO    werkzeug        _internal._log:88        * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

--- Logging error ---
Traceback (most recent call last):
  File "C:\ElasticHQ\elastichq\service\ConnectionService.py", line 47, in create_connection
    content = json.loads(response.content.decode('utf-8'))
  File "C:\Program Files (x86)\Python36-32\lib\json\__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "C:\Program Files (x86)\Python36-32\lib\json\decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Program Files (x86)\Python36-32\lib\json\decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files (x86)\Python36-32\lib\logging\__init__.py", line 992, in emit
    msg = self.format(record)
  File "C:\Program Files (x86)\Python36-32\lib\logging\__init__.py", line 838, in format
    return fmt.format(record)
  File "C:\Program Files (x86)\Python36-32\lib\logging\__init__.py", line 575, in format
    record.message = record.getMessage()
  File "C:\Program Files (x86)\Python36-32\lib\logging\__init__.py", line 338, in getMessage
    msg = msg % self.args
TypeError: not all arguments converted during string formatting
Call stack:
  File "C:\Program Files (x86)\Python36-32\lib\threading.py", line 884, in _bootstrap
    self._bootstrap_inner()
  File "C:\Program Files (x86)\Python36-32\lib\threading.py", line 916, in _bootstrap_inner
    self.run()
  File "C:\Program Files (x86)\Python36-32\lib\threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Program Files (x86)\Python36-32\lib\socketserver.py", line 639, in process_request_thread
    self.finish_request(request, client_address)
  File "C:\Program Files (x86)\Python36-32\lib\socketserver.py", line 361, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Program Files (x86)\Python36-32\lib\socketserver.py", line 696, in __init__
    self.handle()
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\werkzeug\serving.py", line 293, in handle
    rv = BaseHTTPRequestHandler.handle(self)
  File "C:\Program Files (x86)\Python36-32\lib\http\server.py", line 418, in handle
    self.handle_one_request()
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\werkzeug\serving.py", line 328, in handle_one_request
    return self.run_wsgi()
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\werkzeug\serving.py", line 270, in run_wsgi
    execute(self.server.app)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\werkzeug\serving.py", line 258, in execute
    application_iter = app(environ, start_response)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\flask\app.py", line 1997, in __call__
    return self.wsgi_app(environ, start_response)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\flask\app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\flask\app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\flask\app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\flask_restful\__init__.py", line 480, in wrapper
    resp = resource(*args, **kwargs)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\flask\views.py", line 84, in view
    return self.dispatch_request(*args, **kwargs)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\flask_restful\__init__.py", line 595, in dispatch_request
    resp = meth(*args, **kwargs)
  File "C:\ElasticHQ\elastichq\common\exceptions.py", line 29, in _request_wrapper
    return functor(*args, **kwargs)
  File "C:\ElasticHQ\elastichq\api\clusters.py", line 114, in post
    password=params.get('password', None))
  File "C:\ElasticHQ\elastichq\service\ConnectionService.py", line 67, in create_connection
    LOG.error("Unable to create connection!", ex)
Message: 'Unable to create connection!'
Arguments: (JSONDecodeError('Expecting value: line 1 column 1 (char 0)',),)
2018-02-16 09:54:12,816          ERROR   elastichq       exceptions._request_wrapper:37          Oops! Something bad happened.
Traceback (most recent call last):
  File "C:\ElasticHQ\elastichq\common\exceptions.py", line 29, in _request_wrapper
    return functor(*args, **kwargs)
  File "C:\ElasticHQ\elastichq\api\clusters.py", line 117, in post
    result = schema.dump(response)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\marshmallow\schema.py", line 436, in dump
    **kwargs
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\marshmallow\marshalling.py", line 147, in serialize
    index=(index if index_errors else None)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\marshmallow\marshalling.py", line 68, in call_and_store
    value = getter_func(data)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\marshmallow\marshalling.py", line 141, in <lambda>
    getter = lambda d: field_obj.serialize(attr_name, d, accessor=accessor)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\marshmallow\fields.py", line 252, in serialize
    return self._serialize(value, attr, obj)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\flask_marshmallow\fields.py", line 158, in _serialize
    return _rapply(self.schema, _url_val, key=attr, obj=obj)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\flask_marshmallow\fields.py", line 107, in _rapply
    for key, value in iteritems(d)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\flask_marshmallow\fields.py", line 107, in <dictcomp>
    for key, value in iteritems(d)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\flask_marshmallow\fields.py", line 110, in _rapply
    return func(d, *args, **kwargs)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\flask_marshmallow\fields.py", line 118, in _url_val
    return val.serialize(key, obj, **kwargs)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\marshmallow\fields.py", line 252, in serialize
    return self._serialize(value, attr, obj)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\flask_marshmallow\fields.py", line 78, in _serialize
    'attribute of {obj!r}'.format(attr_name=attr_name, obj=obj)
AttributeError: 'cluster_name' is not a valid attribute of None
2018-02-16 09:54:12,847          INFO    werkzeug        _internal._log:88       127.0.0.1 - - [16/Feb/2018 09:54:12] "POST /api/clusters/_connect HTTP/1.1" 500 -`
royrusso commented 6 years ago

If you're using Searchguard, did you pass along the credentials. See: http://docs.elastichq.org/user-guide.html#x-pack-integration

NOTE: we have not tested with SSL, but I'm assuming that locally you aren't using https.

mleonhard38 commented 6 years ago

Sorry for the late reply...

Yes that has worked fine! Seems I missed that in the docs...

royrusso commented 6 years ago

Thanks. More verbose logging will be in the next release, and I'll see about making it more prominent in the docs.

xavierfox commented 6 years ago

Hey guys im having this issue when trying to connect it to my elastic search cluster on aws. any thoughts on how i can fix it. the cluster url has no port for ES just runs on port 80

royrusso commented 6 years ago

Did you try http://IP:80 ?

xavierfox commented 6 years ago

still didn't work error as below

--- Logging error ---
Traceback (most recent call last):
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/elasticsearch-HQ/elastichq/service/ConnectionService.py", line 52, in create_connection
    version=content.get('version').get('number'), http_auth=(username, password))
AttributeError: 'NoneType' object has no attribute 'get'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.4/logging/__init__.py", line 978, in emit
    msg = self.format(record)
  File "/usr/lib64/python3.4/logging/__init__.py", line 828, in format
    return fmt.format(record)
  File "/usr/lib64/python3.4/logging/__init__.py", line 565, in format
    record.message = record.getMessage()
  File "/usr/lib64/python3.4/logging/__init__.py", line 328, in getMessage
    msg = msg % self.args
TypeError: not all arguments converted during string formatting
Call stack:
  File "manage.py", line 52, in <module>
    manager.run()
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/flask_script/__init__.py", line 417, in run
    result = self.handle(argv[0], argv[1:])
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/flask_script/__init__.py", line 386, in handle
    res = handle(*args, **config)
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/flask_script/commands.py", line 479, in __call__
    **self.server_options)
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/flask/app.py", line 841, in run
    run_simple(host, port, self, **options)
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/werkzeug/serving.py", line 814, in run_simple
    inner()
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/werkzeug/serving.py", line 777, in inner
    srv.serve_forever()
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/werkzeug/serving.py", line 612, in serve_forever
    HTTPServer.serve_forever(self)
  File "/usr/lib64/python3.4/socketserver.py", line 238, in serve_forever
    self._handle_request_noblock()
  File "/usr/lib64/python3.4/socketserver.py", line 305, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib64/python3.4/socketserver.py", line 331, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib64/python3.4/socketserver.py", line 344, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib64/python3.4/socketserver.py", line 673, in __init__
    self.handle()
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/werkzeug/serving.py", line 293, in handle
    rv = BaseHTTPRequestHandler.handle(self)
  File "/usr/lib64/python3.4/http/server.py", line 401, in handle
    self.handle_one_request()
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/werkzeug/serving.py", line 328, in handle_one_request
    return self.run_wsgi()
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/werkzeug/serving.py", line 270, in run_wsgi
    execute(self.server.app)
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/werkzeug/serving.py", line 258, in execute
    application_iter = app(environ, start_response)
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/flask/app.py", line 1997, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/flask_restful/__init__.py", line 480, in wrapper
    resp = resource(*args, **kwargs)
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/flask/views.py", line 84, in view
    return self.dispatch_request(*args, **kwargs)
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/flask_restful/__init__.py", line 595, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/elasticsearch-HQ/elastichq/common/exceptions.py", line 29, in _request_wrapper
    return functor(*args, **kwargs)
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/elasticsearch-HQ/elastichq/api/clusters.py", line 114, in post
    password=params.get('password', None))
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/elasticsearch-HQ/elastichq/service/ConnectionService.py", line 67, in create_connection
    LOG.error("Unable to create connection!", ex)
Message: 'Unable to create connection!'
Arguments: (AttributeError("'NoneType' object has no attribute 'get'",),)
2018-02-22 00:08:33,571      ERROR   elastichq   exceptions._request_wrapper:37      Oops! Something bad happened.
Traceback (most recent call last):
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/elasticsearch-HQ/elastichq/common/exceptions.py", line 29, in _request_wrapper
    return functor(*args, **kwargs)
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/elasticsearch-HQ/elastichq/api/clusters.py", line 117, in post
    result = schema.dump(response)
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/marshmallow/schema.py", line 436, in dump
    **kwargs
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/marshmallow/marshalling.py", line 147, in serialize
    index=(index if index_errors else None)
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/marshmallow/marshalling.py", line 68, in call_and_store
    value = getter_func(data)
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/marshmallow/marshalling.py", line 141, in <lambda>
    getter = lambda d: field_obj.serialize(attr_name, d, accessor=accessor)
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/marshmallow/fields.py", line 252, in serialize
    return self._serialize(value, attr, obj)
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/flask_marshmallow/fields.py", line 158, in _serialize
    return _rapply(self.schema, _url_val, key=attr, obj=obj)
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/flask_marshmallow/fields.py", line 107, in _rapply
    for key, value in iteritems(d)
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/flask_marshmallow/fields.py", line 107, in <dictcomp>
    for key, value in iteritems(d)
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/flask_marshmallow/fields.py", line 110, in _rapply
    return func(d, *args, **kwargs)
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/flask_marshmallow/fields.py", line 118, in _url_val
    return val.serialize(key, obj, **kwargs)
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/marshmallow/fields.py", line 252, in serialize
    return self._serialize(value, attr, obj)
  File "/home/masterfox/Documents/PLAY/elasticsearchp3/lib/python3.4/site-packages/flask_marshmallow/fields.py", line 78, in _serialize
    'attribute of {obj!r}'.format(attr_name=attr_name, obj=obj)
AttributeError: 'cluster_name' is not a valid attribute of None
2018-02-22 00:08:33,579      INFO    werkzeug    _internal._log:88   127.0.0.1 - - [22/Feb/2018 00:08:33] "POST /api/clusters/_connect HTTP/1.1" 500 -
royrusso commented 6 years ago

Looks like it cannot connect. Does your ES server require username and password? How are you securing ES on AWS connecting from the outside?

Are you able to cUrl to the server from the box you installed HQ on?

xavierfox commented 6 years ago

Yes im securing it. yes i can access it from my box and i secure it via ip white listing. I dont need to pass username and password to connect

royrusso commented 6 years ago

We'll have to test against a port 80 server. If you are explicitly passing in "80", then it's a bug somewhere.

royrusso commented 6 years ago

The latest patch (just released) has better logging on connections, so you may want to try that. It also fixes a small bug where it was ALWAYS trying to use basic auth, regardless of url.