I deleted the elasticsearch folder in /etc/elasticsearch/ , not sure how to restore back?

I have built the Flask application(Python) which is linked to Elasticsearch(port:9200), Now I need to deploy this application within AWS EC2, however while performing I deleted the Elasticsearch folder within /etc and now I am unable to start the Elasticsearch.

Please let me know how to restore the deleted folder ?

Do you have a snapshot? If not I suspect you will need to set it up from scratch again.

I tried doing it from scratch, but still not able to see the folder "elasticsearch" within /etc
steps followed are:

sudo su
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
cd /etc/yum.repos.d/
vi elasticsearch.repo
name=Elasticsearch repository for 7.x packages
yum install --enablerepo=elasticsearch elasticsearch
/bin/systemctl daemon-reload
/bin/systemctl enable elasticsearch.service
systemctl start elasticsearch.service

Also tried using rpm:
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
yum install --enablerepo=elasticsearch elasticsearch
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.8.1-x86_64.rpm
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.8.1-x86_64.rpm.sha512

using systemd:
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service
sudo systemctl start elasticsearch.service

How did you try to restore so far and what errors do you get?

Not much in /etc/elasticsearch other than the main yaml config and JVM options which are mostly defaults plus your cluster name, IPs, heap size - though also plus keys and you're kinda in trouble if you used & lost those.

You might do an upgrade or force install (snapshot the data disk first) to get it back, adjust the basic settings, and restart, but if keys were used and gone, I have no idea.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.