暂无图片
暂无图片
1
暂无图片
暂无图片
暂无图片

Centos7.9+ElasticSearch8.3.2安装步骤

原创 tracy 2022-09-26
3257

本文介绍在Centos7.9上安装ElasticSearch8.3.2的详细步骤。
安装环境:
操作系统:Centos7.9
ElasticSearch版本:8.3.2
ElasticSearch 的安装用户:es
ElasticSearch 的安装目录: /u01

1.创建数据库安装用户

# groupadd es # useradd -g es es # passwd es
复制

2.操作系统设置

2.1 修改用户资源限制

# vi /etc/security/limits.conf es - nofile 65536 es - memlock unlimited
复制

2.2 修改操作系统参数

# vi /etc/sysctl.conf vm.max_map_count=262144
复制

3.解压ElasticSearch,并修改文件权限

# tar -zxf elasticsearch-8.3.2-linux-x86_64.tar.gz # ll total 526668 drwxr-xr-x 9 root root 155 Jul 6 23:22 elasticsearch-8.3.2 -rw-r--r-- 1 root root 539306119 Jul 15 17:07 elasticsearch-8.3.2-linux-x86_64.tar.gz # mv /u01/soft/elasticsearch-8.3.2 /u01/es8.3.2 # chown -R es: /u01/es8.3.2/
复制

4.设置环境变量

# su - es $ vi .bashrc --添加下面两行 export ES_HOME=/u01/es8.3.2 export PATH=/u01/es8.3.2/bin:$PATH $ . .bashrc
复制

5.修改数据库配置文件

vi /u01/es8.3.2/config/elasticsearch.yml 文件尾追加如下几行: # 指定集群名称 cluster.name: es-application # 指定节点名称 node.name: node-1 # 设置允许访问的IP地址 network.host: 0.0.0.0 # 设置ElasticSearch 端口号 http.port: 9200 # 设置数据目录 path.data: /u01/es8.3.2/data # 设置日志目录 path.logs: /u01/es8.3.2/logs # 设置备份存储目录 path.repo: /u01/backup
复制

6. 设置java进程内存大小

vi /u01/es8.3.2/config/jvm.options 修改下面两行: ## -Xms4g ## -Xmx4g 根据实际系统情况进行调整: -Xms1g -Xmx1g
复制

7.启动ElasticSearch

