Newbie question for TransportClient

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Newbie question for TransportClient

sezgin küçükkaraaslan
Hi,
We have been using Compass and Grails Searchable Plugin for some time
to
store our product data. Now we are evaluating Elastic Search and treat
it as
an external system for the first phase. I'm using ElasticSearch 0.5.1
release, and trying to connect to a node in the local machine with
TransportClient. When I execute the following code I got "No node
available
exception".

System.setProperty("java.net.preferIPv4Stack", "true");
TransportClient client = new TransportClient();
client.addTransportAddress(new
InetSocketTransportAddress("192.168.1.102",
9300));

ClusterHealthRequest healthRequest = new ClusterHealthRequest();
ClusterHealthResponse response =
client.admin().cluster().health(healthRequest).actionGet();

client.close();

Here is the exception trace:

Exception in thread "main"
org.elasticsearch.client.transport.NoNodeAvailableException: No node
available
    at
org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:
129)
    at
org.elasticsearch.client.transport.support.InternalTransportClusterAdminClient.health(InternalTransportClusterAdminClient.java:
84)

I got the same exception with other actions except "health". But when
I open
a browser and request the cluster health I got the response properly.

{"status":"green","timedOut":false,"activePrimaryShards":
0,"activeShards":0,"relocatingShards":0}

Here is my local node configuration:

network:
  bindHost: 192.168.1.102
  publishHost: 192.168.1.102
cluster:
  name: snmpCluster
discovery:
  jgroups:
    config: tcp
    bind_addr: 192.168.1.102
    tcpping:
      initial_hosts: 192.168.1.102[7800]

Is there something that I'm doing wrong?

Thanks in advance,

Sezgin Kucukkaraaslan
www.ifountain.com
Reply | Threaded
Open this post in threaded view
|

Re: Newbie question for TransportClient

HubertChang
I am working on an elasticsearch plugin for grails. github.com/hz/grails-elasticsearch. I use the embedded server to connect to elasticsearch.
Reply | Threaded
Open this post in threaded view
|

Re: Newbie question for TransportClient

sezgin küçükkaraaslan
That's great news. First I've tried the embedded server version but I
had some classpath problems with the Compass version that we are
using. (we already have older lucene jars in our classpath). So I
decided to go on with TransportClient for the time being.

On Apr 8, 11:02 am, HubertChang <[hidden email]> wrote:
> I am working on an elasticsearch plugin for grails.
> github.com/hz/grails-elasticsearch. I use the embedded server to connect to
> elasticsearch.
> --
> View this message in context:http://n3.nabble.com/Newbie-question-for-TransportClient-tp705234p705...
> Sent from the ElasticSearch Users mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Newbie question for TransportClient

dominict
When you start the node what does it say in the logs for what the
transport is listening on?

i.e.
[13:14:11,726][INFO ][transport                ] [Matador]
boundAddress [inet[/0.0.0.0:9300]], publishAddress [inet[/
10.0.1.2:9300]]

for the above I'd have:

client.addTransportAddress(new InetSocketTransportAddress("0.0.0.0",
9300));

or

client.addTransportAddress(new InetSocketTransportAddress("10.0.1.2",
9300));


See if your api settings differ to what the server is listening on.

/dom



On Apr 8, 12:21 pm, "sezgin.kucukkaraaslan" <[hidden email]> wrote:

> That's great news. First I've tried the embedded server version but I
> had some classpath problems with the Compass version that we are
> using. (we already have older lucene jars in our classpath). So I
> decided to go on with TransportClient for the time being.
>
> On Apr 8, 11:02 am, HubertChang <[hidden email]> wrote:
>
>
>
> > I am working on an elasticsearch plugin for grails.
> > github.com/hz/grails-elasticsearch. I use the embedded server to connect to
> > elasticsearch.
> > --
> > View this message in context:http://n3.nabble.com/Newbie-question-for-TransportClient-tp705234p705...
> > Sent from the ElasticSearch Users mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Newbie question for TransportClient

sezgin küçükkaraaslan
It says:

