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


Java PluginAwareNode类代码示例

本文整理汇总了Java中org.elasticsearch.node.PluginAwareNode的典型用法代码示例。如果您正苦于以下问题:Java PluginAwareNode类的具体用法?Java PluginAwareNode怎么用?Java PluginAwareNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: testNodeClientAllowedWithServerCertificate

import org.elasticsearch.node.PluginAwareNode; //导入依赖的package包/类
@SuppressWarnings("resource")
@Test
public void testNodeClientAllowedWithServerCertificate() throws Exception {
    setup();
    Assert.assertEquals(3, clusterHelper.nodeClient().admin().cluster().health(new ClusterHealthRequest().waitForGreenStatus()).actionGet().getNumberOfNodes());
    Assert.assertEquals(ClusterHealthStatus.GREEN, clusterHelper.nodeClient().admin().cluster().health(new ClusterHealthRequest().waitForGreenStatus()).actionGet().getStatus());

    
    final Settings tcSettings = Settings.builder()
            .put(minimumSearchGuardSettings(Settings.EMPTY).get(0))
            .put("cluster.name", clusterInfo.clustername)
            .put("node.data", false)
            .put("node.master", false)
            .put("node.ingest", false)
            .put("path.home", ".")
            .build();

    log.debug("Start node client");
    
    try (Node node = new PluginAwareNode(tcSettings, Netty4Plugin.class, SearchGuardPlugin.class).start()) {
        Thread.sleep(50);
        Assert.assertEquals(4, node.client().admin().cluster().nodesInfo(new NodesInfoRequest()).actionGet().getNodes().size());    
    }
}
 
开发者ID:floragunncom,项目名称:search-guard,代码行数:25,代码来源:IntegrationTests.java

示例2: testNodeClientDisallowedWithNonServerCertificate

import org.elasticsearch.node.PluginAwareNode; //导入依赖的package包/类
@SuppressWarnings("resource")
@Test
public void testNodeClientDisallowedWithNonServerCertificate() throws Exception {
    setup();
    Assert.assertEquals(3, clusterHelper.nodeClient().admin().cluster().health(new ClusterHealthRequest().waitForGreenStatus()).actionGet().getNumberOfNodes());
    Assert.assertEquals(ClusterHealthStatus.GREEN, clusterHelper.nodeClient().admin().cluster().health(new ClusterHealthRequest().waitForGreenStatus()).actionGet().getStatus());

    
    final Settings tcSettings = Settings.builder()
            .put(minimumSearchGuardSettings(Settings.EMPTY).get(0))
            .put("cluster.name", clusterInfo.clustername)
            .put("node.data", false)
            .put("node.master", false)
            .put("node.ingest", false)
            .put("path.home", ".")
            .put("searchguard.ssl.transport.keystore_filepath", FileHelper.getAbsoluteFilePathFromClassPath("kirk-keystore.jks"))
            .put(SSLConfigConstants.SEARCHGUARD_SSL_TRANSPORT_KEYSTORE_ALIAS,"kirk")
            .build();

    log.debug("Start node client");
    
    try (Node node = new PluginAwareNode(tcSettings, Netty4Plugin.class, SearchGuardPlugin.class).start()) {
        Thread.sleep(50);
        Assert.assertEquals(1, node.client().admin().cluster().nodesInfo(new NodesInfoRequest()).actionGet().getNodes().size());    
    }
}
 
开发者ID:floragunncom,项目名称:search-guard,代码行数:27,代码来源:IntegrationTests.java

示例3: testNodeClientDisallowedWithNonServerCertificate2

