mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-25 01:19:02 +00:00
more work on cloud
This commit is contained in:
parent
b7bcc6ccb6
commit
4c53422428
@ -19,7 +19,7 @@
|
||||
|
||||
package org.elasticsearch.cloud;
|
||||
|
||||
import org.elasticsearch.cloud.blobstore.CloudBlobstoreService;
|
||||
import org.elasticsearch.cloud.blobstore.CloudBlobStoreService;
|
||||
import org.elasticsearch.cloud.compute.CloudComputeService;
|
||||
import org.elasticsearch.util.guice.inject.AbstractModule;
|
||||
|
||||
@ -30,6 +30,6 @@ public class CloudModule extends AbstractModule {
|
||||
|
||||
@Override protected void configure() {
|
||||
bind(CloudComputeService.class).asEagerSingleton();
|
||||
bind(CloudBlobstoreService.class).asEagerSingleton();
|
||||
bind(CloudBlobStoreService.class).asEagerSingleton();
|
||||
}
|
||||
}
|
||||
|
@ -37,6 +37,8 @@ public class CloudDiscovery extends ZenDiscovery {
|
||||
public CloudDiscovery(Settings settings, ClusterName clusterName, ThreadPool threadPool, TransportService transportService,
|
||||
ClusterService clusterService, ZenPingService pingService, CloudComputeService computeService) {
|
||||
super(settings, clusterName, threadPool, transportService, clusterService, pingService);
|
||||
pingService.zenPings(ImmutableList.of(new CloudZenPing(settings, threadPool, transportService, clusterName, computeService)));
|
||||
if (settings.getAsBoolean("cloud.enabled", true)) {
|
||||
pingService.zenPings(ImmutableList.of(new CloudZenPing(settings, threadPool, transportService, clusterName, computeService)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,10 +48,13 @@ public class CloudZenPing extends UnicastZenPing {
|
||||
|
||||
private final String ports;
|
||||
|
||||
private final String tag;
|
||||
|
||||
public CloudZenPing(Settings settings, ThreadPool threadPool, TransportService transportService, ClusterName clusterName,
|
||||
CloudComputeService computeService) {
|
||||
super(settings, threadPool, transportService, clusterName);
|
||||
this.computeService = computeService;
|
||||
this.tag = componentSettings.get("tag");
|
||||
this.ports = componentSettings.get("ports", "9300-9302");
|
||||
// parse the ports just to see that they are valid
|
||||
new PortsRange(ports).ports();
|
||||
@ -62,6 +65,9 @@ public class CloudZenPing extends UnicastZenPing {
|
||||
Map<String, ? extends ComputeMetadata> nodes = computeService.context().getComputeService().getNodes();
|
||||
for (Map.Entry<String, ? extends ComputeMetadata> node : nodes.entrySet()) {
|
||||
NodeMetadata nodeMetadata = computeService.context().getComputeService().getNodeMetadata(node.getValue());
|
||||
if (tag != null && !nodeMetadata.getTag().equals(tag)) {
|
||||
continue;
|
||||
}
|
||||
if (nodeMetadata.getState() == NodeState.PENDING || nodeMetadata.getState() == NodeState.RUNNING) {
|
||||
logger.debug("Adding {}/{}", nodeMetadata.getName(), nodeMetadata.getPrivateAddresses());
|
||||
for (InetAddress inetAddress : nodeMetadata.getPrivateAddresses()) {
|
||||
|
@ -20,7 +20,7 @@
|
||||
package org.elasticsearch.plugin.cloud;
|
||||
|
||||
import org.elasticsearch.cloud.CloudModule;
|
||||
import org.elasticsearch.cloud.blobstore.CloudBlobstoreService;
|
||||
import org.elasticsearch.cloud.blobstore.CloudBlobStoreService;
|
||||
import org.elasticsearch.cloud.compute.CloudComputeService;
|
||||
import org.elasticsearch.plugins.AbstractPlugin;
|
||||
import org.elasticsearch.util.component.LifecycleComponent;
|
||||
@ -62,7 +62,7 @@ public class CloudPlugin extends AbstractPlugin {
|
||||
Collection<Class<? extends LifecycleComponent>> services = newArrayList();
|
||||
if (settings.getAsBoolean("cloud.enabled", true)) {
|
||||
services.add(CloudComputeService.class);
|
||||
services.add(CloudBlobstoreService.class);
|
||||
services.add(CloudBlobStoreService.class);
|
||||
}
|
||||
return services;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user