[transport                ] [Gill, Donald "Donny"] boundAddress [inet[/192.168.1.102:9300]], publishAddress [inet[/192.168.1.102:9300]]

as I provide for the transport address.

On Thu, Apr 8, 2010 at 3:16 PM, dominict <[hidden email]> wrote:
When you start the node what does it say in the logs for what the
transport is listening on?

i.e.
[13:14:11,726][INFO ][transport                ] [Matador]
boundAddress [inet[/0.0.0.0:9300]], publishAddress [inet[/
10.0.1.2:9300]]

for the above I'd have:

client.addTransportAddress(new InetSocketTransportAddress("0.0.0.0",
9300));

or

client.addTransportAddress(new InetSocketTransportAddress("10.0.1.2",
9300));


See if your api settings differ to what the server is listening on.

/dom



On Apr 8, 12:21 pm, "sezgin.kucukkaraaslan" <[hidden email]> wrote:
> That's great news. First I've tried the embedded server version but I
> had some classpath problems with the Compass version that we are
> using. (we already have older lucene jars in our classpath). So I
> decided to go on with TransportClient for the time being.
>
> On Apr 8, 11:02 am, HubertChang <[hidden email]> wrote:
>
>
>
> > I am working on an elasticsearch plugin for grails.
> > github.com/hz/grails-elasticsearch. I use the embedded server to connect to
> > elasticsearch.
> > --
> > View this message in context:http://n3.nabble.com/Newbie-question-for-TransportClient-tp705234p705...
> > Sent from the ElasticSearch Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: Newbie question for TransportClient

dominict
I had a tinker here.
remove this bit from your config (not sure why, but just give it a
go... ):

cluster:
  name: snmpCluster



/dom

On Apr 8, 1:25 pm, sezgin küçükkaraaslan <[hidden email]> wrote:

> It says:
>
> [transport                ] [Gill, Donald "Donny"] boundAddress
> [inet[/192.168.1.102:9300]], publishAddress
> [inet[/192.168.1.102:9300<http://10.0.1.2:9300/>
> ]]
>
> as I provide for the transport address.
>
>
>
> On Thu, Apr 8, 2010 at 3:16 PM, dominict <[hidden email]> wrote:
> > When you start the node what does it say in the logs for what the
> > transport is listening on?
>
> > i.e.
> > [13:14:11,726][INFO ][transport                ] [Matador]
> > boundAddress [inet[/0.0.0.0:9300]], publishAddress [inet[/
> > 10.0.1.2:9300]]
>
> > for the above I'd have:
>
> > client.addTransportAddress(new InetSocketTransportAddress("0.0.0.0",
> > 9300));
>
> > or
>
> > client.addTransportAddress(new InetSocketTransportAddress("10.0.1.2",
> > 9300));
>
> > See if your api settings differ to what the server is listening on.
>
> > /dom
>
> > On Apr 8, 12:21 pm, "sezgin.kucukkaraaslan" <[hidden email]> wrote:
> > > That's great news. First I've tried the embedded server version but I
> > > had some classpath problems with the Compass version that we are
> > > using. (we already have older lucene jars in our classpath). So I
> > > decided to go on with TransportClient for the time being.
>
> > > On Apr 8, 11:02 am, HubertChang <[hidden email]> wrote:
>
> > > > I am working on an elasticsearch plugin for grails.
> > > > github.com/hz/grails-elasticsearch. I use the embedded server to
> > connect to
> > > > elasticsearch.
> > > > --
> > > > View this message in context:
> >http://n3.nabble.com/Newbie-question-for-TransportClient-tp705234p705...
> > > > Sent from the ElasticSearch Users mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Newbie question for TransportClient

dominict
If you want the TransportClient to work with you clusterName
"snmpCluster".  Create the transport client as follows:

Map<String,String> m = new HashMap<String,String>();
m.put("cluster.name","snmpCluster");
Settings s = ImmutableSettings.settingsBuilder() .put(m).build();

TransportClient client = new TransportClient(s);

cheers,
/dom

On Apr 8, 1:48 pm, dominict <[hidden email]> wrote:

