当前位置: 首页>>代码示例>>Java>>正文


Java Node.start方法代码示例

本文整理汇总了Java中org.elasticsearch.node.Node.start方法的典型用法代码示例。如果您正苦于以下问题:Java Node.start方法的具体用法?Java Node.start怎么用?Java Node.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.node.Node的用法示例。


在下文中一共展示了Node.start方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startNodes

import org.elasticsearch.node.Node; //导入方法依赖的package包/类
public void startNodes() {
    for (Node node : nodes) {
        try {
            getClusterService(node).addListener(new TribeClusterStateListener(node));
            node.start();
        } catch (Exception e) {
            // calling close is safe for non started nodes, we can just iterate over all
            for (Node otherNode : nodes) {
                try {
                    otherNode.close();
                } catch (Exception inner) {
                    inner.addSuppressed(e);
                    logger.warn((Supplier<?>) () -> new ParameterizedMessage("failed to close node {} on failed start", otherNode), inner);
                }
            }
            if (e instanceof RuntimeException) {
                throw (RuntimeException) e;
            }
            throw new ElasticsearchException(e);
        }
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:23,代码来源:TribeService.java

示例2: doStart

import org.elasticsearch.node.Node; //导入方法依赖的package包/类
@Override
protected void doStart() {
    for (Node node : nodes) {
        try {
            node.start();
        } catch (Throwable e) {
            // calling close is safe for non started nodes, we can just iterate over all
            for (Node otherNode : nodes) {
                try {
                    otherNode.close();
                } catch (Throwable t) {
                    logger.warn("failed to close node {} on failed start", t, otherNode);
                }
            }
            if (e instanceof RuntimeException) {
                throw (RuntimeException) e;
            }
            throw new ElasticsearchException(e.getMessage(), e);
        }
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:22,代码来源:TribeService.java

示例3: startESNode

import org.elasticsearch.node.Node; //导入方法依赖的package包/类
private static Node startESNode(String clusterName)
{

    Settings nodeSettings = Settings.settingsBuilder()
    		.put("path.home", "target")
    		.put("transport.tcp.port", "9600-9700")
            .put("http.port", "9500")
            .put("http.max_content_length", "100M").build();

    Node node = NodeBuilder.nodeBuilder()
    		.settings(nodeSettings)
    		.clusterName(clusterName).node();

    node.start();

    return node;
}
 
开发者ID:WedjaaOpen,项目名称:ElasticParser,代码行数:18,代码来源:ESSearchTest.java

示例4: startNode

import org.elasticsearch.node.Node; //导入方法依赖的package包/类
/**
 * Start a closed node.
 *
 * @param i
 * @return true if the node is started.
 */
@SuppressWarnings("resource")
public boolean startNode(final int i) {
    if (i >= nodeList.size()) {
        return false;
    }
    if (!nodeList.get(i).isClosed()) {
        return false;
    }
    final Node node = new ClusterRunnerNode(settingsList.get(i), pluginList);
    try {
        node.start();
        nodeList.set(i, node);
        return true;
    } catch (final NodeValidationException e) {
        print(e.getLocalizedMessage());
    }
    return false;
}
 
开发者ID:codelibs,项目名称:elasticsearch-cluster-runner,代码行数:25,代码来源:ElasticsearchClusterRunner.java

示例5: main

import org.elasticsearch.node.Node; //导入方法依赖的package包/类
public static void main(String[] args) throws Throwable {
    Settings.Builder settings = Settings.builder();
    settings.put("http.cors.enabled", "true");
    settings.put("http.cors.allow-origin", "*");
    settings.put("cluster.name", AzureRepositoryF.class.getSimpleName());

    // Example for azure repo settings
    // settings.put("cloud.azure.storage.my_account1.account", "account_name");
    // settings.put("cloud.azure.storage.my_account1.key", "account_key");
    // settings.put("cloud.azure.storage.my_account1.default", true);
    // settings.put("cloud.azure.storage.my_account2.account", "account_name");
    // settings.put("cloud.azure.storage.my_account2.key", "account_key_secondary");

    final CountDownLatch latch = new CountDownLatch(1);
    final Node node = new MockNode(settings.build(), Collections.singletonList(AzureRepositoryPlugin.class));
    Runtime.getRuntime().addShutdownHook(new Thread() {
        @Override
        public void run() {
            try {
                IOUtils.close(node);
            } catch (IOException e) {
                throw new ElasticsearchException(e);
            } finally {
                latch.countDown();
            }
        }
    });
    node.start();
    latch.await();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:31,代码来源:AzureRepositoryF.java

示例6: beforeClass

import org.elasticsearch.node.Node; //导入方法依赖的package包/类
@BeforeClass
public static void beforeClass() throws IOException {
  ServerSocket serverSocket = new ServerSocket(0);
  int esHttpPort = serverSocket.getLocalPort();
  serverSocket.close();
  LOG.info("Starting embedded Elasticsearch instance ({})", esHttpPort);
  Settings.Builder settingsBuilder =
      Settings.settingsBuilder()
          .put("cluster.name", "beam")
          .put("http.enabled", "true")
          .put("node.data", "true")
          .put("path.data", TEMPORARY_FOLDER.getRoot().getPath())
          .put("path.home", TEMPORARY_FOLDER.getRoot().getPath())
          .put("node.name", "beam")
          .put("network.host", ES_IP)
          .put("http.port", esHttpPort)
          .put("index.store.stats_refresh_interval", 0)
          // had problems with some jdk, embedded ES was too slow for bulk insertion,
          // and queue of 50 was full. No pb with real ES instance (cf testWrite integration test)
          .put("threadpool.bulk.queue_size", 100);
  node = new Node(settingsBuilder.build());
  LOG.info("Elasticsearch node created");
  node.start();
  connectionConfiguration = ConnectionConfiguration
      .create(new String[] { "http://" + ES_IP + ":" + esHttpPort }, ES_INDEX, ES_TYPE);
  restClient = connectionConfiguration.createClient();
  elasticsearchIOTestCommon = new ElasticsearchIOTestCommon(connectionConfiguration, restClient,
      false);
}
 
开发者ID:apache,项目名称:beam,代码行数:30,代码来源:ElasticsearchIOTest.java

示例7: activateElasticSearch

import org.elasticsearch.node.Node; //导入方法依赖的package包/类
@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();
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:31,代码来源:ESFilesystemSupport.java

示例8: startCluster

import org.elasticsearch.node.Node; //导入方法依赖的package包/类
public final ClusterInfo startCluster(final NodeSettingsSupplier nodeSettingsSupplier, ClusterConfiguration clusterConfiguration, int timeout, Integer nodes)
		throws Exception {
    
	if (!esNodes.isEmpty()) {
		throw new RuntimeException("There are still " + esNodes.size() + " nodes instantiated, close them first.");
	}

	FileUtils.deleteDirectory(new File("data/"+clustername));

	List<NodeSettings> internalNodeSettings = clusterConfiguration.getNodeSettings();

	for (int i = 0; i < internalNodeSettings.size(); i++) {
		NodeSettings setting = internalNodeSettings.get(i);
		
		Node node = new PluginAwareNode(
				getMinimumNonSgNodeSettingsBuilder(i, setting.masterNode, setting.dataNode, setting.tribeNode, internalNodeSettings.size(), clusterConfiguration.getMasterNodes())
						.put(nodeSettingsSupplier == null ? Settings.Builder.EMPTY_SETTINGS : nodeSettingsSupplier.get(i)).build(),
				Netty4Plugin.class, SearchGuardPlugin.class, MatrixAggregationPlugin.class, MustachePlugin.class, ParentJoinPlugin.class, PercolatorPlugin.class, ReindexPlugin.class);
		System.out.println(node.settings());
		node.start();
		esNodes.add(node);
		Thread.sleep(200);
	}
	ClusterInfo cInfo = waitForCluster(ClusterHealthStatus.GREEN, TimeValue.timeValueSeconds(timeout), nodes == null?esNodes.size():nodes.intValue());
	cInfo.numNodes = internalNodeSettings.size();
	cInfo.clustername = clustername;
	return cInfo;
}
 
开发者ID:floragunncom,项目名称:search-guard,代码行数:29,代码来源:ClusterHelper.java

示例9: createNode

import org.elasticsearch.node.Node; //导入方法依赖的package包/类
public static Node createNode() {
    Settings nodeSettings = Settings.settingsBuilder()
            .put("path.home", System.getProperty("path.home"))
            .put("client.type", "node")
            .put("index.number_of_shards", 5)
            .put("index.number_of_replica", 0)
            .build();
    // ES 2.1 renders NodeBuilder as useless
    Node node = new MockNode(nodeSettings, AggregationPlugin.class);
    node.start();
    return node;
}
 
开发者ID:jprante,项目名称:elasticsearch-aggregations,代码行数:13,代码来源:NodeTestUtils.java

示例10: createNode

import org.elasticsearch.node.Node; //导入方法依赖的package包/类
public static Node createNode() {
    Settings nodeSettings = Settings.settingsBuilder()
            .put("path.home", System.getProperty("path.home"))
            .put("client.type", "node")
            .put("index.number_of_shards", 1)
            .put("index.number_of_replica", 0)
            .build();
    // ES 2.1 renders NodeBuilder as useless
    Node node = new MockNode(nodeSettings, SyslogPlugin.class);
    node.start();
    return node;
}
 
开发者ID:jprante,项目名称:elasticsearch-syslog,代码行数:13,代码来源:NodeTestUtils.java

示例11: getClient

import org.elasticsearch.node.Node; //导入方法依赖的package包/类
public static synchronized Client getClient(boolean isclient, String dbname) {
	if (clientMap.containsKey(dbname)) {
		return clientMap.get(dbname);
	} else {
		Client client;
		Node node = nodeBuilder().clusterName(dbname).local(false).client(isclient).node();
		node.start();
		nodeList.add(node);
		client = node.client();
		clientMap.put(dbname, client);
		return client;
	}
}
 
开发者ID:Ryan-ZA,项目名称:async-elastic-orm,代码行数:14,代码来源:ESClientHolder.java

示例12: createNode

import org.elasticsearch.node.Node; //导入方法依赖的package包/类
public static Node createNode() {
    Settings nodeSettings = Settings.settingsBuilder()
            .put("path.home", System.getProperty("path.home"))
            .put("index.number_of_shards", 1)
            .put("index.number_of_replica", 0)
            .build();
    Node node = new MockNode(nodeSettings, SimplePlugin.class);
    node.start();
    return node;
}
 
开发者ID:jprante,项目名称:elasticsearch-simple-action-plugin,代码行数:11,代码来源:NodeTestUtils.java

示例13: createNodeWithoutPlugin

import org.elasticsearch.node.Node; //导入方法依赖的package包/类
public static Node createNodeWithoutPlugin() {
    Settings nodeSettings = Settings.settingsBuilder()
            .put("path.home", System.getProperty("path.home"))
            .put("index.number_of_shards", 1)
            .put("index.number_of_replica", 0)
            .build();
    Node node = new MockNode(nodeSettings);
    node.start();
    return node;
}
 
开发者ID:jprante,项目名称:elasticsearch-simple-action-plugin,代码行数:11,代码来源:NodeTestUtils.java


注:本文中的org.elasticsearch.node.Node.start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。