# How to remove elasticsearch and reinstall to reset cluster

**URL:** <https://discuss.elastic.co/t/how-to-remove-elasticsearch-and-reinstall-to-reset-cluster/317904>\
**Category:** Elasticsearch\
**Created:** [November 1, 2022, 2:40pm UTC](https://discuss.elastic.co/t/how-to-remove-elasticsearch-and-reinstall-to-reset-cluster/317904 "2022-11-01T14:40:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tmdgk490255](https://avatars.discourse-cdn.com/v4/letter/t/fbc32d/32.png) [@tmdgk490255](https://discuss.elastic.co/u/tmdgk490255)\
**Post date:** [November 1, 2022, 2:40pm UTC](https://discuss.elastic.co/t/how-to-remove-elasticsearch-and-reinstall-to-reset-cluster/317904/1 "2022-11-01T14:40:16Z")

</div>

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

```auto
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?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [November 9, 2022, 1:03am UTC](https://discuss.elastic.co/t/how-to-remove-elasticsearch-and-reinstall-to-reset-cluster/317904/2 "2022-11-09T01:03:58Z")

</div>

> [@tmdgk490255](#):
>
> I removed not only /var/lib/elasticsearch/nodes but also all the files and directories related to es but none of them worked

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 7, 2022, 1:04am UTC](https://discuss.elastic.co/t/how-to-remove-elasticsearch-and-reinstall-to-reset-cluster/317904/3 "2022-12-07T01:04:23Z")

</div>

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