Elasticsearch6.0 集成测试 found jar hell in test classpath

本贴最后更新于 2501 天前,其中的信息可能已经渤澥桑田

前提是使用 Idea 进行单框架的集成,其他工具没有尝试过.

问题来源

在参考 Elasticsearch 官方单元测试集成方式的时候,在编写自己的单元测试的时候,出现了让人郁闷的异常,这里我的单元测试是创建一个名称为"test-index"的索引,代码如下:

public class SampleTest extends ESIntegTestCase {

  @Test
  public void test() throws Exception {
       createIndex("test-index");
	   assertTrue(indexExists("test-index"));
    }
}

运行单元测试,出现以下异常:


java.lang.RuntimeException: found jar hell in test classpath

	at org.elasticsearch.bootstrap.BootstrapForTesting.<clinit>(BootstrapForTesting.java:92)
	at org.elasticsearch.test.ESTestCase.<clinit>(ESTestCase.java:186)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:348)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$2.run(RandomizedRunner.java:592)
Caused by: java.lang.IllegalStateException: jar hell!
duplicate jar[*****]
at org.elasticsearch.bootstrap.JarHell.parseClassPath(JarHell.java:142)
	at org.elasticsearch.bootstrap.JarHell.parseClassPath(JarHell.java:99)
	at org.elasticsearch.bootstrap.JarHell.checkJarHell(JarHell.java:90)
	at org.elasticsearch.bootstrap.BootstrapForTesting.<clinit>(BootstrapForTesting.java:90)
	... 4 more


Test ignored.
Exception in thread "Thread-1" java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.test.ESTestCase
	at java.lang.Thread.run(Thread.java:748)
	Suppressed: java.lang.IllegalStateException: No context information for thread: Thread[id=13, name=Thread-1, state=RUNNABLE, group=TGRP-SampleTest]. Is this thread running under a class com.carrotsearch.randomizedtesting.RandomizedRunner runner context? Add @RunWith(class com.carrotsearch.randomizedtesting.RandomizedRunner.class) to your test class. Make sure your code accesses random contexts within @BeforeClass and @AfterClass boundary (for example, static test class initializers are not permitted to access random contexts).
		at com.carrotsearch.randomizedtesting.RandomizedContext.context(RandomizedContext.java:248)
		at com.carrotsearch.randomizedtesting.RandomizedContext.current(RandomizedContext.java:134)
		at com.carrotsearch.randomizedtesting.RandomizedRunner.augmentStackTrace(RandomizedRunner.java:1848)
		at com.carrotsearch.randomizedtesting.RunnerThreadGroup.uncaughtException(RunnerThreadGroup.java:20)
		at java.lang.Thread.dispatchUncaughtException(Thread.java:1959)

我们看下一共出现了哪些异常,见下面的 ##问题和解决方法##

问题和解决方法

问题 1

  • ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...

解决方式:

在 pom.xml 文件添加 log4j-core 的依赖 jar 包,参考如下:

<dependency>
    <groupId>org.apache.logging.log4jgroupId>
    <artifactId>log4j-coreartifactId>
    <version>2.8.2version>
dependency>

问题 2

  • found jar hell in test classpath

