I run elasticsearch embedded. It's started like so:
node = NodeBuilder.nodeBuilder().node();
client = node.client();
client.admin().cluster().prepareHealth()
.setWaitForYellowStatus()
.setTimeout("60s").execute().actionGet();
...and shut down like so:
client.close();
node.close();
If I close and re-open without shutting down the application, I either
get a "failed to bind error":
19:17:19,216 INFO ~ Closing node...
19:17:19,217 INFO ~ [Machine Teen] {0.18.7}[3880]: stopping ...
19:17:19,319 INFO ~ [Machine Teen] {0.18.7}[3880]: stopped
19:17:19,319 INFO ~ [Machine Teen] {0.18.7}[3880]: closing ...
19:17:19,330 INFO ~ [Machine Teen] {0.18.7}[3880]: closed
19:17:19,576 INFO ~ Starting node...
19:17:19,581 INFO ~ [Bob] {0.18.7}[3880]: initializing ...
19:17:19,582 INFO ~ [Bob] loaded [], sites []
19:17:19,738 INFO ~ [Bob] {0.18.7}[3880]: initialized
19:17:19,738 INFO ~ [Bob] {0.18.7}[3880]: starting ...
19:17:19,855 ERROR ~
Caused by: org.elasticsearch.transport.BindTransportException: Failed
to bind to [9300-9400]
at
org.elasticsearch.transport.netty.NettyTransport.doStart(NettyTransport.java:
308)
at
org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:
80)
at
org.elasticsearch.transport.TransportService.doStart(TransportService.java:
89)
at
org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:
80)
at
org.elasticsearch.node.internal.InternalNode.start(InternalNode.java:
185)
at org.elasticsearch.node.NodeBuilder.node(NodeBuilder.java:
166)
...
...or a new node is created (elasticsearch/nodes/$n) and previously
indexed data is no longer visible.
When I shut down the application and restart, the node is in RED state
for a while. Is that normal, or does that indicate that the shutdown
wasn't quite complete?