安装环境为win10,把之前启动过,且已经有数据的ElasticSearch7.4文件夹直接复制了一份,然后启动时发现,从节点不能加入主节点。报错如下:
org.elasticsearch.transport.RemoteTransportException: [ES-node2][192.168.200.56:9301][internal:cluster/coordination/join]
Caused by: java.lang.IllegalArgumentException: can't add node {ES-node1}{iZEnDFKbQrCR9bmUy6X14Q}{xhV5mtCkSM6XhDXaP9hWjQ}{192.168.200.56}{192.168.200.56:9300}{dil}{ml.machine_memory=7445065728, ml.max_open_jobs=20, xpack.installed=true}, found existing node {ES-node2}{iZEnDFKbQrCR9bmUy6X14Q}{HIw4HDh1RgSd_Ces0LuTbQ}{192.168.200.56}{192.168.200.56:9301}{dilm}{ml.machine_memory=7445065728, xpack.installed=true, ml.max_open_jobs=20} with the same id but is a different node instance
at org.elasticsearch.cluster.node.DiscoveryNodes$Builder.add(DiscoveryNodes.java:618) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.cluster.coordination.JoinTaskExecutor.execute(JoinTaskExecutor.java:147) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.cluster.coordination.JoinHelper$1.execute(JoinHelper.java:119) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.cluster.service.MasterService.executeTasks(MasterService.java:702) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.cluster.service.MasterService.calculateTaskOutputs(MasterService.java:324) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.cluster.service.MasterService.runTasks(MasterService.java:219) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.cluster.service.MasterService.access$000(MasterService.java:73) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.cluster.service.MasterService$Batcher.run(MasterService.java:151) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.cluster.service.TaskBatcher.runIfNotProcessed(TaskBatcher.java:150) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.cluster.service.TaskBatcher$BatchedTask.run(TaskBatcher.java:188) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:703) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:252) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:215) ~[elasticsearch-7.4.0.jar:7.4.0]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_201]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_201]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201]
出错的原因为,复制时也把data目录下的数据复制了一份。删除复制过来的data目录下的数据,再次启动时启动成功。