Skip to content

Instantly share code, notes, and snippets.

@nsoft
Created April 1, 2016 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nsoft/d488753cacbbfd6cc4eb7880f6476e2b to your computer and use it in GitHub Desktop.
Save nsoft/d488753cacbbfd6cc4eb7880f6476e2b to your computer and use it in GitHub Desktop.
elastic node config
@Override
public ElasticNodeSender build() {
ElasticNodeSender obj = getObj();
String home = Main.JJ_DIR + System.getProperty("file.separator") + obj.nodeName;
new File(home).mkdirs();
obj.settings = Settings.settingsBuilder()
.put("node.name", obj.nodeName)
.put("path.home", home)
.build();
obj.node = new NodeBuilder()
.data(false)
.local(false)
.client(true)
.settings(obj.settings)
.clusterName(obj.clusterName)
.build().start();
obj.client = obj.node.client();
return obj;
}
This gets me this:
{
"cluster_name" : "elasticsearch",
"nodes" : {
"hobSbu7FT7OcPglDaB7q0Q" : {
"timestamp" : 1459519899020,
"name" : "jj_elastic_client_node",
"transport_address" : "127.0.0.1:9301",
"host" : "127.0.0.1",
"ip" : [ "127.0.0.1:9301", "NONE" ],
"attributes" : {
"client" : "true",
"data" : "false",
"local" : "false"
},
"process" : {
"timestamp" : 1459519898851,
"open_file_descriptors" : 413,
"max_file_descriptors" : 10240,
"cpu" : {
"percent" : 3,
"total_in_millis" : 53241
},
"mem" : {
"total_virtual_in_bytes" : 8610848768
}
}
}
}
}
And my cluster is
{
"cluster_name" : "elasticsearch",
"nodes" : {
"8q3-E4AtSNidl-iYY8desw" : {
"timestamp" : 1459519968519,
"name" : "Frenzy",
"transport_address" : "127.0.0.1:9300",
"host" : "127.0.0.1",
"ip" : [ "127.0.0.1:9300", "NONE" ],
"roles" : [ "master", "data", "ingest" ],
"process" : {
"timestamp" : 1459519968471,
"open_file_descriptors" : 234,
"max_file_descriptors" : 10240,
"cpu" : {
"percent" : 0,
"total_in_millis" : 357894
},
"mem" : {
"total_virtual_in_bytes" : 5287821312
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment