ElasticSearch 2.1 启动过程

2018-01-07  本文已影响0人  唐西铭

猜测

如果是我自己来写这样一个系统,那么启动过程会是怎样呢?

接下来,就带着这样一个想法去看看它是怎么实现的。

实现过程

初始化

系统由org.elasticsearch.bootstrap.Elasticsearch中的main开始,其中主要的过程在org.elasticsearch.bootstrap.Bootstrap中的init完成。

$java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

节点的创建与启动

org.elasticsearch.node

image.png
[2018-05-07 20:46:57,782][INFO ][node                     ] [es-local] version[2.1.0-SNAPSHOT], pid[28348], build[NA/NA]
[2018-05-07 20:46:57,782][INFO ][node                     ] [es-local] initializing ...
objc[28348]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/bin/java (0x1032c64c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x10334a4e0). One of the two will be used. Which one is undefined.
[2018-05-07 20:46:59,710][INFO ][plugins                  ] [es-local] loaded [], sites []
[2018-05-07 20:46:59,784][INFO ][env                      ] [es-local] using [1] data paths, mounts [[/ (/dev/disk1s1)]], net usable_space [14.8gb], net total_space [112.8gb], spins? [unknown], types [apfs]
[2018-05-07 20:47:07,748][INFO ][node                     ] [es-local] initialized
[2018-05-07 20:47:07,748][INFO ][node                     ] [es-local] starting ...
[2018-05-07 20:47:07,951][INFO ][transport                ] [es-local] publish_address {172.18.24.42:9300}, bound_addresses {172.18.24.42:9300}
[2018-05-07 20:47:08,014][INFO ][discovery                ] [es-local] es-test/bWDpm_cxSVOpHTfAJ5UsTw
[2018-05-07 20:47:11,114][INFO ][cluster.service          ] [es-local] new_master {es-local}{bWDpm_cxSVOpHTfAJ5UsTw}{172.18.24.42}{172.18.24.42:9300}, reason: zen-disco-join(elected_as_master, [0] joins received)
[2018-05-07 20:47:11,158][INFO ][http                     ] [es-local] publish_address {172.18.24.42:8201}, bound_addresses {172.18.24.42:8201}
[2018-05-07 20:47:11,158][INFO ][node                     ] [es-local] started
[2018-05-07 20:47:11,227][INFO ][gateway                  ] [es-local] recovered [0] indices into cluster_state
[2018-05-07 20:47:41,171][INFO ][cluster.routing.allocation.decider] [es-local] low disk watermark [85%] exceeded on [bWDpm_cxSVOpHTfAJ5UsTw][es-local][/Users/tangximing/workspace/research/es-research/data/es-test/nodes/0] free: 14.8gb[13.2%], replicas will not be assigned to this node

至此,ES的启动流程和最开始的想法基本相同,后续将开始对上述模块的实现进行分析。

参考

上一篇 下一篇

猜你喜欢

热点阅读