> I had a tinker here.
> remove this bit from your config (not sure why, but just give it a
> go... ):
>
> cluster:
>   name: snmpCluster
>
> /dom
>
> On Apr 8, 1:25 pm, sezgin küçükkaraaslan <[hidden email]> wrote:
>
>
>
> > It says:
>
> > [transport                ] [Gill, Donald "Donny"] boundAddress
> > [inet[/192.168.1.102:9300]], publishAddress
> > [inet[/192.168.1.102:9300<http://10.0.1.2:9300/>
> > ]]
>
> > as I provide for the transport address.
>
> > On Thu, Apr 8, 2010 at 3:16 PM, dominict <[hidden email]> wrote:
> > > When you start the node what does it say in the logs for what the
> > > transport is listening on?
>
> > > i.e.
> > > [13:14:11,726][INFO ][transport                ] [Matador]
> > > boundAddress [inet[/0.0.0.0:9300]], publishAddress [inet[/
> > > 10.0.1.2:9300]]
>
> > > for the above I'd have:
>
> > > client.addTransportAddress(new InetSocketTransportAddress("0.0.0.0",
> > > 9300));
>
> > > or
>
> > > client.addTransportAddress(new InetSocketTransportAddress("10.0.1.2",
> > > 9300));
>
> > > See if your api settings differ to what the server is listening on.
>
> > > /dom
>
> > > On Apr 8, 12:21 pm, "sezgin.kucukkaraaslan" <[hidden email]> wrote:
> > > > That's great news. First I've tried the embedded server version but I
> > > > had some classpath problems with the Compass version that we are
> > > > using. (we already have older lucene jars in our classpath). So I
> > > > decided to go on with TransportClient for the time being.
>
> > > > On Apr 8, 11:02 am, HubertChang <[hidden email]> wrote:
>
> > > > > I am working on an elasticsearch plugin for grails.
> > > > > github.com/hz/grails-elasticsearch. I use the embedded server to
> > > connect to
> > > > > elasticsearch.
> > > > > --
> > > > > View this message in context:
> > >http://n3.nabble.com/Newbie-question-for-TransportClient-tp705234p705...
> > > > > Sent from the ElasticSearch Users mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Newbie question for TransportClient

sezgin küçükkaraaslan
Bingo !! That works fine, thank you very much.

Sezgin Kucukkaraaslan
www.ifountain.com

On Thu, Apr 8, 2010 at 3:54 PM, dominict <[hidden email]> wrote:
If you want the TransportClient to work with you clusterName
"snmpCluster".  Create the transport client as follows:

Map<String,String> m = new HashMap<String,String>();
m.put("cluster.name","snmpCluster");
Settings s = ImmutableSettings.settingsBuilder() .put(m).build();

TransportClient client = new TransportClient(s);

cheers,
/dom

On Apr 8, 1:48 pm, dominict <[hidden email]> wrote:
> I had a tinker here.
> remove this bit from your config (not sure why, but just give it a
> go... ):
>
> cluster:
>   name: snmpCluster
>
> /dom
>
> On Apr 8, 1:25 pm, sezgin küçükkaraaslan <[hidden email]> wrote:
>
>
>
> > It says:
>
> > [transport                ] [Gill, Donald "Donny"] boundAddress
> > [inet[/192.168.1.102:9300]], publishAddress
> > [inet[/192.168.1.102:9300<http://10.0.1.2:9300/>
> > ]]
>
> > as I provide for the transport address.
>
> > On Thu, Apr 8, 2010 at 3:16 PM, dominict <[hidden email]> wrote:
> > > When you start the node what does it say in the logs for what the
> > > transport is listening on?
>
> > > i.e.
> > > [13:14:11,726][INFO ][transport                ] [Matador]
> > > boundAddress [inet[/0.0.0.0:9300]], publishAddress [inet[/
> > > 10.0.1.2:9300]]
>
> > > for the above I'd have:
>
> > > client.addTransportAddress(new InetSocketTransportAddress("0.0.0.0",
> > > 9300));
>
> > > or
>
> > > client.addTransportAddress(new InetSocketTransportAddress("10.0.1.2",
> > > 9300));
>
> > > See if your api settings differ to what the server is listening on.
>
> > > /dom
>
> > > On Apr 8, 12:21 pm, "sezgin.kucukkaraaslan" <[hidden email]> wrote:
> > > > That's great news. First I've tried the embedded server version but I
> > > > had some classpath problems with the Compass version that we are
> > > > using. (we already have older lucene jars in our classpath). So I
> > > > decided to go on with TransportClient for the time being.
>
> > > > On Apr 8, 11:02 am, HubertChang <[hidden email]> wrote:
>
> > > > > I am working on an elasticsearch plugin for grails.
> > > > > github.com/hz/grails-elasticsearch. I use the embedded server to
> > > connect to
> > > > > elasticsearch.
> > > > > --
> > > > > View this message in context:
> > >http://n3.nabble.com/Newbie-question-for-TransportClient-tp705234p705...
> > > > > Sent from the ElasticSearch Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: Newbie question for TransportClient

