ELK-7.2.0集群搭建-elasticsearch

Elasticsearch Guide [7.16] | Elastic

Create index API | Elasticsearch Guide [8.0] | Elastic

时间同步、防火墙关闭、免密登陆、主机映射

环境基础:

CentOS-7-x86_64-Minimal-1810.iso

jdk-11.0.3_linux-x64_bin.rpm
Hadoop-2.5.1-tar.gz
zookeeper-3.4.6.tar.gz

ELK
elasticsearch-7.2.0-linux-x86_64.tar.gz
logstash-7.2.0.tar.gz
kibana-7.2.0-linux-x86_64.tar.gz

——elasticsearch-7.x自带jdk12,且不依赖Hadoop环境

IP

NN

DN

ZK

ZKFC

JN

RM

NM(任务管理)

ESKibana

master

192.168.25.180

Y

Y

Y

 Y

主节点Y

slave1

192.168.25.181

Y

Y

Y

Y

Y

Y

Y

从节点
slave2192.168.25.182

Y

Y

Y

Y

从节点

slave3

192.168.25.183

Y

Y

Y

从节点
# 禁止开机启动防火墙

systemctl disable firewalld.service

# 时间同步

systemctl enable ntpd

ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

date

一、vim /etc/hosts

192.168.25.180 master
192.168.25.181 slave1
192.168.25.182 slave2
192.168.25.183 slave3

准备文件目录 

cd /home

mkdir elastic,mkdir elastic/data,mkdir elastic/logs

二、elasticsearch-7.2.0]# vi config/elasticsearch.yml

master配置

# 集群名称
cluster.name: chenkl
# 节点名称
node.name: master
# 存放数据目录,先创建该目录
path.data: /home/elastic/data
# 存放日志目录,先创建该目录
path.logs: /home/elastic/logs
# 节点IP
network.host: 192.168.25.180
# tcp端口
transport.tcp.port: 9300
# http端口
http.port: 9200
# 种子节点列表,主节点的IP地址必须在seed_hosts中
discovery.seed_hosts: ["192.168.25.180","192.168.25.181","192.168.25.182","192.168.25.183"]
# 主合格节点列表,若有多个主节点,则主节点进行对应的配置
cluster.initial_master_nodes: ["master"]
# 主节点相关配置
node.master: true
node.data: false
node.ingest: false
node.ml: false
cluster.remote.connect: false
# 跨域
http.cors.enabled: true
http.cors.allow-origin: "*"
cluster.name: chenkl
node.name: master

path.data: /home/elastic/data
path.logs: /home/elastic/logs

network.host: 192.168.25.180
transport.tcp.port: 9300
http.port: 9200

discovery.seed_hosts: ["192.168.25.180","192.168.25.181","192.168.25.182","192.168.25.183"]
cluster.initial_master_nodes: ["master"]

node.master: true
node.data: false
node.ingest: false
node.ml: false
cluster.remote.connect: false

http.cors.enabled: true
http.cors.allow-origin: "*"

slave1

cluster.name: chenkl
node.name: slave1

path.data: /home/elastic/data
path.logs: /home/elastic/logs

network.host: 192.168.25.181
transport.tcp.port: 9300
http.port: 9200

discovery.seed_hosts: ["192.168.25.180","192.168.25.181","192.168.25.182","192.168.25.183"]
cluster.initial_master_nodes: ["master"]

node.master: false
node.data: true
node.ingest: false
node.ml: false
cluster.remote.connect: false

http.cors.enabled: true
http.cors.allow-origin: "*"

slave2

cluster.name: chenkl
node.name: slave2

path.data: /home/elastic/data
path.logs: /home/elastic/logs

network.host: 192.168.25.182
transport.tcp.port: 9300
http.port: 9200

discovery.seed_hosts: ["192.168.25.180","192.168.25.181","192.168.25.182","192.168.25.183"]
cluster.initial_master_nodes: ["master"]

