Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to connect to ES Cluster because of blank ES Cluster name and HOST properties #8

Open
preetpuri opened this issue Jul 7, 2015 · 4 comments

Comments

@preetpuri
Copy link

In the Elastic Search ClientFactory.java makeClient() (under static class Transport) method is not getting elastic search properties from settings map instead it tries to get HOST and CLUSTER name from storm configuration map (in which these are not present).

@OverRide
public TransportClient makeClient(Map conf) {
String clusterHosts = (String)settings.get(HOSTS); // instead of conf.get(HOSTS);
String clusterName = (String)settings.get(NAME); // instead of conf.get(NAME);
Preconditions.checkNotNull(clusterHosts,"no setting found for Transport Client, make sure that you set property " + HOSTS);
........................

@fhussonnois
Copy link
Owner

Hi,
I am confused because everything seems correct into the class : ClientFactory.java#L68

@preetpuri
Copy link
Author

The settings we are passing to ClientFactoty.Transport (see below) method has all the ES related configuration but in the makeClient method of Transport class we are picking ES host and name properties from different configuration map (which contains only storm related configurations not the one which we set)??

Settings settings = ImmutableSettings.settingsBuilder().put("storm.elasticsearch.hosts", "localhost").put("storm.elasticsearch.cluster.name", "testingcluster").build();

StateFactory stateFactory = ESIndexMapState.nonTransactional(new ClientFactory.Transport(settings.getAsMap()), Map.class);

@fhussonnois
Copy link
Owner

Actually, properties should be set into the storm configuration :

StormTopology topology = ...
LocalCluster cluster = new LocalCluster();
Config config = new Config();
config.put("storm.elasticsearch.cluster.name", "my-cluster");
config.put("storm.elasticsearch.hosts", "localhost");
cluster.submitTopology("elastic-storm", new Config(), topology);

Then, you can instantiate your StateFactory as follows :

StateFactory stateFactory = ESIndexMapState.nonTransactional(new ClientFactory.Transport(), Map.class);

@preetpuri
Copy link
Author

Yes it can be done that way but then what kind of settings should we set in Transport class?
public Transport(Map<String, String> settings) {
this.settings = settings;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants