I've successfully have elasticsearch running on my Linux dev box which is
Elastic search server running in it's own process
Tomcat server running a webapp that connects to the cluster as a client
(node.data=false)
I ran into a problem when I tried to deploy our app in this configuration to
our test server (FreeBSD 7.3) though. Basically whichever server starts
last gets a - DiscoveryException[Failed to setup multicast
socket] BindException[Address already in use]
(I only tried starting tomcat first to see if the elasticsearch server would
have the same issue, which it does and the client in Tomcat eventually times
out because it can't find a master).
Here's the relevant part of the stack trace I get in the client running in
tomcat when tomcat is started last:
Caused by: org.elasticsearch.discovery.DiscoveryException: Failed to setup
multicast socket
at
org.elasticsearch.discovery.zen.ping.multicast.MulticastZenPing.doStart(MulticastZenPing.java:174)
at
org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:80)
at
org.elasticsearch.discovery.zen.ping.ZenPingService.doStart(ZenPingService.java:92)
at
org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:80)
at
org.elasticsearch.discovery.zen.ZenDiscovery.doStart(ZenDiscovery.java:146)
at
org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:80)
at
org.elasticsearch.discovery.DiscoveryService.doStart(DiscoveryService.java:59)
at
org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:80)
at
org.elasticsearch.node.internal.InternalNode.start(InternalNode.java:184)
at org.elasticsearch.node.NodeBuilder.node(NodeBuilder.java:166)
at
org.projectx.elasticsearch.ElasticsearchNodeFactoryBean.internalCreateNode(ElasticsearchNodeFactoryBean.java:86)
at
org.projectx.elasticsearch.ElasticsearchNodeFactoryBean.afterPropertiesSet(ElasticsearchNodeFactoryBean.java:66)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1469)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
... 49 more
Caused by: java.net.BindException: Address already in use
at java.net.PlainDatagramSocketImpl.bind0(Native Method)
at
java.net.PlainDatagramSocketImpl.bind(PlainDatagramSocketImpl.java:82)
at java.net.DatagramSocket.bind(DatagramSocket.java:368)
at java.net.MulticastSocket.(MulticastSocket.java:147)
at java.net.MulticastSocket.(MulticastSocket.java:112)
at
org.elasticsearch.discovery.zen.ping.multicast.MulticastZenPing.doStart(MulticastZenPing.java:158)
... 62 more
Elasticsearch version 0.17.6
uname -prs
FreeBSD 7.3-RELEASE amd64
java -version
java version "1.6.0_07"
Diablo Java(TM) SE Runtime Environment (build 1.6.0_07-b02)
Diablo Java HotSpot(TM) 64-Bit Server VM (build 10.0-b23, mixed mode)
I'd done some google searching. Didn't find anything recent, but I did find
an old discussion about some issues with how BSD had different socket
options from Linux and issues with how java chose them -
http://freebsd.1045724.n5.nabble.com/SO-REUSEADDR-should-not-also-mean-SO-REUSEPORT-td4188641.html
Any ideas what might be going on? Anyone else ever hit this? I'm going to
look into switching to unicast discovery, but wanted to document and see if
anyone had any ideas what was going on here.
Thanks,
--Andy