Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@owenbutler
Created July 25, 2012 06:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save owenbutler/3174651 to your computer and use it in GitHub Desktop.
Save owenbutler/3174651 to your computer and use it in GitHub Desktop.
Elasticsearch config for split brain scenario
cluster.name: splitbrain
node.name: node1
discovery.zen.minimum_master_nodes: 2
discovery.zen.fd.ping_timeout: 3s
discovery.zen.fd.ping_retries: 2
transport.tcp.connect_timeout: 2s
discovery.zen.node_id: zzznode1
cluster.name: splitbrain
node.name: node2
discovery.zen.minimum_master_nodes: 2
discovery.zen.fd.ping_timeout: 3s
discovery.zen.fd.ping_retries: 2
transport.tcp.connect_timeout: 2s
discovery.zen.node_id: zzznode2
cluster.name: splitbrain
node.name: node3
discovery.zen.minimum_master_nodes: 2
discovery.zen.fd.ping_timeout: 3s
discovery.zen.fd.ping_retries: 2
transport.tcp.connect_timeout: 2s
discovery.zen.node_id: aaanode3
diff --git a/src/main/java/org/elasticsearch/discovery/zen/ZenDiscovery.java b/src/main/java/org/elasticsearch/discovery/zen/ZenDiscovery.java
index dc501f4..aaaf8ac 100644
--- a/src/main/java/org/elasticsearch/discovery/zen/ZenDiscovery.java
+++ b/src/main/java/org/elasticsearch/discovery/zen/ZenDiscovery.java
@@ -166,7 +166,8 @@ public class ZenDiscovery extends AbstractLifecycleComponent<Discovery> implemen
protected void doStart() throws ElasticSearchException {
Map<String, String> nodeAttributes = discoveryNodeService.buildAttributes();
// note, we rely on the fact that its a new id each time we start, see FD and "kill -9" handling
- String nodeId = UUID.randomBase64UUID();
+// String nodeId = UUID.randomBase64UUID();
+ String nodeId = settings.get("discovery.zen.node_id", UUID.randomBase64UUID());
localNode = new DiscoveryNode(settings.get("name"), nodeId, transportService.boundAddress().publishAddress(), nodeAttributes);
latestDiscoNodes = new DiscoveryNodes.Builder().put(localNode).localNodeId(localNode.id()).build();
nodesFD.updateNodes(latestDiscoNodes);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment