ef-labs / vertx-elasticsearch-service

Vert.x elasticsearch service with event bus proxying
57 stars 18 forks source link

Network is unreachable #4

Closed aminmc closed 10 years ago

aminmc commented 10 years ago

Hello,

I am trying to use the vertx-mod-elasticsearch with the following configuration:

In my vertx installation I've added java=com.englishtown~vertx-mod-hk2~1.6.1:com.englishtown.vertx.hk2.HK2VerticleFactory to langs.properties

container.deployModule("com.englishtown~vertx-mod-elasticsearch~1.2.0", { "address": "eb.elasticsearch", "transportAddresses": [ { "hostname": "localhost", "port": 9200 }], "cluster_name": "elasticsearch", "client_transport_sniff": true });

I know my elastic search is running as I can see the cluster state when i hit localhost:9200. However when I try to deploy my app.js where the elastic search module is defined i'm getting the following:

HK2 bootstrap binder class com.englishtown.vertx.hk2.BootstrapBinder was not found. Are you missing injection bindings?

Followed by

[Hindsight Lad] loaded [], sites [] [Hindsight Lad] exception caught on transport layer [[id: 0x43e06583]], closing connection java.net.SocketException: Network is unreachable

Any help would be appreciated

Thanks Amin

adrianluisgonzalez commented 10 years ago

If you can post something that is reproducible I can take a look.

aminmc commented 10 years ago

I created a simple js file which contains the following:

var container = require("vertx/container"); var console = require("vertx/console");

container.deployModule("com.englishtown~vertx-mod-elasticsearch~1.2.0", { "address": "eb.elasticsearch", "transportAddresses": [ { "hostname": "127.0.0.1", "port": 9200 }], "cluster_name": "elasticsearch", "client_transport_sniff": true });

and when i run the js file: vertex run app.js with a running elastic search with default configuration i see

GOT CONFIG: {"address":"eb.elasticsearch","transportAddresses":[{"hostname":"127.0.0.1","port":9200}],"cluster_name":"elasticsearch","client_transport_sniff":true} Succeeded in deploying verticle [Alcmena] loaded [], sites []

[Alcmena] failed to get local cluster state for [#transport#-1][amins-mbp.home][inet[/127.0.0.1:9200]], disconnecting... org.elasticsearch.transport.ReceiveTimeoutTransportException: [][inet[/127.0.0.1:9200]][cluster/state] request_id [0] timed out after [5000ms] at org.elasticsearch.transport.TransportService$TimeoutHandler.run(TransportService.java:369) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724)

Vertx version I'm using is: 2.1.1 (built 2014-06-18 14:11:03)

adrianluisgonzalez commented 10 years ago

I tried running the following and didn't have any issues:

var container = require("vertx/container");
var console = require("vertx/console");

var config = {
    "address": "eb.elasticsearch",
    "transportAddresses": [
        { "hostname": "127.0.0.1", "port": 9200 }
    ],
    "cluster_name": "elasticsearch",
    "client_transport_sniff": true
};

container.deployModule("com.englishtown~vertx-mod-elasticsearch~1.2.0", config, function(x) {
    if (x) {
        console.log(x);
    }
});

What version of ES are you running? I believe the driver requires a minimum of 1.2. I assume you are able to connect to ES on IP/port you have in your configuration right?

adrianluisgonzalez commented 10 years ago

I spoke too soon, I also see the exception you mention. It does appear to connect to the node successfully:

GOT CONFIG: {"address":"eb.elasticsearch","transportAddresses":[{"hostname":"127.0.0.1","port":9200}],"cluster_name":"elasticsearch","client_transport_sniff":true}
Succeeded in deploying verticle 
2014-07-21 19:49:34.501 [DEBUG] o.e.plugins - [Interloper] [/Users/adriangonzalez/projects/vertx/es-js/plugins] directory does not exist.
2014-07-21 19:49:34.501 [INFO ] o.e.plugins - [Interloper] loaded [], sites []
2014-07-21 19:49:34.519 [DEBUG] o.e.c.c.lzf - using [UnsafeChunkDecoder] decoder
2014-07-21 19:49:34.893 [DEBUG] o.e.threadpool - [Interloper] creating thread_pool [generic], type [cached], keep_alive [30s]
2014-07-21 19:49:34.898 [DEBUG] o.e.threadpool - [Interloper] creating thread_pool [index], type [fixed], size [8], queue_size [200]
2014-07-21 19:49:34.900 [DEBUG] o.e.threadpool - [Interloper] creating thread_pool [bulk], type [fixed], size [8], queue_size [50]
2014-07-21 19:49:34.900 [DEBUG] o.e.threadpool - [Interloper] creating thread_pool [get], type [fixed], size [8], queue_size [1k]
2014-07-21 19:49:34.900 [DEBUG] o.e.threadpool - [Interloper] creating thread_pool [search], type [fixed], size [24], queue_size [1k]
2014-07-21 19:49:34.900 [DEBUG] o.e.threadpool - [Interloper] creating thread_pool [suggest], type [fixed], size [8], queue_size [1k]
2014-07-21 19:49:34.900 [DEBUG] o.e.threadpool - [Interloper] creating thread_pool [percolate], type [fixed], size [8], queue_size [1k]
2014-07-21 19:49:34.900 [DEBUG] o.e.threadpool - [Interloper] creating thread_pool [management], type [scaling], min [1], size [5], keep_alive [5m]
2014-07-21 19:49:34.901 [DEBUG] o.e.threadpool - [Interloper] creating thread_pool [flush], type [scaling], min [1], size [4], keep_alive [5m]
2014-07-21 19:49:34.901 [DEBUG] o.e.threadpool - [Interloper] creating thread_pool [merge], type [scaling], min [1], size [4], keep_alive [5m]
2014-07-21 19:49:34.901 [DEBUG] o.e.threadpool - [Interloper] creating thread_pool [refresh], type [scaling], min [1], size [4], keep_alive [5m]
2014-07-21 19:49:34.901 [DEBUG] o.e.threadpool - [Interloper] creating thread_pool [warmer], type [scaling], min [1], size [4], keep_alive [5m]
2014-07-21 19:49:34.901 [DEBUG] o.e.threadpool - [Interloper] creating thread_pool [snapshot], type [scaling], min [1], size [4], keep_alive [5m]
2014-07-21 19:49:34.901 [DEBUG] o.e.threadpool - [Interloper] creating thread_pool [snapshot_data], type [scaling], min [1], size [5], keep_alive [5m]
2014-07-21 19:49:34.901 [DEBUG] o.e.threadpool - [Interloper] creating thread_pool [optimize], type [fixed], size [1], queue_size [null]
2014-07-21 19:49:34.901 [DEBUG] o.e.threadpool - [Interloper] creating thread_pool [bench], type [scaling], min [1], size [4], keep_alive [5m]
2014-07-21 19:49:34.922 [DEBUG] o.e.t.netty - [Interloper] using worker_count[16], port[9300-9400], bind_host[null], publish_host[null], compress[false], connect_timeout[30s], connections_per_node[2/3/6/1/1], receive_predictor[512kb->512kb]
2014-07-21 19:49:34.924 [DEBUG] o.e.c.transport - [Interloper] node_sampler_interval[5s]
2014-07-21 19:49:34.950 [DEBUG] o.e.n.c.s.n.SelectorUtil - Using select timeout of 500
2014-07-21 19:49:34.950 [DEBUG] o.e.n.c.s.n.SelectorUtil - Epoll-bug workaround enabled = false
2014-07-21 19:49:34.979 [DEBUG] o.e.c.transport - [Interloper] adding address [[#transport#-1][usb-etmacadrian.ef.com][inet[/127.0.0.1:9200]]]
2014-07-21 19:49:34.980 [TRACE] o.e.c.transport - [Interloper] connecting to listed node (light) [[#transport#-1][usb-etmacadrian.ef.com][inet[/127.0.0.1:9200]]]
2014-07-21 19:49:35.015 [DEBUG] o.e.t.netty - [Interloper] connected to node [[#transport#-1][usb-etmacadrian.ef.com][inet[/127.0.0.1:9200]]]

Then it starts giving the exceptions

2014-07-21 19:49:40.021 [INFO ] o.e.c.transport - [Interloper] failed to get local cluster state for [#transport#-1][usb-etmacadrian.ef.com][inet[/127.0.0.1:9200]], disconnecting...
org.elasticsearch.transport.ReceiveTimeoutTransportException: [][inet[/127.0.0.1:9200]][cluster/state] request_id [0] timed out after [5001ms]
    at org.elasticsearch.transport.TransportService$TimeoutHandler.run(TransportService.java:369) [elasticsearch-1.2.0.jar:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_11]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_11]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_11]
2014-07-21 19:49:40.027 [DEBUG] o.e.t.netty - [Interloper] disconnected from [[#transport#-1][usb-etmacadrian.ef.com][inet[/127.0.0.1:9200]]]
2014-07-21 19:49:40.028 [TRACE] o.e.c.transport - [Interloper] connecting to node [[#transport#-1][usb-etmacadrian.ef.com][inet[/127.0.0.1:9200]]]
2014-07-21 19:49:40.033 [DEBUG] o.e.t.netty - [Interloper] connected to node [[#transport#-1][usb-etmacadrian.ef.com][inet[/127.0.0.1:9200]]]
2014-07-21 19:49:45.034 [INFO ] o.e.c.transport - [Interloper] failed to get local cluster state for [#transport#-1][usb-etmacadrian.ef.com][inet[/127.0.0.1:9200]], disconnecting...

I'll try to take a look at this tomorrow.

adrianluisgonzalez commented 10 years ago

Ok, just noticed you're using port 9200 which is the default http port. The default tcp port is 9300 which is used by the elasticsearch java driver. Try updating your configuration and things should work.

aminmc commented 10 years ago

Argh! User error! I really thought I'd tried 9300 and also tried with default configuration. Ah well it seems to be working now. Sorry about that.

Thanks Amin

JavaCoreDeveloper commented 8 years ago

Can Somebody let me know how to use elasticsearch in vertx for java. i want to write client side. i have used eventbus but i couldn't able to get it done. New to Vertx. Any help will be appreciated