node.master: false
node.data: true
node.ingest: false
node.ml: false
cluster.remote.connect: false

http.cors.enabled: true
http.cors.allow-origin: "*"

slave3

cluster.name: chenkl
node.name: slave3

path.data: /home/elastic/data
path.logs: /home/elastic/logs

network.host: 192.168.25.183
transport.tcp.port: 9300
http.port: 9200

discovery.seed_hosts: ["192.168.25.180","192.168.25.181","192.168.25.182","192.168.25.183"]
cluster.initial_master_nodes: ["master"]

node.master: false
node.data: true
node.ingest: false
node.ml: false
cluster.remote.connect: false

http.cors.enabled: true
http.cors.allow-origin: "*"

三、所有节点创建用户、并且先启动从节点,再启动主节点

adduser bigdata

elasticsearch-7.2.0]# chown -R bigdata:bigdata ../

su bigdata

cd /home/elasticsearch-7.2.0

elasticsearch-7.2.0]$ bin/elasticsearch

四、第一次启动失败——日志

ERROR: [2] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2019-07-09T15:31:45,663][INFO ][o.e.n.Node               ] [master] stopping ...
[2019-07-09T15:31:45,687][INFO ][o.e.n.Node               ] [master] stopped
[2019-07-09T15:31:45,687][INFO ][o.e.n.Node               ] [master] closing ...
[2019-07-09T15:31:45,706][INFO ][o.e.n.Node               ] [master] closed

ERROR: [2] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]

#切换到root用户修改
vi /etc/security/limits.conf

#在最后面追加 bigdata是前面创建的用户
bigdata hard nofile 65536
bigdata soft nofile 65536

#修改后重新登录bigdata账号,使用命令查看上面设置是否成功,结果为65536则成功
ulimit -Hn

