How to re-run cluster with different cluster uuid

using version 8.4

When I ran es in single-node-cluster on ec2 instance I got this message

Fully-formed clusters do not attempt to discover other nodes, and nodes with different cluster UUIDs cannot belong to the same cluster. The cluster UUID persists across restarts and can only be changed by deleting the contents of the node's data path(s). Remove the discovery configuration to suppress this message.

so I shut down elasticsearch with sudo systemctl stop elasticsearch , tried sudo rm -rf /var/lib/elasticsearch/nodes to remove the node's data path, and restarted with sudo systemctl start elasticsearch

but the node still had same cluster uuid

I want to restart cluster with different uuid how can I? I specified discovery host seed and cluster initial master node list inside the config file but the node didn't catch it when restarting and had same cluster uuid, not master's


plus I tried uninstall and re-install es to change cluster uuid

first

  • I deleted /usr/share/elasticsearch, etc/elasticsearch
  • tried sudo yum remove elasticsearch
  • reinstalled with sudo yum install --enablerepo=elasticsearch elasticsearch
    but it still has same cluster uuid

second

  • I deleted /usr/share/elasticsearch, etc/elasticsearch, /etc/sysconfig/elasticsearch
  • tried sudo yum remove elasticsearch
  • reinstalled with sudo yum install --enablerepo=elasticsearch elasticsearch
    but i got the error related to sys file when running es

plz Can you explain the way to re-start cluster and re-install es? there are so many versions and answers Im not sure which info is right

It'd be useful if you could share your elasticsearch.yml and your Elasticsearch logs.

apologies there are so many log files that I cannot know which file I should show to you

but I have config file of first envoking node (suppose it has private IP address 111.11.1.111)

cluster.name: dev-cluster
node.name: ${HOSTNAME}
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
bootstrap.memory_lock: true
network.host: 0.0.0.0
http.port: 20222
discovery.seed_hosts: 111.11.1.111
xpack.security.enabled: true
xpack.security.enrollment.enabled: true
xpack.security.http.ssl:
  enabled: true
  keystore.path: certs/http.p12
xpack.security.transport.ssl:
  enabled: true
  verification_mode: certificate
  keystore.path: certs/transport.p12
  truststore.path: certs/transport.p12
cluster.initial_master_nodes: ["ip-111-11-1-2111.region.compute.internal"]

and this is the second one

cluster.name: dev-cluster
node.name: ${HOSTNAME}
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
bootstrap.memory_lock: true
network.host: 0.0.0.0
http.port: 20222
discovery.seed_hosts: 111.11.1.111
xpack.security.enabled: true
xpack.security.enrollment.enabled: true
xpack.security.http.ssl:
  enabled: true
  keystore.path: certs/http.p12
xpack.security.transport.ssl:
  enabled: true
  verification_mode: certificate
  keystore.path: certs/transport.p12
  truststore.path: certs/transport.p12
cluster.initial_master_nodes: ["ip-111-11-1-2111.region.compute.internal"]

Is there any problem on these configs?

Also I would be really appreciated if you answer this question, too.

  1. Suppose there are two cluster and each cluster has only one node they’ve already been assigned cluster uuid
    With those config files, if there is no problem in config, How can I re-form cluster from two-single-node clusters to one cluster with two node? I shut down es, tried sudo rm -rf /var/lib/elasticsearch/nodes and restart es with token but they said I cannot start already launched node with token
    In this case should I remove elasticsearch on my ec2 and install again?

    (ref. https://www.elastic.co/guide/en/elasticsearch/reference/current/add-elasticsearch-nodes.html#:~:text=To enroll new nodes in your cluster)

Thanks.

What do the logs of these two nodes show as they startup?