-- 启动命令 $ elasticsearch -d warning: ignoring JAVA_HOME=/usr/local/jdk1.8.0_333; using bundled JDK -- elasticsearch 8.3.2版本安装文件中自带JDK18 [2022-09-26T11:21:03,922][INFO ][o.e.n.Node ] [node-1] version[8.3.2], pid[13827], build[tar/8b0b1f23fbebecc3c88e4464319dea8989f374fd/2022-07-06T15:15:15.901688194Z], OS[Linux/3.10.0-1160.el7.x86_64/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/18.0.1.1/18.0.1.1+2-6] [2022-09-26T11:21:03,944][INFO ][o.e.n.Node ] [node-1] JVM home [/u01/es8.3.2/jdk], using bundled JDK [true] [2022-09-26T11:21:03,949][INFO ][o.e.n.Node ] [node-1] JVM arguments [-Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -Djava.security.manager=allow, -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, -Dlog4j2.formatMsgNoLookups=true, -Djava.locale.providers=SPI,COMPAT, --add-opens=java.base/java.io=ALL-UNNAMED, -Xms1g, -Xmx1g, -XX:+UseG1GC, -Djava.io.tmpdir=/tmp/elasticsearch-13138631470401907300, -XX:+HeapDumpOnOutOfMemoryError, -XX:+ExitOnOutOfMemoryError, -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, -XX:MaxDirectMemorySize=536870912, -XX:G1HeapRegionSize=4m, -XX:InitiatingHeapOccupancyPercent=30, -XX:G1ReservePercent=15, -Des.distribution.type=tar, --module-path=/u01/es8.3.2/lib, -Djdk.module.main=org.elasticsearch.server] [2022-09-26T11:21:11,244][INFO ][c.a.c.i.j.JacksonVersion ] [node-1] Package versions: jackson-annotations=2.13.2, jackson-core=2.13.2, jackson-databind=2.13.2.2, jackson-dataformat-xml=2.13.2, jackson-datatype-jsr310=2.13.2, azure-core=1.27.0, Troubleshooting version conflicts: https://aka.ms/azsdk/java/dependency/troubleshoot ......省略部分日志 [2022-09-26T11:21:37,194][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [node-1] [controller/13849] [Main.cc@123] controller (64 bit): Version 8.3.2 (Build c86b7174f20c42) Copyright (c) 2022 Elasticsearch BV [2022-09-26T11:21:38,678][INFO ][o.e.t.n.NettyAllocator ] [node-1] creating NettyAllocator with the following configs: [name=unpooled, suggested_max_allocation_size=1mb, factors={es.unsafe.use_unpooled_allocator=null, g1gc_enabled=true, g1gc_region_size=4mb, heap_size=1gb}] [2022-09-26T11:21:38,816][INFO ][o.e.i.r.RecoverySettings ] [node-1] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b] [2022-09-26T11:21:38,977][INFO ][o.e.d.DiscoveryModule ] [node-1] using discovery type [multi-node] and seed hosts providers [settings] [2022-09-26T11:21:44,250][INFO ][o.e.n.Node ] [node-1] initialized [2022-09-26T11:21:44,265][INFO ][o.e.n.Node ] [node-1] starting ... [2022-09-26T11:21:44,334][INFO ][o.e.x.s.c.f.PersistentCache] [node-1] persistent cache index loaded [2022-09-26T11:21:44,339][INFO ][o.e.x.d.l.DeprecationIndexingComponent] [node-1] deprecation component started [2022-09-26T11:21:44,764][INFO ][o.e.t.TransportService ] [node-1] publish_address {192.168.56.11:9300}, bound_addresses {[::]:9300} [2022-09-26T11:21:46,937][INFO ][o.e.b.BootstrapChecks ] [node-1] bound or publishing to a non-loopback address, enforcing bootstrap checks [2022-09-26T11:21:47,034][WARN ][o.e.c.c.ClusterBootstrapService] [node-1] this node is locked into cluster UUID [md-5cF_3QyWvgtlAlybM-w] but [cluster.initial_master_nodes] is set to [node-1]; remove this setting to avoid possible data loss caused by subsequent cluster bootstrap attempts [2022-09-26T11:21:47,496][INFO ][o.e.c.s.MasterService ] [node-1] elected-as-master ([1] nodes joined)[_FINISH_ELECTION_, {node-1}{bBtT6R8VQBu_r27_VgVlFQ}{9RxXKK-gQueK8Mfb-9ETkw}{node-1}{192.168.56.11}{192.168.56.11:9300}{cdfhilmrstw} completing election], term: 8, version: 295, delta: master node changed {previous [], current [{node-1}{bBtT6R8VQBu_r27_VgVlFQ}{9RxXKK-gQueK8Mfb-9ETkw}{node-1}{192.168.56.11}{192.168.56.11:9300}{cdfhilmrstw}]} [2022-09-26T11:21:47,868][INFO ][o.e.c.s.ClusterApplierService] [node-1] master node changed {previous [], current [{node-1}{bBtT6R8VQBu_r27_VgVlFQ}{9RxXKK-gQueK8Mfb-9ETkw}{node-1}{192.168.56.11}{192.168.56.11:9300}{cdfhilmrstw}]}, term: 8, version: 295, reason: Publication{term=8, version=295} [2022-09-26T11:21:48,377][INFO ][o.e.h.AbstractHttpServerTransport] [node-1] publish_address {192.168.56.11:9200}, bound_addresses {[::]:9200} [2022-09-26T11:21:48,392][INFO ][o.e.n.Node ] [node-1] started {node-1}{bBtT6R8VQBu_r27_VgVlFQ}{9RxXKK-gQueK8Mfb-9ETkw}{node-1}{192.168.56.11}{192.168.56.11:9300}{cdfhilmrstw}{xpack.installed=true, ml.machine_memory=4142354432, ml.max_jvm_size=1073741824} -- 看到日志中有starting ...和最后一行的 started ,表示ElasticSearch启动成功 -- 查看进程 $ ps -ef|grep elastic es 8556 1 2 08:53 ? 00:02:06 /u01/es8.3.2/jdk/bin/java -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -Djava.security.manager=allow -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 -Dlog4j2.formatMsgNoLookups=true -Djava.locale.providers=SPI,COMPAT --add-opens=java.base/java.io=ALL-UNNAMED -Xms1g -Xmx1g -XX:+UseG1GC -Djava.io.tmpdir=/tmp/elasticsearch-12578856173753681063 -XX:+HeapDumpOnOutOfMemoryError -XX:+ExitOnOutOfMemoryError -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 -XX:MaxDirectMemorySize=536870912 -XX:G1HeapRegionSize=4m -XX:InitiatingHeapOccupancyPercent=30 -XX:G1ReservePercent=15 -Des.distribution.type=tar --module-path /u01/es8.3.2/lib -m org.elasticsearch.server/org.elasticsearch.bootstrap.Elasticsearch es 11478 11235 0 10:23 pts/0 00:00:00 grep --color=auto elastic --附,停止ElasticSearch,可直接使用kill命令 $ kill -9 8556
复制
最后修改时间:2022-09-26 11:45:09
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

文章被以下合辑收录

评论