[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

#切换到root用户
vi /etc/sysctl.conf

#在最后追加
vm.max_map_count=262144

#使用 sysctl -p 查看修改结果
sysctl -p

五、重新启动

所有节点

cd /home/elasticsearch-7.2.0/

su bigdata

后台启动

$ bin/elasticsearch -d

启动成功——日志——master

Java HotSpot(TM) 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
[2019-07-13T13:21:47,164][INFO ][o.e.e.NodeEnvironment    ] [master] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [8.6gb], net total_space [12.4gb], types [rootfs]
[2019-07-13T13:21:47,168][INFO ][o.e.e.NodeEnvironment    ] [master] heap size [1007.3mb], compressed ordinary object pointers [true]
[2019-07-13T13:21:47,200][INFO ][o.e.n.Node               ] [master] node name [master], node ID [faJ7qPFyR1CHcgKPnuDpUg], cluster name [chenkl]
[2019-07-13T13:21:47,206][INFO ][o.e.n.Node               ] [master] version[7.2.0], pid[28984], build[default/tar/508c38a/2019-06-20T15:54:18.811730Z], OS[Linux/3.10.0-957.el7.x86_64/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/11.0.3/11.0.3+12-LTS]
[2019-07-13T13:21:47,208][INFO ][o.e.n.Node               ] [master] JVM home [/usr/java/jdk-11.0.3]
[2019-07-13T13:21:47,211][INFO ][o.e.n.Node               ] [master] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/tmp/elasticsearch-2281642436467986982, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Djava.locale.providers=COMPAT, -Dio.netty.allocator.type=unpooled, -XX:MaxDirectMemorySize=536870912, -Des.path.home=/home/elasticsearch-7.2.0, -Des.path.conf=/home/elasticsearch-7.2.0/config, -Des.distribution.flavor=default, -Des.distribution.type=tar, -Des.bundled_jdk=true]
[2019-07-13T13:21:54,404][INFO ][o.e.p.PluginsService     ] [master] loaded module [aggs-matrix-stats]
[2019-07-13T13:21:54,405][INFO ][o.e.p.PluginsService     ] [master] loaded module [analysis-common]
[2019-07-13T13:21:54,405][INFO ][o.e.p.PluginsService     ] [master] loaded module [data-frame]
[2019-07-13T13:21:54,406][INFO ][o.e.p.PluginsService     ] [master] loaded module [ingest-common]
[2019-07-13T13:21:54,407][INFO ][o.e.p.PluginsService     ] [master] loaded module [ingest-geoip]
[2019-07-13T13:21:54,407][INFO ][o.e.p.PluginsService     ] [master] loaded module [ingest-user-agent]
[2019-07-13T13:21:54,408][INFO ][o.e.p.PluginsService     ] [master] loaded module [lang-expression]
[2019-07-13T13:21:54,409][INFO ][o.e.p.PluginsService     ] [master] loaded module [lang-mustache]
[2019-07-13T13:21:54,409][INFO ][o.e.p.PluginsService     ] [master] loaded module [lang-painless]
[2019-07-13T13:21:54,410][INFO ][o.e.p.PluginsService     ] [master] loaded module [mapper-extras]
[2019-07-13T13:21:54,411][INFO ][o.e.p.PluginsService     ] [master] loaded module [parent-join]
[2019-07-13T13:21:54,411][INFO ][o.e.p.PluginsService     ] [master] loaded module [percolator]
[2019-07-13T13:21:54,412][INFO ][o.e.p.PluginsService     ] [master] loaded module [rank-eval]
[2019-07-13T13:21:54,413][INFO ][o.e.p.PluginsService     ] [master] loaded module [reindex]
[2019-07-13T13:21:54,414][INFO ][o.e.p.PluginsService     ] [master] loaded module [repository-url]
[2019-07-13T13:21:54,416][INFO ][o.e.p.PluginsService     ] [master] loaded module [transport-netty4]
[2019-07-13T13:21:54,417][INFO ][o.e.p.PluginsService     ] [master] loaded module [x-pack-ccr]
[2019-07-13T13:21:54,418][INFO ][o.e.p.PluginsService     ] [master] loaded module [x-pack-core]
[2019-07-13T13:21:54,420][INFO ][o.e.p.PluginsService     ] [master] loaded module [x-pack-deprecation]
[2019-07-13T13:21:54,421][INFO ][o.e.p.PluginsService     ] [master] loaded module [x-pack-graph]
[2019-07-13T13:21:54,422][INFO ][o.e.p.PluginsService     ] [master] loaded module [x-pack-ilm]
[2019-07-13T13:21:54,422][INFO ][o.e.p.PluginsService     ] [master] loaded module [x-pack-logstash]
[2019-07-13T13:21:54,423][INFO ][o.e.p.PluginsService     ] [master] loaded module [x-pack-ml]
[2019-07-13T13:21:54,424][INFO ][o.e.p.PluginsService     ] [master] loaded module [x-pack-monitoring]
[2019-07-13T13:21:54,425][INFO ][o.e.p.PluginsService     ] [master] loaded module [x-pack-rollup]
[2019-07-13T13:21:54,426][INFO ][o.e.p.PluginsService     ] [master] loaded module [x-pack-security]
[2019-07-13T13:21:54,426][INFO ][o.e.p.PluginsService     ] [master] loaded module [x-pack-sql]
[2019-07-13T13:21:54,428][INFO ][o.e.p.PluginsService     ] [master] loaded module [x-pack-watcher]
[2019-07-13T13:21:54,429][INFO ][o.e.p.PluginsService     ] [master] loaded plugin [analysis-icu]
[2019-07-13T13:21:54,430][INFO ][o.e.p.PluginsService     ] [master] loaded plugin [analysis-ik]
[2019-07-13T13:22:07,470][INFO ][o.e.x.s.a.s.FileRolesStore] [master] parsed [0] roles from file [/home/elasticsearch-7.2.0/config/roles.yml]
[2019-07-13T13:22:09,996][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [master] [controller/29080] [Main.cc@110] controller (64 bit): Version 7.2.0 (Build 65aefcbfce449b) Copyright (c) 2019 Elasticsearch BV
[2019-07-13T13:22:11,520][DEBUG][o.e.a.ActionModule       ] [master] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
[2019-07-13T13:22:12,983][INFO ][o.e.d.DiscoveryModule    ] [master] using discovery type [zen] and seed hosts providers [settings]
[2019-07-13T13:22:16,166][INFO ][o.e.n.Node               ] [master] initialized
[2019-07-13T13:22:16,167][INFO ][o.e.n.Node               ] [master] starting ...
[2019-07-13T13:22:16,720][INFO ][o.e.t.TransportService   ] [master] publish_address {192.168.25.180:9300}, bound_addresses {192.168.25.180:9300}
[2019-07-13T13:22:16,744][INFO ][o.e.b.BootstrapChecks    ] [master] bound or publishing to a non-loopback address, enforcing bootstrap checks
[2019-07-13T13:22:16,806][INFO ][o.e.c.c.Coordinator      ] [master] cluster UUID [7ENIUW8FTyCgAVIc5HYPlw]
[2019-07-13T13:22:17,308][INFO ][o.e.c.s.MasterService    ] [master] elected-as-master ([1] nodes joined)[{master}{faJ7qPFyR1CHcgKPnuDpUg}{VkBBnwJSQhGtdQCmr8otaQ}{192.168.25.180}{192.168.25.180:9300}{xpack.installed=true} elect leader, _BECOME_MASTER_TASK_, _FINISH_ELECTION_], term: 2, version: 22, reason: master node changed {previous [], current [{master}{faJ7qPFyR1CHcgKPnuDpUg}{VkBBnwJSQhGtdQCmr8otaQ}{192.168.25.180}{192.168.25.180:9300}{xpack.installed=true}]}
[2019-07-13T13:22:17,549][INFO ][o.e.c.s.ClusterApplierService] [master] master node changed {previous [], current [{master}{faJ7qPFyR1CHcgKPnuDpUg}{VkBBnwJSQhGtdQCmr8otaQ}{192.168.25.180}{192.168.25.180:9300}{xpack.installed=true}]}, term: 2, version: 22, reason: Publication{term=2, version=22}
[2019-07-13T13:22:17,769][INFO ][o.e.c.s.MasterService    ] [master] node-join[{slave3}{Z22731KSRnqHghLbs_V_GA}{DdrH0xhHQM2DtfhX1rpnDQ}{192.168.25.183}{192.168.25.183:9300}{xpack.installed=true} join existing leader, {slave2}{NX_j78UyQbKPAIRuiV79mA}{ShpiYdPnScyk9EJaPp560g}{192.168.25.182}{192.168.25.182:9300}{xpack.installed=true} join existing leader, {slave1}{tm_GLIQsTtOqRw7r1bjrug}{YZc1au7hSvi1hkh99e1MNg}{192.168.25.181}{192.168.25.181:9300}{xpack.installed=true} join existing leader], term: 2, version: 23, reason: added {{slave2}{NX_j78UyQbKPAIRuiV79mA}{ShpiYdPnScyk9EJaPp560g}{192.168.25.182}{192.168.25.182:9300}{xpack.installed=true},{slave3}{Z22731KSRnqHghLbs_V_GA}{DdrH0xhHQM2DtfhX1rpnDQ}{192.168.25.183}{192.168.25.183:9300}{xpack.installed=true},{slave1}{tm_GLIQsTtOqRw7r1bjrug}{YZc1au7hSvi1hkh99e1MNg}{192.168.25.181}{192.168.25.181:9300}{xpack.installed=true},}
[2019-07-13T13:22:17,771][INFO ][o.e.h.AbstractHttpServerTransport] [master] publish_address {192.168.25.180:9200}, bound_addresses {192.168.25.180:9200}
[2019-07-13T13:22:17,789][INFO ][o.e.n.Node               ] [master] started
[2019-07-13T13:22:18,163][INFO ][o.e.c.s.ClusterApplierService] [master] added {{slave2}{NX_j78UyQbKPAIRuiV79mA}{ShpiYdPnScyk9EJaPp560g}{192.168.25.182}{192.168.25.182:9300}{xpack.installed=true},{slave3}{Z22731KSRnqHghLbs_V_GA}{DdrH0xhHQM2DtfhX1rpnDQ}{192.168.25.183}{192.168.25.183:9300}{xpack.installed=true},{slave1}{tm_GLIQsTtOqRw7r1bjrug}{YZc1au7hSvi1hkh99e1MNg}{192.168.25.181}{192.168.25.181:9300}{xpack.installed=true},}, term: 2, version: 23, reason: Publication{term=2, version=23}
[2019-07-13T13:22:19,643][INFO ][o.e.l.LicenseService     ] [master] license [1ef58c9c-81f1-4884-ae8c-05b3910a7c73] mode [basic] - valid
[2019-07-13T13:22:19,674][INFO ][o.e.g.GatewayService     ] [master] recovered [1] indices into cluster_state
[2019-07-13T13:22:21,917][INFO ][o.e.c.r.a.AllocationService] [master] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[test03][0]] ...]).
[2019-07-13T13:22:23,723][INFO ][o.e.c.r.a.AllocationService] [master] Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[test03][0]] ...]).