import org.elasticsearch.node.PluginAwareNode; //导入依赖的package包/类
@SuppressWarnings("resource")
@Test
public void testNodeClientDisallowedWithNonServerCertificate2() throws Exception {
    setup();
    Assert.assertEquals(3, clusterHelper.nodeClient().admin().cluster().health(new ClusterHealthRequest().waitForGreenStatus()).actionGet().getNumberOfNodes());
    Assert.assertEquals(ClusterHealthStatus.GREEN, clusterHelper.nodeClient().admin().cluster().health(new ClusterHealthRequest().waitForGreenStatus()).actionGet().getStatus());
 
    final Settings tcSettings = Settings.builder()
            .put(minimumSearchGuardSettings(Settings.EMPTY).get(0))
            .put("cluster.name", clusterInfo.clustername)
            .put("node.data", false)
            .put("node.master", false)
            .put("node.ingest", false)
            .put("path.home", ".")
            .put("searchguard.ssl.transport.keystore_filepath", FileHelper.getAbsoluteFilePathFromClassPath("spock-keystore.jks"))
            .put(SSLConfigConstants.SEARCHGUARD_SSL_TRANSPORT_KEYSTORE_ALIAS,"spock")
            .build();

    log.debug("Start node client");
    
    try (Node node = new PluginAwareNode(tcSettings, Netty4Plugin.class, SearchGuardPlugin.class).start()) {
        Thread.sleep(50);
        Assert.assertEquals(1, node.client().admin().cluster().nodesInfo(new NodesInfoRequest()).actionGet().getNodes().size());    
    }
}
 
开发者ID:floragunncom,项目名称:search-guard,代码行数:26,代码来源:IntegrationTests.java

示例4: startES

import org.elasticsearch.node.PluginAwareNode; //导入依赖的package包/类
public final void startES(final Settings settings) throws Exception {

        FileUtils.deleteDirectory(new File("data"));

        esNode1 = new PluginAwareNode(getDefaultSettingsBuilder(1, false, true).put(
                settings == null ? Settings.Builder.EMPTY_SETTINGS : settings).build(), Netty4Plugin.class, SearchGuardSSLPlugin.class);
        esNode2 = new PluginAwareNode(getDefaultSettingsBuilder(2, true, true).put(
                settings == null ? Settings.Builder.EMPTY_SETTINGS : settings).build(), Netty4Plugin.class, SearchGuardSSLPlugin.class);
        esNode3 = new PluginAwareNode(getDefaultSettingsBuilder(3, true, false).put(
                settings == null ? Settings.Builder.EMPTY_SETTINGS : settings).build(), Netty4Plugin.class, SearchGuardSSLPlugin.class);

        esNode1.start();
        esNode2.start();
        esNode3.start();

        waitForGreenClusterState(esNode1.client());
    }
 
开发者ID:floragunncom,项目名称:search-guard-ssl,代码行数:18,代码来源:AbstractUnitTest.java

示例5: startCluster

import org.elasticsearch.node.PluginAwareNode; //导入依赖的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

示例6: testNodeClientSSL

import org.elasticsearch.node.PluginAwareNode; //导入依赖的package包/类
@Test
public void testNodeClientSSL() throws Exception {

    final Settings settings = Settings.builder().put("searchguard.ssl.transport.enabled", true)
            .put(SSLConfigConstants.SEARCHGUARD_SSL_HTTP_ENABLE_OPENSSL_IF_AVAILABLE, allowOpenSSL)
            .put(SSLConfigConstants.SEARCHGUARD_SSL_TRANSPORT_ENABLE_OPENSSL_IF_AVAILABLE, allowOpenSSL)
            .put(SSLConfigConstants.SEARCHGUARD_SSL_TRANSPORT_KEYSTORE_ALIAS, "node-0")
            .put("searchguard.ssl.transport.keystore_filepath", getAbsoluteFilePathFromClassPath("node-0-keystore.jks"))
            .put("searchguard.ssl.transport.truststore_filepath", getAbsoluteFilePathFromClassPath("truststore.jks"))
            .put("searchguard.ssl.transport.enforce_hostname_verification", false)
            .put("searchguard.ssl.transport.resolve_hostname", false)
            .build();

    startES(settings);      

    final Settings tcSettings = Settings.builder().put("cluster.name", clustername).put("path.home", ".")
            .put(settings)// -----
            .build();

    try (Node node = new PluginAwareNode(tcSettings, Netty4Plugin.class, SearchGuardSSLPlugin.class).start()) {
        ClusterHealthResponse res = node.client().admin().cluster().health(new ClusterHealthRequest().waitForNodes("4").timeout(TimeValue.timeValueSeconds(5))).actionGet();
        Assert.assertFalse(res.isTimedOut());
        Assert.assertEquals(4, res.getNumberOfNodes());
        Assert.assertEquals(4, node.client().admin().cluster().nodesInfo(new NodesInfoRequest()).actionGet().getNodes().size());
    }

    Assert.assertFalse(executeSimpleRequest("_nodes/stats?pretty").contains("\"tx_size_in_bytes\" : 0"));
    Assert.assertFalse(executeSimpleRequest("_nodes/stats?pretty").contains("\"rx_count\" : 0"));
    Assert.assertFalse(executeSimpleRequest("_nodes/stats?pretty").contains("\"rx_size_in_bytes\" : 0"));
    Assert.assertFalse(executeSimpleRequest("_nodes/stats?pretty").contains("\"tx_count\" : 0"));
}
 
