I have elasticsearch running on a windows machine (10.0.0.51 on my network). I have deployed an app to a linux virtual machine (10.0.0.10). When my app starts it tries to connect to Elasticsearch and create a node using the Java API:
node = nodeBuilder().client(true).clusterName(CLUSTER_NAME).node();
client = node.client();
However in the Elasticsearch console I get the error:
[2015-04-15 14:28:10,559][WARN ][discovery.zen.ping.multicast] [Matt Murdock] failed to connect to requesting node [Gatecrasher][dFF2VpWTQvCrilRKyVSC5Q][localhost.localdomain][inet[/10.0.0.10:9300]]{data=false, client=true}
org.elasticsearch.transport.ConnectTransportException: [Gatecrasher][inet[/10.0.0.10:9300]] connect_timeout[30s]
at org.elasticsearch.transport.netty.NettyTransport.connectToChannels(NettyTransport.java:797)
at org.elasticsearch.transport.netty.NettyTransport.connectToNode(NettyTransport.java:731)
at org.elasticsearch.transport.netty.NettyTransport.connectToNode(NettyTransport.java:704)
at org.elasticsearch.transport.TransportService.connectToNode(TransportService.java:216)
at org.elasticsearch.discovery.zen.ping.multicast.MulticastZenPing$Receiver$1.run(MulticastZenPing.java:542)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.ConnectException: Connection timed out: no further information: /10.0.0.10:9300
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:716)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.connect(NioClientBoss.java:152)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.processSelectedKeys(NioClientBoss.java:105)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:79)
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:337)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:42)
at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
... 3 more
I can connect to Elasticsearch when running both apps from the same machine.
UPDATE:
I just loaded elastic search on to the same VM as my app and I couldn't connect. I can only connect when running my app from and Elastic search on the same windows machine.
It was a network issue with my Linux machine. I did various things including turning ofrf the firewall and it started working. I think that the firewall was blocking access.
Related
I have reserved a number of Linux based EC2 machines(running OS : Centos 7) and with the exact same versions of JMeter 4.0 and Java installed.
No active firewalls, all the devices are connected within the same subnet and I can easily ping between them.
The problem is that I when I try to configure a mater machine and connect it to one of my slaves I keep receiving this exception
Connection refused to host: xx.yy.zz.4; nested exception is:
java.net.ConnectException: Connection timed out (Connection timed out)
Failed to configure xx.yy.zz.4
Stopping remote engines
Remote engines have been stopped
Error in NonGUIDriver java.lang.RuntimeException: Following remote engines could not be configured:[xx.yy.zz.4]
I have made my slave(ip: xx.yy.zz.4) setup as follows:
server_port = 24000 , server.rmi.localport=26000 , server.rmi.ssl.disable=true, No Remote Hosts and I usually launch the server using this shell command:
./jmeter-server -n -Djava.rmi.server.hostname=xx.yy.zz.4
And for the master which is also another EC2 instance(ip: xx.yy.zz.21) I made these configurations:
remote_hosts=xx.yy.zz.4:24000 , client.rmi.localport=25000, server.rmi.ssl.disable=true
And I use this shell command to start my JMeter's test plan
./jmeter -n -Rxx.yy.zz.4 -t /home/centos/jmeter/scripts/demo.jmx -Djava.rmi.server.hostname=xx.yy.zz.21
Any idea on what might cause these error?
Minimal configuration:
slave:
./jmeter-server -Dserver_port=24000
master:
./jmeter -n -R xx.yy.zz.4:24000 -t test.jmx
More information:
How to Perform Distributed Testing in JMeter
Remote hosts and RMI configuration
Also be aware that according to JMeter Best Practices you should be always using the latest JMeter version so consider upgrading to JMeter 5.2.1 (or whatever is the latest stable version available at JMeter Downloads page) on next available opportunity
So I have a clone of the java application, and an active couchbase database, everything on my local machine. When I run the java spring application, everything works well, the application will connect to the database.
On the other hand, I use the same project and database configurations using docker containers. But I can't seem to make them communicate, and when the app starts, I keep getting this exception:
java.net.ConnectException: Connection refused: localhost/127.0.0.1:8091
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
at com.couchbase.client.deps.io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:223)
at com.couchbase.client.deps.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:285)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:589)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:513)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:427)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:399)
at com.couchbase.client.deps.io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:140)
at com.couchbase.client.deps.io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
at java.lang.Thread.run(Thread.java:745)
I also created a docker network where I put the app and database.
Any idea why there is no connectivity ?
you try to connect to container's localhost
java.net.ConnectException: Connection refused:
localhost/127.0.0.1:8091
But you need to connect to another container. If you run docker container with argument --link mysql:mysql you need to specify into app configuration file connect to mysql instead of localhost of 127.0.0.1
I am trying to connect with a Java application from localhost to my elasticsearch cluster on a root server. My problem is that the java client is not able to get a connection.
Ports 9200-9299 and 9300-9400 are opened on the root server(groupelite.de).
I configured my elasticsearch cluster to use unicast discovery and set its inet ip address as "network.host".
This is how I instantiate my client:
NodeBuilder.nodeBuilder()
.clusterName("neeedo-es")
.settings(ImmutableSettings.settingsBuilder()
.classLoader(classOf[Settings].getClassLoader)
.put("discovery.zen.ping.unicast.hosts", "groupelite.de:9300")
.put("node.name", "neeedo-client"))
.client(true)
.data(false)
.node()
And this is my elasticsearch.yml https://gist.github.com/MeiSign/ccfdcc62643c1185bab3
The firewall on the server should be turned off. You can also reach es with http http://www.groupelite.de:9200/
The server is running ubuntu 14.04. Elasticsearch version is 1.4.2 on client and server.
Iam not very used to networking stuff but I hope to get some ideas from you guys what is wrong.
Edit 1:
The server log is showing a ConnectionClosed Exception from time to time. But it does not appear when the client tries to connect, you cant see the client in the logs at all.
[2015-01-31 18:31:45,921][WARN ][transport.netty] [neeedo-s1] exception caught on transport layer [[id: 0x1685f631]], closing connection
java.net.SocketException: Network is unreachable
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:716)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.connect(NioClientBoss.java:152)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.processSelectedKeys(NioClientBoss.java:105)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:79)
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:42)
at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Edit 2:
I have found out that it works when I use a transport client in my application. Does this give any hint what is wrong?
Oracle NoSQL is a database that should be hosted on Linux, so I have a virtual Ubuntu running in Oracle VM VirtualBox.
When you run the KvStore for Oracle NoSQL it uses port 5000 for the database, and 5001 for the admin console. From my pc, I can access the admin console running on the linux virtual machine like so:
http://192.168.0.25:5001/
Where 192.168.0.25 is the inet addr I get from the linux machine's ifconfig command.
However, if I try to connect to the database from java, passing java the host and port number like so:
KVStoreConfig kvconfig = new KVStoreConfig("kvstore", "192.168.0.25:5000");
I get the following error:
Exception in thread "main" oracle.kv.FaultException: Could not contact any RepNode at: [192.168.0.25:5000] (11.2.2.0.26)
Fault class name: oracle.kv.KVStoreException
at oracle.kv.KVStoreFactory.getStore(KVStoreFactory.java:123)
at nosql.Test.main(Test.java:18)
Caused by: oracle.kv.KVStoreException: Could not contact any RepNode at: [192.168.0.25:5000]
at oracle.kv.impl.util.TopologyLocator.getInitialTopology(TopologyLocator.java:226)
at oracle.kv.impl.util.TopologyLocator.get(TopologyLocator.java:85)
at oracle.kv.impl.api.RequestDispatcherImpl.<init>(RequestDispatcherImpl.java:285)
at oracle.kv.KVStoreFactory.getStore(KVStoreFactory.java:118)
... 1 more
Caused by: java.rmi.UnknownHostException: Unknown host: coraythan-VirtualBox; nested exception is:
java.net.UnknownHostException: coraythan-VirtualBox
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:616)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:128)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:194)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:148)
at com.sun.proxy.$Proxy0.getSerialVersion(Unknown Source)
at oracle.kv.impl.util.registry.RemoteAPI.<init>(RemoteAPI.java:60)
at oracle.kv.impl.rep.admin.RepNodeAdminAPI.<init>(RepNodeAdminAPI.java:63)
at oracle.kv.impl.rep.admin.RepNodeAdminAPI.wrap(RepNodeAdminAPI.java:70)
at oracle.kv.impl.util.TopologyLocator.getInitialTopology(TopologyLocator.java:191)
... 4 more
Caused by: java.net.UnknownHostException: coraythan-VirtualBox
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:157)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
at java.net.Socket.connect(Socket.java:579)
at oracle.kv.impl.util.registry.ClientSocketFactory.createSocket(ClientSocketFactory.java:300)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613)
... 14 more
I can get that to work fine when I host a KvStore on my normal computer and try to connect to it like that (using the normal computer's IP address) with java.
Another weird thing is that if I'm in the virtual machine, I can access the admin with this:
coraythan-virtualbox:5001
But if I try to do that from my main computer it gives me a "could not find" error.
I have tried changing my java connection to coraythan-virtualbox:5000, but that also doesn't work.
Does anyone know what I'm doing wrong here? Thanks!
The issue was that the linux computer did not automatically register its network name with my company's network. I had to have the network admin manually add a network name for the computer. The KVStore requires using the network name it seems.
You are making a socket using named address, that is DNS doesn't know such name. Try change it to IP address.
UnknownHostException
Thrown to indicate that the IP address of a host could not be
determined.
When I try to connect to cassandra within my java application I receive the exception at the end of this message. I am using pelops library to access database. Database is working on linux and my development environment is on windos 7. Intresting line is
WARNING: 10.0.0.7 NodeContext killing all pooled connections for session 44
10.0.0.7 is the IP of the cassandra node. And I can connect this node with cassandra-cli. After a few hours of googling I decided to ask, what i am doing wrong?
Complete stack trace is below.
SEVERE: org.apache.thrift.transport.TTransportException: java.net.ConnectException: Connection refused: connect
at org.apache.thrift.transport.TSocket.open(TSocket.java:185)
at org.wyki.cassandra.pelops.ThriftPool$Connection.open(ThriftPool.java:329)
at org.wyki.cassandra.pelops.ThriftPool$NodeContext.createConnection(ThriftPool.java:438)
at org.wyki.cassandra.pelops.ThriftPool$NodeContext.access$5(ThriftPool.java:429)
at org.wyki.cassandra.pelops.ThriftPool$NodeContext$1.run(ThriftPool.java:494)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at org.apache.thrift.transport.TSocket.open(TSocket.java:180)
... 7 more
WARNING: 10.0.0.7 NodeContext killing all pooled connections for session 44
"Connection refused" means that Cassandra isn't listening on the interface you're connecting to. By default Cassandra listens on port 9160 on localhost. You will need to change that if you want to connect externally; read the comments for ThriftAddress in the configuration file.
Pelops isn't doing anything remotely tricky when it comes to making connections to Cassandra so it seems very unlikely it's Pelops specific.
I've just had a quick look at the Hector connection code and it looks pretty much the same:
https://github.com/rantav/hector/blob/master/core/src/main/java/me/prettyprint/cassandra/connection/HThriftClient.java
The cassandra-cli code looks pretty much the same as well:
https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/cli/CliMain.java#L57
p.s. Cassandra should not be configured to listen on 0.0.0.0. See the "Why can't I make Cassandra listen on 0.0.0.0 (all my addresses)?" on the Cassandra FAQ.
It seems that this is a problem with pelops, which is a library on top of cassandra's thrift client. It has some problems for connection to Cassandra working on linux and client on a windows machine.
I've got the same exception connecting with "any" client to cassandra remotely:
ConnectException: Connection refused
Looking through SO I couldn't find a quick solution for that, just reading carefully through cassandra docs and comments within cassandra.yaml - they are very handy!
So for me worked following:
change rpc_address value to the hostname or ipaddress you are using to connect to the cassandra instance with the client