kimchy
Administrator
Hi,

  Good catch!. The transport client automatically filters out nodes that do not belong to the cluster. The cluster is defined by the cluster name.

cheers,
shay.banon

2010/4/8 sezgin küçükkaraaslan <[hidden email]>
Bingo !! That works fine, thank you very much.


Sezgin Kucukkaraaslan
www.ifountain.com

On Thu, Apr 8, 2010 at 3:54 PM, dominict <[hidden email]> wrote:
If you want the TransportClient to work with you clusterName
"snmpCluster".  Create the transport client as follows:

Map<String,String> m = new HashMap<String,String>();
m.put("cluster.name","snmpCluster");
Settings s = ImmutableSettings.settingsBuilder() .put(m).build();

TransportClient client = new TransportClient(s);

cheers,
/dom

On Apr 8, 1:48 pm, dominict <[hidden email]> wrote:
> I had a tinker here.
> remove this bit from your config (not sure why, but just give it a
> go... ):
>
> cluster:
>   name: snmpCluster
>
> /dom
>
> On Apr 8, 1:25 pm, sezgin küçükkaraaslan <[hidden email]> wrote:
>
>
>
> > It says:
>
> > [transport                ] [Gill, Donald "Donny"] boundAddress
> > [inet[/192.168.1.102:9300]], publishAddress
> > [inet[/192.168.1.102:9300<http://10.0.1.2:9300/>
> > ]]
>
> > as I provide for the transport address.
>
> > On Thu, Apr 8, 2010 at 3:16 PM, dominict <[hidden email]> wrote:
> > > When you start the node what does it say in the logs for what the
> > > transport is listening on?
>
> > > i.e.
> > > [13:14:11,726][INFO ][transport                ] [Matador]
> > > boundAddress [inet[/0.0.0.0:9300]], publishAddress [inet[/
> > > 10.0.1.2:9300]]
>
> > > for the above I'd have:
>
> > > client.addTransportAddress(new InetSocketTransportAddress("0.0.0.0",
> > > 9300));
>
> > > or
>
> > > client.addTransportAddress(new InetSocketTransportAddress("10.0.1.2",
> > > 9300));
>
> > > See if your api settings differ to what the server is listening on.
>
> > > /dom
>
> > > On Apr 8, 12:21 pm, "sezgin.kucukkaraaslan" <[hidden email]> wrote:
> > > > That's great news. First I've tried the embedded server version but I
> > > > had some classpath problems with the Compass version that we are
> > > > using. (we already have older lucene jars in our classpath). So I
> > > > decided to go on with TransportClient for the time being.
>
> > > > On Apr 8, 11:02 am, HubertChang <[hidden email]> wrote:
>
> > > > > I am working on an elasticsearch plugin for grails.
> > > > > github.com/hz/grails-elasticsearch. I use the embedded server to
> > > connect to
> > > > > elasticsearch.
> > > > > --
> > > > > View this message in context:
> > >http://n3.nabble.com/Newbie-question-for-TransportClient-tp705234p705...
> > > > > Sent from the ElasticSearch Users mailing list archive at Nabble.com.