解决方式:

  1. 在你的测试代码目录下创建一个包:org.elasticsearch.bootstrap

  2. 在 org.elasticsearch.bootstrap 包下创建 JarHell 类,源码如下:

    
    <dependencies>
        <dependency>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-test-framework</artifactId>
            <version>7.0.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.test</groupId>
            <artifactId>framework</artifactId>
            <version>6.0.0</version>
            <scope>test</scope>
        <dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.8.2</version>
        </dependency>
    <dependencies>
    
    

    重新运行单元测试,测试结果如下:

    [2017-11-23T21:57:29,271][INFO ][o.f.e.d.SampleTest       ] [test]: before test
    [2017-11-23T21:57:29,273][INFO ][o.f.e.d.SampleTest       ] [SampleTest#test]: setting up test
    [2017-11-23T21:57:29,286][INFO ][o.e.t.InternalTestCluster] Setup InternalTestCluster [SUITE-CHILD_VM=[0]-CLUSTER_SEED=[9180804499904000471]-HASH=[13F343E443BAE]-cluster] with seed [7F68C50CF915F1D7] using [0] dedicated masters, [3] (data) nodes and [1] coord only nodes (min_master_nodes are [auto-managed])
    [2017-11-23T21:57:29,580][INFO ][o.e.n.Node               ] [node_s0] initializing ...
    [2017-11-23T21:57:29,635][INFO ][o.e.e.NodeEnvironment    ] [node_s0] using [1] data paths, mounts [[/ (/dev/disk1)]], net usable_space [129.5gb], net total_space [232.6gb], types [hfs]
    [2017-11-23T21:57:29,635][INFO ][o.e.e.NodeEnvironment    ] [node_s0] heap size [3.5gb], compressed ordinary object pointers [true]
    [2017-11-23T21:57:29,637][INFO ][o.e.n.Node               ] [node_s0] node name [node_s0], node ID [pCcOJN9vQjqSeC8bsMCyxA]
    [2017-11-23T21:57:29,637][INFO ][o.e.n.Node               ] [node_s0] version[6.0.0], pid[44762], build[8f0685b/2017-11-10T18:41:22.859Z], OS[Mac OS X/10.12.6/x86_64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_144/25.144-b01]
    [2017-11-23T21:57:29,637][INFO ][o.e.n.Node               ] [node_s0] JVM arguments [-ea, -Dtests.security.manager=false, -Didea.test.cyclic.buffer.size=1048576, -javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=61668:/Applications/IntelliJ IDEA.app/Contents/bin, -Dfile.encoding=UTF-8]
    [2017-11-23T21:57:29,642][INFO ][o.e.p.PluginsService     ] [node_s0] no modules loaded
    [2017-11-23T21:57:29,643][INFO ][o.e.p.PluginsService     ] [node_s0] loaded plugin [org.elasticsearch.index.MockEngineFactoryPlugin]
    [2017-11-23T21:57:29,643][INFO ][o.e.p.PluginsService     ] [node_s0] loaded plugin [org.elasticsearch.node.NodeMocksPlugin]
    [2017-11-23T21:57:29,643][INFO ][o.e.p.PluginsService     ] [node_s0] loaded plugin [org.elasticsearch.search.MockSearchService$TestPlugin]
    [2017-11-23T21:57:29,643][INFO ][o.e.p.PluginsService     ] [node_s0] loaded plugin [org.elasticsearch.test.ESIntegTestCase$TestSeedPlugin]
    [2017-11-23T21:57:29,643][INFO ][o.e.p.PluginsService     ] [node_s0] loaded plugin [org.elasticsearch.test.discovery.TestZenDiscovery$TestPlugin]
    [2017-11-23T21:57:29,644][INFO ][o.e.p.PluginsService     ] [node_s0] loaded plugin [org.elasticsearch.test.store.MockFSIndexStore$TestPlugin]
    [2017-11-23T21:57:29,644][INFO ][o.e.p.PluginsService     ] [node_s0] loaded plugin [org.elasticsearch.test.transport.MockTransportService$TestPlugin]
    [2017-11-23T21:57:29,644][INFO ][o.e.p.PluginsService     ] [node_s0] loaded plugin [org.elasticsearch.transport.AssertingTransportInterceptor$TestPlugin]
    [2017-11-23T21:57:29,644][INFO ][o.e.p.PluginsService     ] [node_s0] loaded plugin [org.elasticsearch.transport.MockTcpTransportPlugin]
    [2017-11-23T21:57:30,919][INFO ][o.e.d.DiscoveryModule    ] [node_s0] using discovery type [test-zen]
    [2017-11-23T21:57:31,463][INFO ][o.e.n.Node               ] [node_s0] initialized
    [2017-11-23T21:57:31,468][INFO ][o.e.n.Node               ] [node_s1] initializing ...
    [2017-11-23T21:57:31,473][INFO ][o.e.e.NodeEnvironment    ] [node_s1] using [1] data paths, mounts [[/ (/dev/disk1)]], net usable_space [129.5gb], net total_space [232.6gb], types [hfs]
    [2017-11-23T21:57:31,473][INFO ][o.e.e.NodeEnvironment    ] [node_s1] heap size [3.5gb], compressed ordinary object pointers [true]
    [2017-11-23T21:57:31,473][INFO ][o.e.n.Node               ] [node_s1] node name [node_s1], node ID [JD1UL8tJTZafqwmXjfM_Vw]
    [2017-11-23T21:57:31,474][INFO ][o.e.n.Node               ] [node_s1] version[6.0.0], pid[44762], build[8f0685b/2017-11-10T18:41:22.859Z], OS[Mac OS X/10.12.6/x86_64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_144/25.144-b01]
    [2017-11-23T21:57:31,474][INFO ][o.e.n.Node               ] [node_s1] JVM arguments [-ea, -Dtests.security.manager=false, -Didea.test.cyclic.buffer.size=1048576, -javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=61668:/Applications/IntelliJ IDEA.app/Contents/bin, -Dfile.encoding=UTF-8]
    [2017-11-23T21:57:31,474][INFO ][o.e.p.PluginsService     ] [node_s1] no modules loaded
    [2017-11-23T21:57:31,474][INFO ][o.e.p.PluginsService     ] [node_s1] loaded plugin [org.elasticsearch.index.MockEngineFactoryPlugin]
    [2017-11-23T21:57:31,474][INFO ][o.e.p.PluginsService     ] [node_s1] loaded plugin [org.elasticsearch.node.NodeMocksPlugin]
    [2017-11-23T21:57:31,474][INFO ][o.e.p.PluginsService     ] [node_s1] loaded plugin [org.elasticsearch.search.MockSearchService$TestPlugin]
    [2017-11-23T21:57:31,474][INFO ][o.e.p.PluginsService     ] [node_s1] loaded plugin [org.elasticsearch.test.ESIntegTestCase$TestSeedPlugin]
    [2017-11-23T21:57:31,474][INFO ][o.e.p.PluginsService     ] [node_s1] loaded plugin [org.elasticsearch.test.discovery.TestZenDiscovery$TestPlugin]
    [2017-11-23T21:57:31,475][INFO ][o.e.p.PluginsService     ] [node_s1] loaded plugin [org.elasticsearch.test.store.MockFSIndexStore$TestPlugin]
    [2017-11-23T21:57:31,475][INFO ][o.e.p.PluginsService     ] [node_s1] loaded plugin [org.elasticsearch.test.transport.MockTransportService$TestPlugin]
    [2017-11-23T21:57:31,475][INFO ][o.e.p.PluginsService     ] [node_s1] loaded plugin [org.elasticsearch.transport.AssertingTransportInterceptor$TestPlugin]
    [2017-11-23T21:57:31,475][INFO ][o.e.p.PluginsService     ] [node_s1] loaded plugin [org.elasticsearch.transport.MockTcpTransportPlugin]
    [2017-11-23T21:57:31,494][INFO ][o.e.d.DiscoveryModule    ] [node_s1] using discovery type [test-zen]
    [2017-11-23T21:57:31,530][INFO ][o.e.n.Node               ] [node_s1] initialized
    [2017-11-23T21:57:31,534][INFO ][o.e.n.Node               ] [node_s2] initializing ...
    [2017-11-23T21:57:31,538][INFO ][o.e.e.NodeEnvironment    ] [node_s2] using [1] data paths, mounts [[/ (/dev/disk1)]], net usable_space [129.5gb], net total_space [232.6gb], types [hfs]
    [2017-11-23T21:57:31,538][INFO ][o.e.e.NodeEnvironment    ] [node_s2] heap size [3.5gb], compressed ordinary object pointers [true]
    [2017-11-23T21:57:31,539][INFO ][o.e.n.Node               ] [node_s2] node name [node_s2], node ID [9AtjFK_iSImBX-GovTgMyQ]
    [2017-11-23T21:57:31,539][INFO ][o.e.n.Node               ] [node_s2] version[6.0.0], pid[44762], build[8f0685b/2017-11-10T18:41:22.859Z], OS[Mac OS X/10.12.6/x86_64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_144/25.144-b01]
    [2017-11-23T21:57:31,539][INFO ][o.e.n.Node               ] [node_s2] JVM arguments [-ea, -Dtests.security.manager=false, -Didea.test.cyclic.buffer.size=1048576, -javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=61668:/Applications/IntelliJ IDEA.app/Contents/bin, -Dfile.encoding=UTF-8]
    [2017-11-23T21:57:31,540][INFO ][o.e.p.PluginsService     ] [node_s2] no modules loaded
    [2017-11-23T21:57:31,540][INFO ][o.e.p.PluginsService     ] [node_s2] loaded plugin [org.elasticsearch.index.MockEngineFactoryPlugin]
    [2017-11-23T21:57:31,540][INFO ][o.e.p.PluginsService     ] [node_s2] loaded plugin [org.elasticsearch.node.NodeMocksPlugin]
    [2017-11-23T21:57:31,540][INFO ][o.e.p.PluginsService     ] [node_s2] loaded plugin [org.elasticsearch.search.MockSearchService$TestPlugin]
    [2017-11-23T21:57:31,540][INFO ][o.e.p.PluginsService     ] [node_s2] loaded plugin [org.elasticsearch.test.ESIntegTestCase$TestSeedPlugin]
    [2017-11-23T21:57:31,540][INFO ][o.e.p.PluginsService     ] [node_s2] loaded plugin [org.elasticsearch.test.discovery.TestZenDiscovery$TestPlugin]
    [2017-11-23T21:57:31,540][INFO ][o.e.p.PluginsService     ] [node_s2] loaded plugin [org.elasticsearch.test.store.MockFSIndexStore$TestPlugin]
    [2017-11-23T21:57:31,540][INFO ][o.e.p.PluginsService     ] [node_s2] loaded plugin [org.elasticsearch.test.transport.MockTransportService$TestPlugin]
    [2017-11-23T21:57:31,540][INFO ][o.e.p.PluginsService     ] [node_s2] loaded plugin [org.elasticsearch.transport.AssertingTransportInterceptor$TestPlugin]
    [2017-11-23T21:57:31,540][INFO ][o.e.p.PluginsService     ] [node_s2] loaded plugin [org.elasticsearch.transport.MockTcpTransportPlugin]
    [2017-11-23T21:57:31,556][INFO ][o.e.d.DiscoveryModule    ] [node_s2] using discovery type [test-zen]
    [2017-11-23T21:57:31,593][INFO ][o.e.n.Node               ] [node_s2] initialized
    [2017-11-23T21:57:31,596][INFO ][o.e.n.Node               ] [node_sc3] initializing ...
    [2017-11-23T21:57:31,600][INFO ][o.e.e.NodeEnvironment    ] [node_sc3] using [1] data paths, mounts [[/ (/dev/disk1)]], net usable_space [129.5gb], net total_space [232.6gb], types [hfs]
    [2017-11-23T21:57:31,600][INFO ][o.e.e.NodeEnvironment    ] [node_sc3] heap size [3.5gb], compressed ordinary object pointers [true]
    [2017-11-23T21:57:31,601][INFO ][o.e.n.Node               ] [node_sc3] node name [node_sc3], node ID [-N3NCafBR-O1JHNvit89rg]
    [2017-11-23T21:57:31,601][INFO ][o.e.n.Node               ] [node_sc3] version[6.0.0], pid[44762], build[8f0685b/2017-11-10T18:41:22.859Z], OS[Mac OS X/10.12.6/x86_64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_144/25.144-b01]
    [2017-11-23T21:57:31,601][INFO ][o.e.n.Node               ] [node_sc3] JVM arguments [-ea, -Dtests.security.manager=false, -Didea.test.cyclic.buffer.size=1048576, -javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=61668:/Applications/IntelliJ IDEA.app/Contents/bin, -Dfile.encoding=UTF-8]
    [2017-11-23T21:57:31,602][INFO ][o.e.p.PluginsService     ] [node_sc3] no modules loaded
    [2017-11-23T21:57:31,602][INFO ][o.e.p.PluginsService     ] [node_sc3] loaded plugin [org.elasticsearch.index.MockEngineFactoryPlugin]
    [2017-11-23T21:57:31,602][INFO ][o.e.p.PluginsService     ] [node_sc3] loaded plugin [org.elasticsearch.node.NodeMocksPlugin]
    [2017-11-23T21:57:31,602][INFO ][o.e.p.PluginsService     ] [node_sc3] loaded plugin [org.elasticsearch.search.MockSearchService$TestPlugin]
    [2017-11-23T21:57:31,602][INFO ][o.e.p.PluginsService     ] [node_sc3] loaded plugin [org.elasticsearch.test.ESIntegTestCase$TestSeedPlugin]
    [2017-11-23T21:57:31,602][INFO ][o.e.p.PluginsService     ] [node_sc3] loaded plugin [org.elasticsearch.test.discovery.TestZenDiscovery$TestPlugin]
    [2017-11-23T21:57:31,602][INFO ][o.e.p.PluginsService     ] [node_sc3] loaded plugin [org.elasticsearch.test.store.MockFSIndexStore$TestPlugin]
    [2017-11-23T21:57:31,603][INFO ][o.e.p.PluginsService     ] [node_sc3] loaded plugin [org.elasticsearch.test.transport.MockTransportService$TestPlugin]
    [2017-11-23T21:57:31,603][INFO ][o.e.p.PluginsService     ] [node_sc3] loaded plugin [org.elasticsearch.transport.AssertingTransportInterceptor$TestPlugin]
    [2017-11-23T21:57:31,603][INFO ][o.e.p.PluginsService     ] [node_sc3] loaded plugin [org.elasticsearch.transport.MockTcpTransportPlugin]
    [2017-11-23T21:57:31,618][INFO ][o.e.d.DiscoveryModule    ] [node_sc3] using discovery type [test-zen]
    [2017-11-23T21:57:31,648][INFO ][o.e.n.Node               ] [node_sc3] initialized
    [2017-11-23T21:57:31,653][INFO ][o.e.n.Node               ] [node_s0] starting ...
    [2017-11-23T21:57:31,653][INFO ][o.e.n.Node               ] [node_s2] starting ...
    [2017-11-23T21:57:31,653][INFO ][o.e.n.Node               ] [node_s1] starting ...
    [2017-11-23T21:57:31,653][INFO ][o.e.n.Node               ] [node_sc3] starting ...
    [2017-11-23T21:57:31,672][INFO ][o.e.t.t.MockTransportService] [node_sc3] publish_address {127.0.0.1:9400}, bound_addresses {[fe80::1]:9400}, {[::1]:9400}, {127.0.0.1:9400}
    [2017-11-23T21:57:31,672][INFO ][o.e.t.t.MockTransportService] [node_s0] publish_address {127.0.0.1:9402}, bound_addresses {[fe80::1]:9402}, {[::1]:9401}, {127.0.0.1:9402}
    [2017-11-23T21:57:31,672][INFO ][o.e.t.t.MockTransportService] [node_s2] publish_address {127.0.0.1:9403}, bound_addresses {[fe80::1]:9401}, {[::1]:9403}, {127.0.0.1:9403}
    [2017-11-23T21:57:31,672][INFO ][o.e.t.t.MockTransportService] [node_s1] publish_address {127.0.0.1:9401}, bound_addresses {[fe80::1]:9403}, {[::1]:9402}, {127.0.0.1:9401}
    [2017-11-23T21:57:31,703][INFO ][o.e.t.d.MockZenPing      ] [node_s2] pinging using mock zen ping
    [2017-11-23T21:57:31,703][INFO ][o.e.t.d.MockZenPing      ] [node_s1] pinging using mock zen ping
    [2017-11-23T21:57:31,703][INFO ][o.e.t.d.MockZenPing      ] [node_s0] pinging using mock zen ping
    [2017-11-23T21:57:31,703][INFO ][o.e.t.d.MockZenPing      ] [node_sc3] pinging using mock zen ping
    [2017-11-23T21:57:31,813][INFO ][o.e.c.s.MasterService    ] [node_s2] zen-disco-elected-as-master ([1] nodes joined)[{node_s0}{pCcOJN9vQjqSeC8bsMCyxA}{F90SN69rSt2IL7hfG0vCrw}{127.0.0.1}{127.0.0.1:9402}], zen-disco-node-join[{node_s1}{JD1UL8tJTZafqwmXjfM_Vw}{uVdNVr8zSCigujYJf1nI-g}{127.0.0.1}{127.0.0.1:9401}], reason: new_master {node_s2}{9AtjFK_iSImBX-GovTgMyQ}{h1KGFtA5T1itCPLVKvbWvA}{127.0.0.1}{127.0.0.1:9403}, added {{node_s1}{JD1UL8tJTZafqwmXjfM_Vw}{uVdNVr8zSCigujYJf1nI-g}{127.0.0.1}{127.0.0.1:9401},{node_s0}{pCcOJN9vQjqSeC8bsMCyxA}{F90SN69rSt2IL7hfG0vCrw}{127.0.0.1}{127.0.0.1:9402},}
    [2017-11-23T21:57:31,828][INFO ][o.e.c.s.ClusterApplierService] [node_s0] detected_master {node_s2}{9AtjFK_iSImBX-GovTgMyQ}{h1KGFtA5T1itCPLVKvbWvA}{127.0.0.1}{127.0.0.1:9403}, added {{node_s1}{JD1UL8tJTZafqwmXjfM_Vw}{uVdNVr8zSCigujYJf1nI-g}{127.0.0.1}{127.0.0.1:9401},{node_s2}{9AtjFK_iSImBX-GovTgMyQ}{h1KGFtA5T1itCPLVKvbWvA}{127.0.0.1}{127.0.0.1:9403},}, reason: apply cluster state (from master [master {node_s2}{9AtjFK_iSImBX-GovTgMyQ}{h1KGFtA5T1itCPLVKvbWvA}{127.0.0.1}{127.0.0.1:9403} committed version [1]])
    [2017-11-23T21:57:31,828][INFO ][o.e.c.s.ClusterApplierService] [node_s1] detected_master {node_s2}{9AtjFK_iSImBX-GovTgMyQ}{h1KGFtA5T1itCPLVKvbWvA}{127.0.0.1}{127.0.0.1:9403}, added {{node_s2}{9AtjFK_iSImBX-GovTgMyQ}{h1KGFtA5T1itCPLVKvbWvA}{127.0.0.1}{127.0.0.1:9403},{node_s0}{pCcOJN9vQjqSeC8bsMCyxA}{F90SN69rSt2IL7hfG0vCrw}{127.0.0.1}{127.0.0.1:9402},}, reason: apply cluster state (from master [master {node_s2}{9AtjFK_iSImBX-GovTgMyQ}{h1KGFtA5T1itCPLVKvbWvA}{127.0.0.1}{127.0.0.1:9403} committed version [1]])
    [2017-11-23T21:57:31,841][INFO ][o.e.n.Node               ] [node_s0] started
    [2017-11-23T21:57:31,841][INFO ][o.e.n.Node               ] [node_s1] started
    [2017-11-23T21:57:31,843][INFO ][o.e.c.s.ClusterApplierService] [node_s2] new_master {node_s2}{9AtjFK_iSImBX-GovTgMyQ}{h1KGFtA5T1itCPLVKvbWvA}{127.0.0.1}{127.0.0.1:9403}, added {{node_s1}{JD1UL8tJTZafqwmXjfM_Vw}{uVdNVr8zSCigujYJf1nI-g}{127.0.0.1}{127.0.0.1:9401},{node_s0}{pCcOJN9vQjqSeC8bsMCyxA}{F90SN69rSt2IL7hfG0vCrw}{127.0.0.1}{127.0.0.1:9402},}, reason: apply cluster state (from master [master {node_s2}{9AtjFK_iSImBX-GovTgMyQ}{h1KGFtA5T1itCPLVKvbWvA}{127.0.0.1}{127.0.0.1:9403} committed version [1] source [zen-disco-elected-as-master ([1] nodes joined)[{node_s0}{pCcOJN9vQjqSeC8bsMCyxA}{F90SN69rSt2IL7hfG0vCrw}{127.0.0.1}{127.0.0.1:9402}], zen-disco-node-join[{node_s1}{JD1UL8tJTZafqwmXjfM_Vw}{uVdNVr8zSCigujYJf1nI-g}{127.0.0.1}{127.0.0.1:9401}]]])
    [2017-11-23T21:57:31,847][INFO ][o.e.n.Node               ] [node_s2] started
    [2017-11-23T21:57:31,851][INFO ][o.e.c.s.MasterService    ] [node_s2] zen-disco-node-join[{node_sc3}{-N3NCafBR-O1JHNvit89rg}{bhbfD7YCSsKUBAtch1B_qg}{127.0.0.1}{127.0.0.1:9400}], reason: added {{node_sc3}{-N3NCafBR-O1JHNvit89rg}{bhbfD7YCSsKUBAtch1B_qg}{127.0.0.1}{127.0.0.1:9400},}
    [2017-11-23T21:57:31,874][INFO ][o.e.c.s.ClusterApplierService] [node_s1] added {{node_sc3}{-N3NCafBR-O1JHNvit89rg}{bhbfD7YCSsKUBAtch1B_qg}{127.0.0.1}{127.0.0.1:9400},}, reason: apply cluster state (from master [master {node_s2}{9AtjFK_iSImBX-GovTgMyQ}{h1KGFtA5T1itCPLVKvbWvA}{127.0.0.1}{127.0.0.1:9403} committed version [2]])
    [2017-11-23T21:57:31,873][INFO ][o.e.c.s.ClusterApplierService] [node_sc3] detected_master {node_s2}{9AtjFK_iSImBX-GovTgMyQ}{h1KGFtA5T1itCPLVKvbWvA}{127.0.0.1}{127.0.0.1:9403}, added {{node_s1}{JD1UL8tJTZafqwmXjfM_Vw}{uVdNVr8zSCigujYJf1nI-g}{127.0.0.1}{127.0.0.1:9401},{node_s2}{9AtjFK_iSImBX-GovTgMyQ}{h1KGFtA5T1itCPLVKvbWvA}{127.0.0.1}{127.0.0.1:9403},{node_s0}{pCcOJN9vQjqSeC8bsMCyxA}{F90SN69rSt2IL7hfG0vCrw}{127.0.0.1}{127.0.0.1:9402},}, reason: apply cluster state (from master [master {node_s2}{9AtjFK_iSImBX-GovTgMyQ}{h1KGFtA5T1itCPLVKvbWvA}{127.0.0.1}{127.0.0.1:9403} committed version [2]])
    [2017-11-23T21:57:31,874][INFO ][o.e.c.s.ClusterApplierService] [node_s0] added {{node_sc3}{-N3NCafBR-O1JHNvit89rg}{bhbfD7YCSsKUBAtch1B_qg}{127.0.0.1}{127.0.0.1:9400},}, reason: apply cluster state (from master [master {node_s2}{9AtjFK_iSImBX-GovTgMyQ}{h1KGFtA5T1itCPLVKvbWvA}{127.0.0.1}{127.0.0.1:9403} committed version [2]])
    [2017-11-23T21:57:31,883][INFO ][o.e.n.Node               ] [node_sc3] started
    [2017-11-23T21:57:31,884][INFO ][o.e.c.s.ClusterApplierService] [node_s2] added {{node_sc3}{-N3NCafBR-O1JHNvit89rg}{bhbfD7YCSsKUBAtch1B_qg}{127.0.0.1}{127.0.0.1:9400},}, reason: apply cluster state (from master [master {node_s2}{9AtjFK_iSImBX-GovTgMyQ}{h1KGFtA5T1itCPLVKvbWvA}{127.0.0.1}{127.0.0.1:9403} committed version [2] source [zen-disco-node-join[{node_sc3}{-N3NCafBR-O1JHNvit89rg}{bhbfD7YCSsKUBAtch1B_qg}{127.0.0.1}{127.0.0.1:9400}]]])
    [2017-11-23T21:57:31,886][INFO ][o.e.p.PluginsService     ] [transport_client_node_sc3] no modules loaded
    [2017-11-23T21:57:31,886][INFO ][o.e.p.PluginsService     ] [transport_client_node_sc3] loaded plugin [org.elasticsearch.transport.MockTcpTransportPlugin]
    [2017-11-23T21:57:31,895][INFO ][o.e.g.GatewayService     ] [node_s2] recovered [0] indices into cluster_state
    [2017-11-23T21:57:31,952][INFO ][o.e.p.PluginsService     ] [transport_client_node_s2] no modules loaded
    [2017-11-23T21:57:31,953][INFO ][o.e.p.PluginsService     ] [transport_client_node_s2] loaded plugin [org.elasticsearch.transport.MockTcpTransportPlugin]
    [2017-11-23T21:57:32,123][INFO ][o.f.e.d.SampleTest       ] [SampleTest#test]: all set up test
    [2017-11-23T21:57:32,124][INFO ][o.e.p.PluginsService     ] [transport_client_node_s1] no modules loaded
    [2017-11-23T21:57:32,125][INFO ][o.e.p.PluginsService     ] [transport_client_node_s1] loaded plugin [org.elasticsearch.transport.MockTcpTransportPlugin]
    [2017-11-23T21:57:32,228][INFO ][o.e.c.m.MetaDataCreateIndexService] [node_s2] [test-index] creating index, cause [api], templates [random_index_template], shards [4]/[0], mappings []
    [2017-11-23T21:57:32,531][INFO ][o.e.c.r.a.AllocationService] [node_s2] Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[test-index][1], [test-index][3]] ...]).
    [2017-11-23T21:57:32,551][INFO ][o.f.e.d.SampleTest       ] [SampleTest#test]: cleaning up after test
    [2017-11-23T21:57:32,566][INFO ][o.e.p.PluginsService     ] [transport_client_node_s0] no modules loaded
    [2017-11-23T21:57:32,566][INFO ][o.e.p.PluginsService     ] [transport_client_node_s0] loaded plugin [org.elasticsearch.transport.MockTcpTransportPlugin]
    [2017-11-23T21:57:32,664][INFO ][o.e.c.m.MetaDataDeleteIndexService] [node_s2] [test-index/PQ0jLcgnQ-yyV9-d4-MQLw] deleting index
    [2017-11-23T21:57:32,674][INFO ][o.e.t.s.MockFSIndexStore$Listener] [node_s0] [test-index][1] start check index
    [2017-11-23T21:57:32,675][INFO ][o.e.t.s.MockFSIndexStore$Listener] [node_s1] [test-index][0] start check index
    [2017-11-23T21:57:32,687][INFO ][o.e.t.s.MockFSIndexStore$Listener] [node_s0] [test-index][1] end check index
    [2017-11-23T21:57:32,687][INFO ][o.e.t.s.MockFSIndexStore$Listener] [node_s1] [test-index][0] end check index
    [2017-11-23T21:57:32,694][INFO ][o.e.t.s.MockFSIndexStore$Listener] [node_s1] [test-index][3] start check index
    [2017-11-23T21:57:32,695][INFO ][o.e.t.s.MockFSIndexStore$Listener] [node_s1] [test-index][3] end check index
    [2017-11-23T21:57:32,703][INFO ][o.e.t.s.MockFSIndexStore$Listener] [node_s2] [test-index][2] start check index
    [2017-11-23T21:57:32,708][INFO ][o.e.t.s.MockFSIndexStore$Listener] [node_s2] [test-index][2] end check index
    [2017-11-23T21:57:32,732][INFO ][o.f.e.d.SampleTest       ] [SampleTest#test]: cleaned up after test
    [2017-11-23T21:57:32,733][INFO ][o.f.e.d.SampleTest       ] [test]: after test
    
    

    其中输出日志有有一句:

    [2017-11-23T21:57:32,228][INFO ][o.e.c.m.MetaDataCreateIndexService] [node_s2] [test-index] creating index, cause [api], templates [random_index_template], shards [4]/[0], mappings []
    

    表示测试成功,终于可以开心的去用 Elasticsearch 官方提供的单元测试框架来测试 Elasticsearch 强大的各种功能和原理.

    参考

  • Elasticsearch

    Elasticsearch 是一个基于 Lucene 的搜索服务器。它提供了一个分布式多用户能力的全文搜索引擎,基于 RESTful 接口。Elasticsearch 是用 Java 开发的,并作为 Apache 许可条款下的开放源码发布,是当前流行的企业级搜索引擎。设计用于云计算中,能够达到实时搜索,稳定,可靠,快速,安装使用方便。

    117 引用 • 99 回帖 • 211 关注

相关帖子

欢迎来到这里!

我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。

注册 关于
请输入回帖内容 ...
felayman
专注于系统架构以及搜索服务 北京

推荐标签 标签

  • Angular

    AngularAngularJS 的新版本。

    26 引用 • 66 回帖 • 537 关注
  • Hprose

    Hprose 是一款先进的轻量级、跨语言、跨平台、无侵入式、高性能动态远程对象调用引擎库。它不仅简单易用,而且功能强大。你无需专门学习,只需看上几眼,就能用它轻松构建分布式应用系统。

    9 引用 • 17 回帖 • 609 关注
  • IPFS

    IPFS(InterPlanetary File System,星际文件系统)是永久的、去中心化保存和共享文件的方法,这是一种内容可寻址、版本化、点对点超媒体的分布式协议。请浏览 IPFS 入门笔记了解更多细节。

    21 引用 • 245 回帖 • 241 关注
  • Lute

    Lute 是一款结构化的 Markdown 引擎,支持 Go 和 JavaScript。

    25 引用 • 191 回帖 • 16 关注
  • 京东

    京东是中国最大的自营式电商企业,2015 年第一季度在中国自营式 B2C 电商市场的占有率为 56.3%。2014 年 5 月,京东在美国纳斯达克证券交易所正式挂牌上市(股票代码:JD),是中国第一个成功赴美上市的大型综合型电商平台,与腾讯、百度等中国互联网巨头共同跻身全球前十大互联网公司排行榜。

    14 引用 • 102 回帖 • 375 关注
  • 黑曜石

    黑曜石是一款强大的知识库工具,支持本地 Markdown 文件编辑,支持双向链接和关系图。

    A second brain, for you, forever.

    15 引用 • 122 回帖
  • 人工智能

    人工智能(Artificial Intelligence)是研究、开发用于模拟、延伸和扩展人的智能的理论、方法、技术及应用系统的一门技术科学。

    133 引用 • 189 回帖 • 1 关注
  • Tomcat

    Tomcat 最早是由 Sun Microsystems 开发的一个 Servlet 容器,在 1999 年被捐献给 ASF(Apache Software Foundation),隶属于 Jakarta 项目,现在已经独立为一个顶级项目。Tomcat 主要实现了 JavaEE 中的 Servlet、JSP 规范,同时也提供 HTTP 服务,是市场上非常流行的 Java Web 容器。

    162 引用 • 529 回帖 • 1 关注
  • API

    应用程序编程接口(Application Programming Interface)是一些预先定义的函数,目的是提供应用程序与开发人员基于某软件或硬件得以访问一组例程的能力,而又无需访问源码,或理解内部工作机制的细节。

    77 引用 • 430 回帖
  • Jenkins

    Jenkins 是一套开源的持续集成工具。它提供了非常丰富的插件,让构建、部署、自动化集成项目变得简单易用。

    53 引用 • 37 回帖 • 1 关注
  • ReactiveX

    ReactiveX 是一个专注于异步编程与控制可观察数据(或者事件)流的 API。它组合了观察者模式,迭代器模式和函数式编程的优秀思想。

    1 引用 • 2 回帖 • 156 关注
  • CSS

    CSS(Cascading Style Sheet)“层叠样式表”是用于控制网页样式并允许将样式信息与网页内容分离的一种标记性语言。

    198 引用 • 550 回帖 • 3 关注
  • JWT

    JWT(JSON Web Token)是一种用于双方之间传递信息的简洁的、安全的表述性声明规范。JWT 作为一个开放的标准(RFC 7519),定义了一种简洁的,自包含的方法用于通信双方之间以 JSON 的形式安全的传递信息。

    20 引用 • 15 回帖 • 3 关注
  • Ant-Design

    Ant Design 是服务于企业级产品的设计体系,基于确定和自然的设计价值观上的模块化解决方案,让设计者和开发者专注于更好的用户体验。

    17 引用 • 23 回帖 • 1 关注
  • ActiveMQ

    ActiveMQ 是 Apache 旗下的一款开源消息总线系统,它完整实现了 JMS 规范,是一个企业级的消息中间件。

    19 引用 • 13 回帖 • 673 关注
  • Laravel

    Laravel 是一套简洁、优雅的 PHP Web 开发框架。它采用 MVC 设计,是一款崇尚开发效率的全栈框架。

    20 引用 • 23 回帖 • 723 关注
  • Openfire

    Openfire 是开源的、基于可拓展通讯和表示协议 (XMPP)、采用 Java 编程语言开发的实时协作服务器。Openfire 的效率很高,单台服务器可支持上万并发用户。

    6 引用 • 7 回帖 • 95 关注
  • wolai

    我来 wolai:不仅仅是未来的云端笔记!

    2 引用 • 14 回帖
  • AngularJS

    AngularJS 诞生于 2009 年,由 Misko Hevery 等人创建,后为 Google 所收购。是一款优秀的前端 JS 框架,已经被用于 Google 的多款产品当中。AngularJS 有着诸多特性,最为核心的是:MVC、模块化、自动化双向数据绑定、语义化标签、依赖注入等。2.0 版本后已经改名为 Angular。

    12 引用 • 50 回帖 • 476 关注
  • Scala

    Scala 是一门多范式的编程语言,集成面向对象编程和函数式编程的各种特性。

    13 引用 • 11 回帖 • 134 关注
  • Dubbo

    Dubbo 是一个分布式服务框架,致力于提供高性能和透明化的 RPC 远程服务调用方案,是 [阿里巴巴] SOA 服务化治理方案的核心框架,每天为 2,000+ 个服务提供 3,000,000,000+ 次访问量支持,并被广泛应用于阿里巴巴集团的各成员站点。

    60 引用 • 82 回帖 • 597 关注
  • GAE

    Google App Engine(GAE)是 Google 管理的数据中心中用于 WEB 应用程序的开发和托管的平台。2008 年 4 月 发布第一个测试版本。目前支持 Python、Java 和 Go 开发部署。全球已有数十万的开发者在其上开发了众多的应用。

    14 引用 • 42 回帖 • 764 关注
  • Bug

    Bug 本意是指臭虫、缺陷、损坏、犯贫、窃听器、小虫等。现在人们把在程序中一些缺陷或问题统称为 bug(漏洞)。

    75 引用 • 1737 回帖 • 1 关注
  • 电影

    这是一个不能说的秘密。

    121 引用 • 601 回帖
  • Google

    Google(Google Inc.,NASDAQ:GOOG)是一家美国上市公司(公有股份公司),于 1998 年 9 月 7 日以私有股份公司的形式创立,设计并管理一个互联网搜索引擎。Google 公司的总部称作“Googleplex”,它位于加利福尼亚山景城。Google 目前被公认为是全球规模最大的搜索引擎,它提供了简单易用的免费服务。不作恶(Don't be evil)是谷歌公司的一项非正式的公司口号。

    49 引用 • 192 回帖
  • flomo

    flomo 是新一代 「卡片笔记」 ,专注在碎片化时代,促进你的记录,帮你积累更多知识资产。

    5 引用 • 107 回帖
  • RabbitMQ

    RabbitMQ 是一个开源的 AMQP 实现,服务器端用 Erlang 语言编写,支持多种语言客户端,如:Python、Ruby、.NET、Java、C、PHP、ActionScript 等。用于在分布式系统中存储转发消息,在易用性、扩展性、高可用性等方面表现不俗。

    49 引用 • 60 回帖 • 361 关注