1. 程式人生 > >Elasticsearch學習--ES原始碼下載、匯入及執行

Elasticsearch學習--ES原始碼下載、匯入及執行

原始碼下載

    1、在github上可以下載其釋出的任意一個版本 地址:https://github.com/elastic/elasticsearch/releases

匯入

   1、 Elasticsearch使用gradle對依賴的jar進行維護,工程可以轉為Eclipse或者IDEA的工程。解壓elasticsearch-6.1.3.zip,在其目錄下執行gradle eclipse就可以將elasticsearch的工程轉為eclipse工程了,轉換時間比較長。


    2、接下來就將轉換好的工程匯入到Eclipse中即可,匯入的工程在core目錄下main和cli兩個工程

    匯入main工程

  

    匯入cli工程

    

執行

    1、將工程匯入到Eclipse中,接下來就需要執行,在core的main工程中找到Elasticsearch類,其有main函式就可以啟動,但是在啟動前需要做一些配置,elasticsearch在啟動時需要工作路徑、配置檔案路徑等等,可以下載一個elasticsearch將其相關的配置檔案等複製到工程的執行目錄下如下:


2、執行elacticsearch的工程需要在jvm options中配置其配置檔案路徑及工作目錄,配置如下:


-Des.path.conf=F:\elasticsearch\elasticsearch-config\config
-Delasticsearch
-Dlog4j2.disable.jmx=true
-Des.path.home=F:\elasticsearch\elasticsearch-config

-Des.path.conf :配置elasticsearch的elasticsearch.yml等配置檔案路徑


-Des.path.home:配置elasticsearch的執行空間地址

接下來在core工程中找到Elasticsearch類,執行main函式就可以看到Elasticsearch的啟動,啟動日誌如下:

[2018-05-27T17:10:32,944][INFO ][o.e.n.Node               ] [] initializing ...
[2018-05-27T17:10:36,273][INFO ][o.e.e.NodeEnvironment    ] [6Ff7VQm] using [1] data paths, mounts [[(F:)]], net usable_space [95.2gb], net total_space [103gb], types [NTFS]
[2018-05-27T17:10:36,274][INFO ][o.e.e.NodeEnvironment    ] [6Ff7VQm] heap size [869.5mb], compressed ordinary object pointers [true]
[2018-05-27T17:10:36,276][INFO ][o.e.n.Node               ] node name [6Ff7VQm] derived from node ID [6Ff7VQmjTJ-6MMNtFnpo5A]; set [node.name] to override
[2018-05-27T17:10:36,277][INFO ][o.e.n.Node               ] version[6.1.3-SNAPSHOT], pid[3700], build[Unknown/Unknown], OS[Windows 8.1/6.3/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_144/25.144-b01]
[2018-05-27T17:10:36,277][INFO ][o.e.n.Node               ] JVM arguments [-agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:60576, -Des.path.conf=F:\elasticeasrch\config, -Delasticsearch, -Dlog4j2.disable.jmx=true, -Des.path.home=F:\elasticeasrch, -Dfile.encoding=UTF-8]
[2018-05-27T17:10:36,277][WARN ][o.e.n.Node               ] version [6.1.3-SNAPSHOT] is a pre-release version of Elasticsearch and is not suitable for production
[2018-05-27T17:11:09,797][INFO ][o.e.p.PluginsService     ] [6Ff7VQm] loaded module [aggs-matrix-stats]
[2018-05-27T17:11:09,797][INFO ][o.e.p.PluginsService     ] [6Ff7VQm] loaded module [analysis-common]
[2018-05-27T17:11:09,797][INFO ][o.e.p.PluginsService     ] [6Ff7VQm] loaded module [ingest-common]
[2018-05-27T17:11:09,797][INFO ][o.e.p.PluginsService     ] [6Ff7VQm] loaded module [lang-expression]
[2018-05-27T17:11:09,798][INFO ][o.e.p.PluginsService     ] [6Ff7VQm] loaded module [lang-mustache]
[2018-05-27T17:11:09,798][INFO ][o.e.p.PluginsService     ] [6Ff7VQm] loaded module [lang-painless]
[2018-05-27T17:11:09,798][INFO ][o.e.p.PluginsService     ] [6Ff7VQm] loaded module [mapper-extras]
[2018-05-27T17:11:09,798][INFO ][o.e.p.PluginsService     ] [6Ff7VQm] loaded module [parent-join]
[2018-05-27T17:11:09,798][INFO ][o.e.p.PluginsService     ] [6Ff7VQm] loaded module [percolator]
[2018-05-27T17:11:09,798][INFO ][o.e.p.PluginsService     ] [6Ff7VQm] loaded module [reindex]
[2018-05-27T17:11:09,799][INFO ][o.e.p.PluginsService     ] [6Ff7VQm] loaded module [repository-url]
[2018-05-27T17:11:09,799][INFO ][o.e.p.PluginsService     ] [6Ff7VQm] loaded module [transport-netty4]
[2018-05-27T17:11:09,799][INFO ][o.e.p.PluginsService     ] [6Ff7VQm] loaded module [tribe]
[2018-05-27T17:11:09,800][INFO ][o.e.p.PluginsService     ] [6Ff7VQm] no plugins loaded
[2018-05-27T17:11:10,877][INFO ][i.n.u.i.PlatformDependent] Your platform does not provide complete low-level API for accessing direct buffers reliably. Unless explicitly requested, heap buffer will always be preferred to avoid potential system instability.
[2018-05-27T17:11:25,726][INFO ][o.e.d.DiscoveryModule    ] [6Ff7VQm] using discovery type [zen]
[2018-05-27T17:11:30,399][INFO ][o.e.n.Node               ] initialized
[2018-05-27T17:11:30,400][INFO ][o.e.n.Node               ] [6Ff7VQm] starting ...
[2018-05-27T17:11:31,436][INFO ][o.e.t.TransportService   ] [6Ff7VQm] publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}, {[::1]:9300}
[2018-05-27T17:11:31,538][WARN ][o.e.b.BootstrapChecks    ] [6Ff7VQm] initial heap size [65011712] not equal to maximum heap size [1025507328]; this can cause resize pauses and prevents mlockall from locking the entire heap
[2018-05-27T17:11:35,122][INFO ][o.e.c.s.MasterService    ] [6Ff7VQm] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {6Ff7VQm}{6Ff7VQmjTJ-6MMNtFnpo5A}{djMfS1nOT3SmiGWr9IIR5A}{127.0.0.1}{127.0.0.1:9300}
[2018-05-27T17:11:35,153][INFO ][o.e.c.s.ClusterApplierService] [6Ff7VQm] new_master {6Ff7VQm}{6Ff7VQmjTJ-6MMNtFnpo5A}{djMfS1nOT3SmiGWr9IIR5A}{127.0.0.1}{127.0.0.1:9300}, reason: apply cluster state (from master [master {6Ff7VQm}{6Ff7VQmjTJ-6MMNtFnpo5A}{djMfS1nOT3SmiGWr9IIR5A}{127.0.0.1}{127.0.0.1:9300} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]])
[2018-05-27T17:11:35,333][INFO ][o.e.h.n.Netty4HttpServerTransport] [6Ff7VQm] publish_address {127.0.0.1:9200}, bound_addresses {127.0.0.1:9200}, {[::1]:9200}
[2018-05-27T17:11:35,334][INFO ][o.e.n.Node               ] [6Ff7VQm] started
[2018-05-27T17:11:35,417][INFO ][o.e.g.GatewayService     ] [6Ff7VQm] recovered [0] indices into cluster_state