Skip to content
Snippets Groups Projects
Unverified Commit 6eb53b80 authored by Jason Tedor's avatar Jason Tedor
Browse files

[elasticsearch] Simplify cluster.name setting

parent a70aa676
No related branches found
No related tags found
No related merge requests found
...@@ -42,7 +42,7 @@ For further configuration see below: ...@@ -42,7 +42,7 @@ For further configuration see below:
### Defaults Configuration ### Defaults Configuration
The default setting for the Elasticsearch node that is created is as follows: The default setting for the Elasticsearch node that is created is as follows:
es.cluster.name=es.ycsb.cluster cluster.name=es.ycsb.cluster
es.index.key=es.ycsb es.index.key=es.ycsb
es.number_of_shards=1 es.number_of_shards=1
es.number_of_replicas=0 es.number_of_replicas=0
......
...@@ -57,7 +57,7 @@ import java.util.Vector; ...@@ -57,7 +57,7 @@ import java.util.Vector;
* Default properties to set: * Default properties to set:
* </p> * </p>
* <ul> * <ul>
* <li>es.cluster.name = es.ycsb.cluster * <li>cluster.name = es.ycsb.cluster
* <li>es.index.key = es.ycsb * <li>es.index.key = es.ycsb
* <li>es.number_of_shards = 1 * <li>es.number_of_shards = 1
* <li>es.number_of_replicas = 0 * <li>es.number_of_replicas = 0
...@@ -83,7 +83,6 @@ public class ElasticsearchClient extends DB { ...@@ -83,7 +83,6 @@ public class ElasticsearchClient extends DB {
public void init() throws DBException { public void init() throws DBException {
Properties props = getProperties(); Properties props = getProperties();
this.indexKey = props.getProperty("es.index.key", DEFAULT_INDEX_KEY); this.indexKey = props.getProperty("es.index.key", DEFAULT_INDEX_KEY);
String clusterName = props.getProperty("es.cluster.name", DEFAULT_CLUSTER_NAME);
int numberOfShards = parseIntegerProperty(props, "es.number_of_shards", NUMBER_OF_SHARDS); int numberOfShards = parseIntegerProperty(props, "es.number_of_shards", NUMBER_OF_SHARDS);
int numberOfReplicas = parseIntegerProperty(props, "es.number_of_replicas", NUMBER_OF_REPLICAS); int numberOfReplicas = parseIntegerProperty(props, "es.number_of_replicas", NUMBER_OF_REPLICAS);
...@@ -93,14 +92,15 @@ public class ElasticsearchClient extends DB { ...@@ -93,14 +92,15 @@ public class ElasticsearchClient extends DB {
remoteMode = Boolean.parseBoolean(props.getProperty("es.remote", "false")); remoteMode = Boolean.parseBoolean(props.getProperty("es.remote", "false"));
Boolean newdb = Boolean.parseBoolean(props.getProperty("es.newdb", "false")); Boolean newdb = Boolean.parseBoolean(props.getProperty("es.newdb", "false"));
Builder settings = Settings.settingsBuilder() Builder settings = Settings.settingsBuilder()
.put("cluster.name", clusterName) .put("cluster.name", DEFAULT_CLUSTER_NAME)
.put("node.local", Boolean.toString(!remoteMode)) .put("node.local", Boolean.toString(!remoteMode))
.put("path.home", System.getProperty("java.io.tmpdir")); .put("path.home", System.getProperty("java.io.tmpdir"));
// if properties file contains elasticsearch user defined properties // if properties file contains elasticsearch user defined properties
// add it to the settings file (will overwrite the defaults). // add it to the settings file (will overwrite the defaults).
settings.put(props); settings.put(props);
System.out.println("Elasticsearch starting node = " + settings.get("cluster.name")); final String clusterName = settings.get("cluster.name");
System.out.println("Elasticsearch starting node = " + clusterName);
System.out.println("Elasticsearch node path.home = " + settings.get("path.home")); System.out.println("Elasticsearch node path.home = " + settings.get("path.home"));
System.out.println("Elasticsearch Remote Mode = " + remoteMode); System.out.println("Elasticsearch Remote Mode = " + remoteMode);
// Remote mode support for connecting to remote elasticsearch cluster // Remote mode support for connecting to remote elasticsearch cluster
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment