本文整理了Java中org.elasticsearch.node.Node.<init>()
方法的一些代码示例,展示了Node.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.<init>()
方法的具体详情如下:
包路径:org.elasticsearch.node.Node
类名称:Node
方法名:<init>
[英]Constructs a node with the given settings.
[中]使用给定的设置构造一个节点。
代码示例来源:origin: SonarSource/sonarqube
private static Node createNode() {
try {
Path tempDir = Files.createTempDirectory("EsTester");
tempDir.toFile().deleteOnExit();
Settings settings = Settings.builder()
.put(Environment.PATH_HOME_SETTING.getKey(), tempDir)
.put("node.name", "EsTester")
.put(NodeEnvironment.MAX_LOCAL_STORAGE_NODES_SETTING.getKey(), Integer.MAX_VALUE)
.put("logger.level", "INFO")
.put("action.auto_create_index", false)
// Default the watermarks to absurdly low to prevent the tests
// from failing on nodes without enough disk space
.put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), "1b")
.put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING.getKey(), "1b")
// always reduce this - it can make tests really slow
.put(RecoverySettings.INDICES_RECOVERY_RETRY_DELAY_STATE_SYNC_SETTING.getKey(), TimeValue.timeValueMillis(20))
.put(NetworkModule.TRANSPORT_TYPE_KEY, "local")
.put(NetworkModule.HTTP_ENABLED.getKey(), false)
.put(DiscoveryModule.DISCOVERY_TYPE_SETTING.getKey(), "single-node")
.build();
Node node = new Node(settings);
return node.start();
} catch (Exception e) {
throw new IllegalStateException("Fail to start embedded Elasticsearch", e);
}
}
}
代码示例来源:origin: harbby/presto-connectors
/**
* Builds the node without starting it.
*/
public Node build() {
return new Node(settings.build());
}
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
public Node newNode(Settings settings, Collection<Class<? extends Plugin>> classpathPlugins) {
Settings nodeSettings = nodeSettings(settings);
System.out.println("node settings="+nodeSettings.getAsMap());
System.out.println("node plugins="+classpathPlugins);
this.node = new Node(nodeSettings, classpathPlugins);
return this.node;
}
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
/** Constructs an internal node used as a client into a cluster fronted by this tribe node. */
protected Node newTribeClientNode(Settings settings, Collection<Class<? extends Plugin>> classpathPlugins) {
return new Node(new Environment(settings), classpathPlugins);
}
代码示例来源:origin: searchhub/preDict
private Node newNode() {
File tempDir = Files.createTempDir();
Settings settings = Settings.builder()
.put(Environment.PATH_HOME_SETTING.getKey(), tempDir)
.put("node.name", "node_s_0")
.put(NetworkModule.HTTP_ENABLED.getKey(), false)
.put("transport.type", "local")
.put(Node.NODE_DATA_SETTING.getKey(), true)
.build();
Node build = new Node(settings);
try {
build.start();
} catch (NodeValidationException e) {
throw new RuntimeException(e);
}
return build;
}
代码示例来源:origin: com.jeromeloisel/db-integration-test
@Bean(destroyMethod="close")
Node newNode() throws NodeValidationException {
final Path tempDir = createTempDir().toPath();
final Settings settings = Settings.builder()
.put(ClusterName.CLUSTER_NAME_SETTING.getKey(), new ClusterName("single-node-cluster" + System.nanoTime()))
.put(Environment.PATH_HOME_SETTING.getKey(), tempDir)
.put(Environment.PATH_REPO_SETTING.getKey(), tempDir.resolve("repo"))
.put(Environment.PATH_SHARED_DATA_SETTING.getKey(), createTempDir().getParent())
.put("node.name", "single-node")
.put("script.inline", "true")
.put("script.stored", "true")
.put(ScriptService.SCRIPT_MAX_COMPILATIONS_PER_MINUTE.getKey(), 1000)
.put(EsExecutors.PROCESSORS_SETTING.getKey(), 1)
.put(NetworkModule.HTTP_ENABLED.getKey(), false)
.put("discovery.type", "zen")
.put("transport.type", "local")
.put(Node.NODE_DATA_SETTING.getKey(), true)
.put(NODE_ID_SEED_SETTING.getKey(), System.nanoTime())
.build();
return new Node(settings).start(); // NOSONAR
}
代码示例来源:origin: jloisel/elastic-crud
@Bean(destroyMethod="close")
Node newNode() throws NodeValidationException {
final Path tempDir = createTempDir().toPath();
final Settings settings = Settings.builder()
.put(ClusterName.CLUSTER_NAME_SETTING.getKey(), new ClusterName("single-node-cluster" + System.nanoTime()))
.put(Environment.PATH_HOME_SETTING.getKey(), tempDir)
.put(Environment.PATH_REPO_SETTING.getKey(), tempDir.resolve("repo"))
.put(Environment.PATH_SHARED_DATA_SETTING.getKey(), createTempDir().getParent())
.put("node.name", "single-node")
.put("script.inline", "true")
.put("script.stored", "true")
.put(ScriptService.SCRIPT_MAX_COMPILATIONS_PER_MINUTE.getKey(), 1000)
.put(EsExecutors.PROCESSORS_SETTING.getKey(), 1)
.put(NetworkModule.HTTP_ENABLED.getKey(), false)
.put("discovery.type", "zen")
.put("transport.type", "local")
.put(Node.NODE_DATA_SETTING.getKey(), true)
.put(NODE_ID_SEED_SETTING.getKey(), System.nanoTime())
.build();
return new Node(settings).start(); // NOSONAR
}
代码示例来源:origin: apache/attic-polygene-java
@Override
protected void activateElasticSearch()
throws Exception
{
configuration.refresh();
ElasticSearchIndexingConfiguration config = configuration.get();
String clusterName = config.clusterName().get() == null ? DEFAULT_CLUSTER_NAME : config.clusterName().get();
index = config.index().get() == null ? DEFAULT_INDEX_NAME : config.index().get();
indexNonAggregatedAssociations = config.indexNonAggregatedAssociations().get();
Identity identity = hasIdentity.identity().get();
File homeDir = new File( new File( fileConfig.temporaryDirectory(), identity.toString() ), "home" );
File logsDir = new File( fileConfig.logDirectory(), identity.toString() );
File dataDir = new File( fileConfig.dataDirectory(), identity.toString() );
File confDir = new File( fileConfig.configurationDirectory(), identity.toString() );
Stream.of( homeDir, logsDir, dataDir, confDir ).forEach( File::mkdirs );
Settings settings = Settings.builder()
.put( "cluster.name", clusterName )
.put( "path.home", homeDir.getAbsolutePath() )
.put( "path.logs", logsDir.getAbsolutePath() )
.put( "path.data", dataDir.getAbsolutePath() )
.put( "path.conf", confDir.getAbsolutePath() )
.put( "transport.type", "local" )
.put( "http.enabled", false )
.build();
node = new Node( settings );
node.start();
client = node.client();
}
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
this.node = new Node(getSettings(), pluginList);
内容来源于网络,如有侵权,请联系作者删除!