Hello,
When I am trying to delete index on ELK single node cluster using curator it is failing with below error. I know it is a common error having many threads, but I am not able to find a proper solution for any.
When I try to delete using curator, it is failing with 'failed to establish connection error(Errno[-2]). Complete error snippets are given below.
Software versions used
elasticsearch-curator (5.7.6)
urllib3 (1.24.3)
elasticsearch = 6.2.4
Additional tests done to make sure ELK is working fine!
- 9200 port is up and running on ELK
- Curl GET request on the host:port is returning success json
- Python client using urllib3 is able to connect elk port 9200
Error prints observed during script run:-
[ec2-user@ip-172-31-26-150 curator]$ curator curator-action.yml --config curator-config.yml
2019-07-16 13:37:13,061 INFO Preparing Action ID: 1, "delete_indices"
Traceback (most recent call last):
File "/usr/local/bin/curator", line 11, in <module>
load_entry_point('elasticsearch-curator==5.7.6', 'console_scripts', 'curator')()
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/curator/cli.py", line 218, in cli
run(config, action_file, dry_run)
File "/usr/local/lib/python2.7/site-packages/curator/cli.py", line 165, in run
client = get_client(**client_args)
File "/usr/local/lib/python2.7/site-packages/curator/utils.py", line 911, in get_client
'Error: {0}'.format(e)
elasticsearch.exceptions.ElasticsearchException: Unable to create client connection to Elasticsearch. Error: ConnectionError(<urllib3.connection.HTTPConnection object at 0x7fe4e2149bd0>: Failed to establish a new connection: [Errno -2] Name or service not known) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7fe4e2149bd0>: Failed to establish a new connection: [Errno -2] Name or service not known)
Additional verification done on ELK :-
Python urllib3 client to GET ELK info
>>> import urllib3
>>> http = urllib3.PoolManager()
>>> r = http.request('GET', 'http://172.31.29.21:9200')
>>> r.status
200
CURL request to GET ELK info
[ec2-user@ip-172-31-26-150 curator]$ curl -X GET http://172.31.29.21:9200
{
"name" : "EaR2f-Q",
"cluster_name" : "elk-single-pagerduty",
"cluster_uuid" : "pfRgoQ-JQ-WkkFvNVNwn3g",
"version" : {
"number" : "6.2.4",
"build_hash" : "ccec39f",
"build_date" : "2018-04-12T20:37:28.497551Z",
"build_snapshot" : false,
"lucene_version" : "7.2.1",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
Also attaching curator config and action file
curator-config.yml file output
client:
hosts:
— 172.31.29.21
port: 9200
url_prefix:
use_ssl: False
certificate:
client_cert:
client_key:
aws_key:
aws_secret_key:
aws_region:
ssl_no_validate: False
http_auth:
timeout: 100
master_only: False
logging:
loglevel: INFO
logfile:
logformat: default
blacklist: ['elasticsearch', 'urllib3']
curator-action.yml file output
---
actions:
1:
action: delete_indices
description: "Delete indices older than 30 days (based on index name)."
filters:
-
exclude: ~
filtertype: pattern
kind: prefix
value: logstash-
-
direction: older
exclude: ~
filtertype: age
source: name
timestring: ‘%Y.%m.%d’
unit: days
unit_count: 60
options:
continue_if_exception: false
disable_action: false
ignore_empty_list: true
timeout_override: ~
Any help is really appreciated!
Thanks in advance.
Sanoop