當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。