开发者ID:floragunncom,项目名称:search-guard-ssl,代码行数:32,代码来源:SSLTest.java

示例7: start

import org.elasticsearch.node.PluginAwareNode; //导入依赖的package包/类
public static void start(Map<String, Object> settings, boolean embeddedMode) throws Exception {

        Settings.Builder builder = Settings.settingsBuilder();

        for(String key: settings.keySet()) {
            builder.put(key, String.valueOf(settings.get(key)));
        }
        
        if(embeddedMode) {
            try {
                FileUtils.forceDelete(new File("./data"));
            } catch (Exception e) {
                //ignore
            }
            builder.put("path.home",".");
            builder.put("node.local", true);
            builder.put("http.cors.enabled", true);
            builder.put("http.cors.allow-origin", "*");
            builder.put("cluster.name", "imap-embedded-"+System.currentTimeMillis());
            node = new PluginAwareNode(builder.build(), (Collection) Lists.newArrayList(MapperAttachmentsPlugin.class));
            node.start();
            client = node.client();
        }else
        {
            Settings eSettings = builder.build();
            client = new TransportClient.Builder().settings(eSettings).build();
            String[] hosts = eSettings.get("elasticsearch.hosts").split(",");
            
            for (int i = 0; i < hosts.length; i++) {
                String host = hosts[i];
                String hostOnly = host.split(":")[0];
                String portOnly = host.split(":")[1];
                System.out.println("Adding "+hostOnly+":"+portOnly);
                ((TransportClient)client).addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(hostOnly), Integer.parseInt(portOnly)));
            }
        }
        imap = new IMAPImporter(settings, client);
        imap.start();
    }
 
开发者ID:salyh,项目名称:elasticsearch-imap,代码行数:40,代码来源:IMAPImporterCl.java

示例8: setUp

import org.elasticsearch.node.PluginAwareNode; //导入依赖的package包/类
@Before
public void setUp() throws Exception {

    System.out.println("--------------------- SETUP " + name.getMethodName() + " -------------------------------------");

    FileUtils.deleteQuietly(new File("target/data/"));
    
    MockMailbox.resetAll();

    // Instantiates a local node & client

    esSetup =  new PluginAwareNode(getSettingsBuilder(false, true).build(), (Collection) Lists.newArrayList(MapperAttachmentsPlugin.class)).start();
    esSetup2 = new PluginAwareNode(getSettingsBuilder(true, false).build(), (Collection) Lists.newArrayList(MapperAttachmentsPlugin.class)).start();
    esSetup3 = new PluginAwareNode(getSettingsBuilder(false, true).build(), (Collection) Lists.newArrayList(MapperAttachmentsPlugin.class)).start();
    
    waitForGreenClusterState(esSetup.client());

}
 
开发者ID:salyh,项目名称:elasticsearch-imap,代码行数:19,代码来源:AbstractIMAPRiverUnitTest.java


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