How to remove elasticsearch and reinstall to reset cluster

I want to remove es on ec2 instance and reinstall it to initialize cluster and node info How can I?
I tried but it always had same cluster uuid even I uninstalled it

First I installed es following these steps

sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch


sudo nano /etc/yum.repos.d/elasticsearch.repo


[elasticsearch]
name=Elasticsearch repository for 8.x packages
baseurl=https://artifacts.elastic.co/packages/8.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=0
autorefresh=1
type=rpm-md


sudo yum install --enablerepo=elasticsearch elasticsearch

after starting node I got single-node cluster
Then I uninstall es with sudo yum remove elasticsearch command

I installed es again following exactly same steps but It had same cluster uuid

I removed not only /var/lib/elasticsearch/nodes but also all the files and directories related to es but none of them worked
there is no way to completely remove and reinstall es on ec2 instance?

If you remove /var/lib/elasticsearch then it should work.

1 Like

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