启动成功——日志——slave1

Java HotSpot(TM) 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
[2019-07-13T13:22:03,533][INFO ][o.e.e.NodeEnvironment    ] [slave1] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [9.6gb], net total_space [12.4gb], types [rootfs]
[2019-07-13T13:22:03,538][INFO ][o.e.e.NodeEnvironment    ] [slave1] heap size [1007.3mb], compressed ordinary object pointers [true]
[2019-07-13T13:22:03,661][INFO ][o.e.n.Node               ] [slave1] node name [slave1], node ID [tm_GLIQsTtOqRw7r1bjrug], cluster name [chenkl]
[2019-07-13T13:22:03,666][INFO ][o.e.n.Node               ] [slave1] version[7.2.0], pid[28885], build[default/tar/508c38a/2019-06-20T15:54:18.811730Z], OS[Linux/3.10.0-957.el7.x86_64/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/11.0.3/11.0.3+12-LTS]
[2019-07-13T13:22:03,681][INFO ][o.e.n.Node               ] [slave1] JVM home [/usr/java/jdk-11.0.3]
[2019-07-13T13:22:03,689][INFO ][o.e.n.Node               ] [slave1] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/tmp/elasticsearch-7016455792488916778, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Djava.locale.providers=COMPAT, -Dio.netty.allocator.type=unpooled, -XX:MaxDirectMemorySize=536870912, -Des.path.home=/home/elasticsearch-7.2.0, -Des.path.conf=/home/elasticsearch-7.2.0/config, -Des.distribution.flavor=default, -Des.distribution.type=tar, -Des.bundled_jdk=true]
[2019-07-13T13:22:10,641][INFO ][o.e.p.PluginsService     ] [slave1] loaded module [aggs-matrix-stats]
[2019-07-13T13:22:10,642][INFO ][o.e.p.PluginsService     ] [slave1] loaded module [analysis-common]
[2019-07-13T13:22:10,643][INFO ][o.e.p.PluginsService     ] [slave1] loaded module [data-frame]
[2019-07-13T13:22:10,643][INFO ][o.e.p.PluginsService     ] [slave1] loaded module [ingest-common]
[2019-07-13T13:22:10,644][INFO ][o.e.p.PluginsService     ] [slave1] loaded module [ingest-geoip]
[2019-07-13T13:22:10,645][INFO ][o.e.p.PluginsService     ] [slave1] loaded module [ingest-user-agent]
[2019-07-13T13:22:10,645][INFO ][o.e.p.PluginsService     ] [slave1] loaded module [lang-expression]
[2019-07-13T13:22:10,646][INFO ][o.e.p.PluginsService     ] [slave1] loaded module [lang-mustache]
[2019-07-13T13:22:10,647][INFO ][o.e.p.PluginsService     ] [slave1] loaded module [lang-painless]
[2019-07-13T13:22:10,647][INFO ][o.e.p.PluginsService     ] [slave1] loaded module [mapper-extras]
[2019-07-13T13:22:10,648][INFO ][o.e.p.PluginsService     ] [slave1] loaded module [parent-join]
[2019-07-13T13:22:10,649][INFO ][o.e.p.PluginsService     ] [slave1] loaded module [percolator]
[2019-07-13T13:22:10,650][INFO ][o.e.p.PluginsService     ] [slave1] loaded module [rank-eval]
[2019-07-13T13:22:10,651][INFO ][o.e.p.PluginsService     ] [slave1] loaded module [reindex]
[2019-07-13T13:22:10,652][INFO ][o.e.p.PluginsService     ] [slave1] loaded module [repository-url]
[2019-07-13T13:22:10,670][INFO ][o.e.p.PluginsService     ] [slave1] loaded module [transport-netty4]
[2019-07-13T13:22:10,676][INFO ][o.e.p.PluginsService     ] [slave1] loaded module [x-pack-ccr]
[2019-07-13T13:22:10,677][INFO ][o.e.p.PluginsService     ] [slave1] loaded module [x-pack-core]
[2019-07-13T13:22:10,678][INFO ][o.e.p.PluginsService     ] [slave1] loaded module [x-pack-deprecation]
[2019-07-13T13:22:10,697][INFO ][o.e.p.PluginsService     ] [slave1] loaded module [x-pack-graph]
[2019-07-13T13:22:10,697][INFO ][o.e.p.PluginsService     ] [slave1] loaded module [x-pack-ilm]
[2019-07-13T13:22:10,698][INFO ][o.e.p.PluginsService     ] [slave1] loaded module [x-pack-logstash]
[2019-07-13T13:22:10,699][INFO ][o.e.p.PluginsService     ] [slave1] loaded module [x-pack-ml]
[2019-07-13T13:22:10,699][INFO ][o.e.p.PluginsService     ] [slave1] loaded module [x-pack-monitoring]
[2019-07-13T13:22:10,705][INFO ][o.e.p.PluginsService     ] [slave1] loaded module [x-pack-rollup]
[2019-07-13T13:22:10,714][INFO ][o.e.p.PluginsService     ] [slave1] loaded module [x-pack-security]
[2019-07-13T13:22:10,738][INFO ][o.e.p.PluginsService     ] [slave1] loaded module [x-pack-sql]
[2019-07-13T13:22:10,788][INFO ][o.e.p.PluginsService     ] [slave1] loaded module [x-pack-watcher]
[2019-07-13T13:22:10,790][INFO ][o.e.p.PluginsService     ] [slave1] loaded plugin [analysis-icu]
[2019-07-13T13:22:10,791][INFO ][o.e.p.PluginsService     ] [slave1] loaded plugin [analysis-ik]
[2019-07-13T13:22:24,573][INFO ][o.e.x.s.a.s.FileRolesStore] [slave1] parsed [0] roles from file [/home/elasticsearch-7.2.0/config/roles.yml]
[2019-07-13T13:22:26,682][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [slave1] [controller/28981] [Main.cc@110] controller (64 bit): Version 7.2.0 (Build 65aefcbfce449b) Copyright (c) 2019 Elasticsearch BV
[2019-07-13T13:22:28,287][DEBUG][o.e.a.ActionModule       ] [slave1] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
[2019-07-13T13:22:29,695][INFO ][o.e.d.DiscoveryModule    ] [slave1] using discovery type [zen] and seed hosts providers [settings]
[2019-07-13T13:22:32,845][INFO ][o.e.n.Node               ] [slave1] initialized
[2019-07-13T13:22:32,847][INFO ][o.e.n.Node               ] [slave1] starting ...
[2019-07-13T13:22:33,250][INFO ][o.e.t.TransportService   ] [slave1] publish_address {192.168.25.181:9300}, bound_addresses {192.168.25.181:9300}
[2019-07-13T13:22:33,295][INFO ][o.e.b.BootstrapChecks    ] [slave1] bound or publishing to a non-loopback address, enforcing bootstrap checks
[2019-07-13T13:22:33,378][INFO ][o.e.c.c.Coordinator      ] [slave1] cluster UUID [7ENIUW8FTyCgAVIc5HYPlw]
[2019-07-13T13:22:34,783][INFO ][o.e.c.s.ClusterApplierService] [slave1] master node changed {previous [], current [{master}{faJ7qPFyR1CHcgKPnuDpUg}{VkBBnwJSQhGtdQCmr8otaQ}{192.168.25.180}{192.168.25.180:9300}{xpack.installed=true}]}, added {{slave3}{Z22731KSRnqHghLbs_V_GA}{DdrH0xhHQM2DtfhX1rpnDQ}{192.168.25.183}{192.168.25.183:9300}{xpack.installed=true},{master}{faJ7qPFyR1CHcgKPnuDpUg}{VkBBnwJSQhGtdQCmr8otaQ}{192.168.25.180}{192.168.25.180:9300}{xpack.installed=true},{slave2}{NX_j78UyQbKPAIRuiV79mA}{ShpiYdPnScyk9EJaPp560g}{192.168.25.182}{192.168.25.182:9300}{xpack.installed=true},}, term: 2, version: 23, reason: ApplyCommitRequest{term=2, version=23, sourceNode={master}{faJ7qPFyR1CHcgKPnuDpUg}{VkBBnwJSQhGtdQCmr8otaQ}{192.168.25.180}{192.168.25.180:9300}{xpack.installed=true}}
[2019-07-13T13:22:35,082][INFO ][o.e.h.AbstractHttpServerTransport] [slave1] publish_address {192.168.25.181:9200}, bound_addresses {192.168.25.181:9200}
[2019-07-13T13:22:35,083][INFO ][o.e.n.Node               ] [slave1] started
[2019-07-13T13:22:36,117][INFO ][o.e.l.LicenseService     ] [slave1] license [1ef58c9c-81f1-4884-ae8c-05b3910a7c73] mode [basic] - valid
[2019-07-13T13:22:36,648][INFO ][o.e.x.s.a.TokenService   ] [slave1] refresh keys
[2019-07-13T13:22:37,063][INFO ][o.e.x.s.a.TokenService   ] [slave1] refreshed keys
[2019-07-13T13:22:37,324][INFO ][o.w.a.d.Monitor          ] [slave1] try load config from /home/elasticsearch-7.2.0/config/analysis-ik/IKAnalyzer.cfg.xml
[2019-07-13T13:22:37,326][INFO ][o.w.a.d.Monitor          ] [slave1] try load config from /home/elasticsearch-7.2.0/plugins/ik/config/IKAnalyzer.cfg.xml

六、有如下信息则集群搭建成功

查看集群状态(任意节点执行):curl  -XGET '192.168.25.180:9200/_cluster/health?pretty'

[bigdata@slave1 elasticsearch-7.2.0]$ curl  -XGET '192.168.25.180:9200/_cluster/health?pretty'
{
  "cluster_name" : "chenkl",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 4,
  "number_of_data_nodes" : 3,
  "active_primary_shards" : 0,
  "active_shards" : 0,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 10,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 0.0
}

查看各个节点的信息:curl  -XGET 'http://192.168.25.180:9200/_nodes/process?pretty'

[bigdata@slave1 elasticsearch-7.2.0]$ curl  -XGET 'http://192.168.25.180:9200/_nodes/process?pretty'
{
  "_nodes" : {
    "total" : 4,
    "successful" : 4,
    "failed" : 0
  },
  "cluster_name" : "chenkl",
  "nodes" : {
    "4C-lXJJSSyGXWwjbsP_f0g" : {
      "name" : "master",
      "transport_address" : "192.168.25.180:9300",
      "host" : "192.168.25.180",
      "ip" : "192.168.25.180",
      "version" : "7.2.0",
      "build_flavor" : "default",
      "build_type" : "tar",
      "build_hash" : "508c38a",
      "roles" : [
        "master"
      ],
      "attributes" : {
        "xpack.installed" : "true"
      },
      "process" : {
        "refresh_interval_in_millis" : 1000,
        "id" : 12988,
        "mlockall" : false
      }
    },
    "7cBobpzsQ4eWkZdKTd9O9A" : {
      "name" : "slave1",
      "transport_address" : "192.168.25.181:9300",
      "host" : "192.168.25.181",
      "ip" : "192.168.25.181",
      "version" : "7.2.0",
      "build_flavor" : "default",
      "build_type" : "tar",
      "build_hash" : "508c38a",
      "roles" : [
        "data"
      ],
      "attributes" : {
        "xpack.installed" : "true"
      },
      "process" : {
        "refresh_interval_in_millis" : 1000,
        "id" : 11245,
        "mlockall" : false
      }
    },
    "ozi1yThBROyidOmeRVWj3A" : {
      "name" : "slave2",
      "transport_address" : "192.168.25.182:9300",
      "host" : "192.168.25.182",
      "ip" : "192.168.25.182",
      "version" : "7.2.0",
      "build_flavor" : "default",
      "build_type" : "tar",
      "build_hash" : "508c38a",
      "roles" : [
        "data"
      ],
      "attributes" : {
        "xpack.installed" : "true"
      },
      "process" : {
        "refresh_interval_in_millis" : 1000,
        "id" : 11243,
        "mlockall" : false
      }
    },
    "rTBdN7rRTIeQcVoPpTc2-Q" : {
      "name" : "slave3",
      "transport_address" : "192.168.25.183:9300",
      "host" : "192.168.25.183",
      "ip" : "192.168.25.183",
      "version" : "7.2.0",
      "build_flavor" : "default",
      "build_type" : "tar",
      "build_hash" : "508c38a",
      "roles" : [
        "data"
      ],
      "attributes" : {
        "xpack.installed" : "true"
      },
      "process" : {
        "refresh_interval_in_millis" : 1000,
        "id" : 11257,
        "mlockall" : false
      }
    }
  }
}

查看单个节点信息:curl -XGET 'http://192.168.25.180:9200'

{
  "name" : "master",
  "cluster_name" : "chenkl",
  "cluster_uuid" : "7ENIUW8FTyCgAVIc5HYPlw",
  "version" : {
    "number" : "7.2.0",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "508c38a",
    "build_date" : "2019-06-20T15:54:18.811730Z",
    "build_snapshot" : false,
    "lucene_version" : "8.0.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

七、安装一个ES插件,所有节点,执行下面命令:

elasticsearch-7.2.0]# bin/elasticsearch-plugin install analysis-icu

八、安装 IK分词器(中文分词器)

通过 http://192.168.25.180:9200查看ES的版本,找到对应的IK分词插件下载后,执行以下操作

cd /home/elasticsearch-7.2.0/

mkdir plugins/ik

cd plugins/ik

unzip elasticsearch-analysis-ik-7.2.0.zip

scp -r ./ root@slave1:/home/elasticsearch-7.2.0/plugins/ik/

九、拓展知识:

环境搭建-基础知识-Java操作-异常总结等

ElasticSearch在7.X版本去掉type

十、总结:ES7.x中废弃了type,可以在创建所以的过程中看到,默认的type都是"_doc";同时index:analyzed使用true或者false代替;搭建集群的过程中,配置项的主从很重要;Java API文档的调用

十一、下次启动

所有节点

cd /home/elasticsearch-7.2.0/

su bigdata

后台启动

$ bin/elasticsearch -d

  • 2
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

dkjhl

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值