Providing transport addresses through yml file

Hi,
I know we can create TransportClient with something like - new TransportClient(settings).addTransportAddress(new InetSocketTransportAddress(host, port));
But here, I have to explicitly provide host and port info in my code.

I tried to get the instance of Transport Client solely through configuration properties in yml file. But it does not seem to work. I am getting "NoNodeAvailableException".
Here's content of my yml file -

cluster.name: elasticsearch-test
node.name: test-client
node.master: false
node.data: false
node.client: true
http.enabled: false
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: "192.168.1.8:9300"

And here's what I am doing to get instance of TransportClient

Builder builder = ImmutableSettings.settingsBuilder().loadFromClasspath("elasticsearch_test.yml");
TransportClient baseClient = new TransportClient(builder.build());

Call to baseClient.transportAddresses() returns null list object.

Is there any way to completely instantiate TransportClient without any explicit java code changes to add transport addresses?

Thanks
Ashish

Hi Ashish,

maybe that what you're looking for:

transport.host: eth1:ipv4

Greetings,
Sebastian

2012/6/13 Ashish Nigam ashish@skyhighnetworks.com

Hi,
I know we can create TransportClient with something like - new
TransportClient(settings).addTransportAddress(new
InetSocketTransportAddress(host, port));
But here, I have to explicitly provide host and port info in my code.

I tried to get the instance of Transport Client solely through
configuration properties in yml file. But it does not seem to work. I am
getting "NoNodeAvailableException".
Here's content of my yml file -

cluster.name: elasticsearch-test
node.name: test-client
node.master: false
node.data: false
node.client: true
http.enabled: false
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: "192.168.1.8:9300"

And here's what I am doing to get instance of TransportClient

Builder builder = ImmutableSettings.settingsBuilder().loadFromClasspath(
"elasticsearch_test.yml");
TransportClient baseClient = new TransportClient(builder.build());

Call to baseClient.transportAddresses() returns null list object.

Is there any way to completely instantiate TransportClient without any
explicit java code changes to add transport addresses?

Thanks
Ashish

Isn't transport.host is used to bind to or publish a certain IP address of a node?
If yes, then it cannot be used to specify remote host that will used to connect to for discovery.
But I did try both of the following settings, and neither of it works -

transport.host: 192.168.1.8
http_host: 192.168.1.8

I get same NoNodeNameAvailable exception.

On Jun 13, 2012, at 2:46 AM, Sebastian Wendel wrote:

Hi Ashish,

maybe that what you're looking for:

transport.host: eth1:ipv4

Greetings,
Sebastian

2012/6/13 Ashish Nigam ashish@skyhighnetworks.com
Hi,
I know we can create TransportClient with something like - new TransportClient(settings).addTransportAddress(new InetSocketTransportAddress(host, port));
But here, I have to explicitly provide host and port info in my code.

I tried to get the instance of Transport Client solely through configuration properties in yml file. But it does not seem to work. I am getting "NoNodeAvailableException".
Here's content of my yml file -

cluster.name: elasticsearch-test
node.name: test-client
node.master: false
node.data: false
node.client: true
http.enabled: false
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: "192.168.1.8:9300"

And here's what I am doing to get instance of TransportClient

Builder builder = ImmutableSettings.settingsBuilder().loadFromClasspath("elasticsearch_test.yml");
TransportClient baseClient = new TransportClient(builder.build());

Call to baseClient.transportAddresses() returns null list object.

Is there any way to completely instantiate TransportClient without any explicit java code changes to add transport addresses?

Thanks
Ashish

You can't provide the addresses in the yml file for the transport client.
The ones you set below configure it for node client unicast discovery.

On Wed, Jun 13, 2012 at 5:56 AM, Ashish Nigam ashish@skyhighnetworks.comwrote:

Hi,
I know we can create TransportClient with something like - new
TransportClient(settings).addTransportAddress(new
InetSocketTransportAddress(host, port));
But here, I have to explicitly provide host and port info in my code.

I tried to get the instance of Transport Client solely through
configuration properties in yml file. But it does not seem to work. I am
getting "NoNodeAvailableException".
Here's content of my yml file -

cluster.name: elasticsearch-test
node.name: test-client
node.master: false
node.data: false
node.client: true
http.enabled: false
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: "192.168.1.8:9300"

And here's what I am doing to get instance of TransportClient

Builder builder = ImmutableSettings.settingsBuilder().loadFromClasspath(
"elasticsearch_test.yml");
TransportClient baseClient = new TransportClient(builder.build());

Call to baseClient.transportAddresses() returns null list object.

Is there any way to completely instantiate TransportClient without any
explicit java code changes to add transport addresses?

Thanks
Ashish