服务器直接部署ES

-
-
2025-07-30 08:52

https://www.elastic.co/cn/downloads/past-releases#elasticsearch

选择6.8.8版本

 

https://www.elastic.co/guide/en/elasticsearch/reference/6.8/zip-targz.html

官方文档,安装说明

 

1、先安装java

https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html

选择【Linux x64 RPM Package】

rpm -ivh jdk-8u251-linux-x64.rpm
warning: jdk-8u251-linux-x64.rpm: Header V3 RSA/SHA256 Signature, key ID
ec551f03: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:jdk1.8-2000:1.8.0_251-fcs ################################# [100%]
Unpacking JAR files...
tools.jar...
plugin.jar...
javaws.jar...
deploy.jar...
rt.jar...
jsse.jar...
charsets.jar...
localedata.jar...

2、下载elasticsearch软件,解压到/usr/locl目录下

[root@host101 ~] tar xvf elasticsearch-6.8.8.tar.gz -C /usr/local/
[root@host101 ~] cd /usr/local/
[root@host101 local] mv elasticsearch-6.8.8/ elasticsearch

 

3、运行elasticsearch,开启报错之旅

3.1报错:

不能以root用户运行,

[root@host101 elasticsearch]# bin/elasticsearch
OpenJDK 64-Bit Server VM warning: If the number of processors is
expected to increase from one, then you should configure the number of
parallel GC threads appropriately using -XX:ParallelGCThreads=N
[2020-06-08T07:53:35,386][WARN
][o.e.b.ElasticsearchUncaughtExceptionHandler] [unknown] uncaught
exception in thread [main]
org.elasticsearch.bootstrap.StartupException:
java.lang.RuntimeException: can not run elasticsearch as root
at
org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163)
~[elasticsearch-6.8.8.jar:6.8.8]
at
org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150)
~[elasticsearch-6.8.8.jar:6.8.8]
at
org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
~[elasticsearch-6.8.8.jar:6.8.8]
at
org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124)
~[elasticsearch-cli-6.8.8.jar:6.8.8]
at org.elasticsearch.cli.Command.main(Command.java:90)
~[elasticsearch-cli-6.8.8.jar:6.8.8]
at
org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116)
~[elasticsearch-6.8.8.jar:6.8.8]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93)
~[elasticsearch-6.8.8.jar:6.8.8]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
at
org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:103)
~[elasticsearch-6.8.8.jar:6.8.8]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:170)
~[elasticsearch-6.8.8.jar:6.8.8]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333)
~[elasticsearch-6.8.8.jar:6.8.8]
at
org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159)
~[elasticsearch-6.8.8.jar:6.8.8]
... 6 more

 

解决方法:

添加其它用户,我新加了一个es用户,将elasticsearch目录授予es用户,启动成功。

[root@host101 elasticsearch]# useradd es
[root@host101 elasticsearch]# chown -R es:es /usr/local/elasticsearch/
[root@host101 elasticsearch]#su - es
[es@host101 elasticsearch]$ bin/elasticsearch
OpenJDK 64-Bit Server VM warning: If the number of processors is
expected to increase from one, then you should configure the number of
parallel GC threads appropriately using -XX:ParallelGCThreads=N
[2020-06-08T08:03:17,900][INFO ][o.e.e.NodeEnvironment ]
[5Viw2iF] using [1] data paths, mounts [[/ (rootfs)]], net
usable_space [7.8gb], net total_space [16.9gb], types [rootfs]
[2020-06-08T08:03:17,904][INFO ][o.e.e.NodeEnvironment ]
[5Viw2iF] heap size [1015.6mb], compressed ordinary object pointers
[true]
[2020-06-08T08:03:17,906][INFO ][o.e.n.Node ] [5Viw2iF] node
name derived from node ID [5Viw2iFFSraid8DsATRv0Q]; set [node.name]
to override
[2020-06-08T08:03:17,906][INFO ][o.e.n.Node ] [5Viw2iF]
version[6.8.8], pid[26327],
build[default/tar/2f4c224/2020-03-18T23:22:18.622755Z],
OS[Linux/3.10.0-957.el7.x86_64/amd64], JVM[Oracle Corporation/OpenJDK
64-Bit Server VM/1.8.0_181/25.181-b13]
......
......
[2020-06-08T08:03:50,821][INFO ][o.e.c.s.MasterService ]
[5Viw2iF] zen-disco-elected-as-master ([0] nodes joined), reason:
new_master
{5Viw2iF}{5Viw2iFFSraid8DsATRv0Q}{4P_TXjOBTWmK_kV3Xm88bA}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=1907941376,
xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}
[2020-06-08T08:03:50,849][INFO ][o.e.c.s.ClusterApplierService]
[5Viw2iF] new_master
{5Viw2iF}{5Viw2iFFSraid8DsATRv0Q}{4P_TXjOBTWmK_kV3Xm88bA}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=1907941376,
xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}, reason:
apply cluster state (from master [master
{5Viw2iF}{5Viw2iFFSraid8DsATRv0Q}{4P_TXjOBTWmK_kV3Xm88bA}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=1907941376,
xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true} committed
version [1] source [zen-disco-elected-as-master ([0] nodes
joined)]])
[2020-06-08T08:03:51,221][INFO
][o.e.h.n.Netty4HttpServerTransport] [5Viw2iF] publish_address
{127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}
[2020-06-08T08:03:51,222][INFO ][o.e.n.Node ] [5Viw2iF] started
[2020-06-08T08:03:51,949][WARN
][o.e.x.s.a.s.m.NativeRoleMappingStore] [5Viw2iF] Failed to clear
cache for realms [[]]
[2020-06-08T08:03:52,106][INFO ][o.e.l.LicenseService ]
[5Viw2iF] license [25b1507f-4db2-4bdb-9f72-bf19ed92defe] mode
[basic] - valid
[2020-06-08T08:03:52,123][INFO ][o.e.g.GatewayService ]
[5Viw2iF] recovered [0] indices into cluster_state

3.2

但默认监控的是127.0.0.1端口,其它IP访问不到ES数据库,需要修改为本机Ip  192.168.150.101

[root@host101 config]# cd /usr/local/elasticsearch/config/
[root@host101 config]# vi elasticsearch.yml

修改这个参数

network.host: 192.168.150.101

保存!

 

3.3

重启数据库,报错

[es@host101 elasticsearch]$ bin/elasticsearch
OpenJDK 64-Bit Server VM warning: If the number of processors is
expected to increase from one, then you should configure the number of
parallel GC threads appropriately using -XX:ParallelGCThreads=N
[2020-06-08T08:08:16,804][INFO ][o.e.e.NodeEnvironment ]
[5Viw2iF] using [1] data paths, mounts [[/ (rootfs)]], net
usable_space [7.5gb], net total_space [16.9gb], types [rootfs]
[2020-06-08T08:08:16,823][INFO ][o.e.e.NodeEnvironment ]
[5Viw2iF] heap size [1015.6mb], compressed ordinary object pointers
[true]
[2020-06-08T08:08:16,825][INFO ][o.e.n.Node ] [5Viw2iF] node
name derived from node ID [5Viw2iFFSraid8DsATRv0Q]; set [node.name]
to override
[2020-06-08T08:08:16,826][INFO ][o.e.n.Node ] [5Viw2iF]
version[6.8.8], pid[27460],
build[default/tar/2f4c224/2020-03-18T23:22:18.622755Z],
OS[Linux/3.10.0-957.el7.x86_64/amd64], JVM[Oracle Corporation/OpenJDK
64-Bit Server VM/1.8.0_181/25.181-b13]
[2020-06-08T08:08:16,826][INFO ][o.e.n.Node ] [5Viw2iF] 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-2400007459533475276,
-XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data,
-XX:ErrorFile=logs/hs_err_pid%p.log, -XX:+PrintGCDetails,
-XX:+PrintGCDateStamps, -XX:+PrintTenuringDistribution,
-XX:+PrintGCApplicationStoppedTime, -Xloggc:logs/gc.log,
-XX:+UseGCLogFileRotation, -XX:NumberOfGCLogFiles=32,
-XX:GCLogFileSize=64m, -Des.path.home=/usr/local/elasticsearch,
-Des.path.conf=/usr/local/elasticsearch/config,
-Des.distribution.flavor=default, -Des.distribution.type=tar]
......
......
[2020-06-08T08:08:54,664][INFO ][o.e.n.Node ] [5Viw2iF]
initialized
[2020-06-08T08:08:54,665][INFO ][o.e.n.Node ] [5Viw2iF] starting
...
[2020-06-08T08:08:55,458][INFO ][o.e.t.TransportService ]
[5Viw2iF] publish_address {192.168.150.101:9300}, bound_addresses
{192.168.150.101:9300}
[2020-06-08T08:08:55,548][INFO ][o.e.b.BootstrapChecks ]
[5Viw2iF] bound or publishing to a non-loopback address, enforcing
bootstrap checks
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]
[2020-06-08T08:08:55,728][INFO ][o.e.n.Node ] [5Viw2iF] stopping
...
[2020-06-08T08:08:55,804][INFO ][o.e.n.Node ] [5Viw2iF] stopped
[2020-06-08T08:08:55,804][INFO ][o.e.n.Node ] [5Viw2iF] closing
...
[2020-06-08T08:08:55,865][INFO ][o.e.n.Node ] [5Viw2iF] closed
[2020-06-08T08:08:55,869][INFO ][o.e.x.m.p.NativeController]
[5Viw2iF] Native controller process has stopped - no new native
processes can be started
[es@host101 elasticsearch]$

解决方法:

需要使用root用户去修改

[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]

[root@host101 config] vi /etc/security/limits.conf

# 添加至尾部
* soft nofile 65536
* hard nofile 65536

[root@host101 config] vi /etc/sysctl.conf

# 添加至尾部
vm.max_map_count=262144

# 验证是否生效
[root@host101 config] sysctl -p
vm.max_map_count = 262144

 

3.4

再次启动数据库,报错

[es@host101 elasticsearch]$ bin/elasticsearch
OpenJDK 64-Bit Server VM warning: If the number of processors is
expected to increase from one, then you should configure the number of
parallel GC threads appropriately using -XX:ParallelGCThreads=N
[2020-06-08T08:15:41,388][INFO ][o.e.e.NodeEnvironment ]
[5Viw2iF] using [1] data paths, mounts [[/ (rootfs)]], net
usable_space [7.4gb], net total_space [16.9gb], types [rootfs]
[2020-06-08T08:15:41,406][INFO ][o.e.e.NodeEnvironment ]
[5Viw2iF] heap size [1015.6mb], compressed ordinary object pointers
[true]
[2020-06-08T08:15:41,409][INFO ][o.e.n.Node ] [5Viw2iF] node
name derived from node ID [5Viw2iFFSraid8DsATRv0Q]; set [node.name]
to override
[2020-06-08T08:15:41,409][INFO ][o.e.n.Node ] [5Viw2iF]
version[6.8.8], pid[28441],
build[default/tar/2f4c224/2020-03-18T23:22:18.622755Z],
OS[Linux/3.10.0-957.el7.x86_64/amd64], JVM[Oracle Corporation/OpenJDK
64-Bit Server VM/1.8.0_181/25.181-b13]
[2020-06-08T08:15:41,410][INFO ][o.e.n.Node ] [5Viw2iF] 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-3859837246303122342,
-XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data,
-XX:ErrorFile=logs/hs_err_pid%p.log, -XX:+PrintGCDetails,
-XX:+PrintGCDateStamps, -XX:+PrintTenuringDistribution,
-XX:+PrintGCApplicationStoppedTime, -Xloggc:logs/gc.log,
-XX:+UseGCLogFileRotation, -XX:NumberOfGCLogFiles=32,
-XX:GCLogFileSize=64m, -Des.path.home=/usr/local/elasticsearch,
-Des.path.conf=/usr/local/elasticsearch/config,
-Des.distribution.flavor=default, -Des.distribution.type=tar]
......
......
[2020-06-08T08:16:13,493][INFO ][o.e.n.Node ] [5Viw2iF] starting
...
[2020-06-08T08:16:13,960][INFO ][o.e.t.TransportService ]
[5Viw2iF] publish_address {192.168.150.101:9300}, bound_addresses
{192.168.150.101:9300}
[2020-06-08T08:16:14,078][INFO ][o.e.b.BootstrapChecks ]
[5Viw2iF] bound or publishing to a non-loopback address, enforcing
bootstrap checks
ERROR: [1] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too
low, increase to at least [65535]
[2020-06-08T08:16:14,170][INFO ][o.e.n.Node ] [5Viw2iF] stopping
...
[2020-06-08T08:16:14,212][INFO ][o.e.n.Node ] [5Viw2iF] stopped
[2020-06-08T08:16:14,213][INFO ][o.e.n.Node ] [5Viw2iF] closing
...
[2020-06-08T08:16:14,273][INFO ][o.e.n.Node ] [5Viw2iF] closed
[2020-06-08T08:16:14,276][INFO ][o.e.x.m.p.NativeController]
[5Viw2iF] Native controller process has stopped - no new native
processes can be started
[es@host101 elasticsearch]$

解决方法:

这个报错刚才不是已经修复了么?
怎么还报这个错误,因为没生效,退出es用户,再重新登录es用户,启动数据库就OK了

[es@host101 elasticsearch]$ exit
logout
[root@host101 elasticsearch]# su - es
Last login: Mon Jun 8 07:56:20 CST 2020 on pts/0[es@host101 ~]$ cd
/usr/local/elasticsearch/
[es@host101 elasticsearch]$ bin/elasticsearch
OpenJDK 64-Bit Server VM warning: If the number of processors is
expected to increase from one, then you should configure the number of
parallel GC threads appropriately using -XX:ParallelGCThreads=N
[2020-06-08T08:18:13,096][INFO ][o.e.e.NodeEnvironment ]
[5Viw2iF] using [1] data paths, mounts [[/ (rootfs)]], net
usable_space [7.4gb], net total_space [16.9gb], types [rootfs]
[2020-06-08T08:18:13,102][INFO ][o.e.e.NodeEnvironment ]
[5Viw2iF] heap size [1015.6mb], compressed ordinary object pointers
[true]
[2020-06-08T08:18:13,119][INFO ][o.e.n.Node ] [5Viw2iF] node
name derived from node ID [5Viw2iFFSraid8DsATRv0Q]; set [node.name]
to override
[2020-06-08T08:18:13,119][INFO ][o.e.n.Node ] [5Viw2iF]
version[6.8.8], pid[28711],
build[default/tar/2f4c224/2020-03-18T23:22:18.622755Z],
OS[Linux/3.10.0-957.el7.x86_64/amd64], JVM[Oracle Corporation/OpenJDK
64-Bit Server VM/1.8.0_181/25.181-b13]
[2020-06-08T08:18:13,120][INFO ][o.e.n.Node ] [5Viw2iF] 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-7764616055026205076,
-XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data,
-XX:ErrorFile=logs/hs_err_pid%p.log, -XX:+PrintGCDetails,
-XX:+PrintGCDateStamps, -XX:+PrintTenuringDistribution,
-XX:+PrintGCApplicationStoppedTime, -Xloggc:logs/gc.log,
-XX:+UseGCLogFileRotation, -XX:NumberOfGCLogFiles=32,
-XX:GCLogFileSize=64m, -Des.path.home=/usr/local/elasticsearch,
-Des.path.conf=/usr/local/elasticsearch/config,
-Des.distribution.flavor=default, -Des.distribution.type=tar]
[2020-06-08T08:18:22,569][INFO ][o.e.p.PluginsService ]
[5Viw2iF] loaded module [aggs-matrix-stats]
[2020-06-08T08:18:22,569][INFO ][o.e.p.PluginsService ]
[5Viw2iF] loaded module [analysis-common]
[2020-06-08T08:18:22,569][INFO ][o.e.p.PluginsService ]
[5Viw2iF] loaded module [ingest-common]
[2020-06-08T08:18:22,569][INFO ][o.e.p.PluginsService ]
[5Viw2iF] loaded module [ingest-geoip]
[2020-06-08T08:18:22,570][INFO ][o.e.p.PluginsService ]
[5Viw2iF] loaded module [ingest-user-agent]
[2020-06-08T08:18:22,570][INFO ][o.e.p.PluginsService ]
[5Viw2iF] loaded module [lang-expression]
[2020-06-08T08:18:22,570][INFO ][o.e.p.PluginsService ]
[5Viw2iF] loaded module [lang-mustache]
[2020-06-08T08:18:22,570][INFO ][o.e.p.PluginsService ]
[5Viw2iF] loaded module [lang-painless]
[2020-06-08T08:18:22,570][INFO ][o.e.p.PluginsService ]
[5Viw2iF] loaded module [mapper-extras]
[2020-06-08T08:18:22,570][INFO ][o.e.p.PluginsService ]
[5Viw2iF] loaded module [parent-join]
[2020-06-08T08:18:22,570][INFO ][o.e.p.PluginsService ]
[5Viw2iF] loaded module [percolator]
[2020-06-08T08:18:22,570][INFO ][o.e.p.PluginsService ]
[5Viw2iF] loaded module [rank-eval]
[2020-06-08T08:18:22,571][INFO ][o.e.p.PluginsService ]
[5Viw2iF] loaded module [reindex]
[2020-06-08T08:18:22,571][INFO ][o.e.p.PluginsService ]
[5Viw2iF] loaded module [repository-url]
[2020-06-08T08:18:22,571][INFO ][o.e.p.PluginsService ]
[5Viw2iF] loaded module [transport-netty4]
[2020-06-08T08:18:22,571][INFO ][o.e.p.PluginsService ]
[5Viw2iF] loaded module [tribe]
[2020-06-08T08:18:22,571][INFO ][o.e.p.PluginsService ]
[5Viw2iF] loaded module [x-pack-ccr]
[2020-06-08T08:18:22,571][INFO ][o.e.p.PluginsService ]
[5Viw2iF] loaded module [x-pack-core]
[2020-06-08T08:18:22,571][INFO ][o.e.p.PluginsService ]
[5Viw2iF] loaded module [x-pack-deprecation]
[2020-06-08T08:18:22,571][INFO ][o.e.p.PluginsService ]
[5Viw2iF] loaded module [x-pack-graph]
[2020-06-08T08:18:22,571][INFO ][o.e.p.PluginsService ]
[5Viw2iF] loaded module [x-pack-ilm]
[2020-06-08T08:18:22,572][INFO ][o.e.p.PluginsService ]
[5Viw2iF] loaded module [x-pack-logstash]
[2020-06-08T08:18:22,572][INFO ][o.e.p.PluginsService ]
[5Viw2iF] loaded module [x-pack-ml]
[2020-06-08T08:18:22,572][INFO ][o.e.p.PluginsService ]
[5Viw2iF] loaded module [x-pack-monitoring]
[2020-06-08T08:18:22,572][INFO ][o.e.p.PluginsService ]
[5Viw2iF] loaded module [x-pack-rollup]
[2020-06-08T08:18:22,572][INFO ][o.e.p.PluginsService ]
[5Viw2iF] loaded module [x-pack-security]
[2020-06-08T08:18:22,572][INFO ][o.e.p.PluginsService ]
[5Viw2iF] loaded module [x-pack-sql]
[2020-06-08T08:18:22,572][INFO ][o.e.p.PluginsService ]
[5Viw2iF] loaded module [x-pack-upgrade]
[2020-06-08T08:18:22,572][INFO ][o.e.p.PluginsService ]
[5Viw2iF] loaded module [x-pack-watcher]
[2020-06-08T08:18:22,573][INFO ][o.e.p.PluginsService ]
[5Viw2iF] no plugins loaded
[2020-06-08T08:18:35,564][INFO ][o.e.x.s.a.s.FileRolesStore]
[5Viw2iF] parsed [0] roles from file
[/usr/local/elasticsearch/config/roles.yml]
[2020-06-08T08:18:37,435][INFO ][o.e.x.m.p.l.CppLogMessageHandler]
[5Viw2iF] [controller/28769] [Main.cc@109] controller (64 bit):
Version 6.8.8 (Build 398321ce7838fd) Copyright (c) 2020 Elasticsearch BV
[2020-06-08T08:18:39,447][DEBUG][o.e.a.ActionModule ] [5Viw2iF]
Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
[2020-06-08T08:18:40,072][INFO ][o.e.d.DiscoveryModule ]
[5Viw2iF] using discovery type [zen] and host providers [settings]
[2020-06-08T08:18:43,133][INFO ][o.e.n.Node ] [5Viw2iF]
initialized
[2020-06-08T08:18:43,134][INFO ][o.e.n.Node ] [5Viw2iF] starting
...
[2020-06-08T08:18:43,835][INFO ][o.e.t.TransportService ]
[5Viw2iF] publish_address {192.168.150.101:9300}, bound_addresses
{192.168.150.101:9300}
[2020-06-08T08:18:43,916][INFO ][o.e.b.BootstrapChecks ]
[5Viw2iF] bound or publishing to a non-loopback address, enforcing
bootstrap checks
[2020-06-08T08:18:47,216][INFO ][o.e.c.s.MasterService ]
[5Viw2iF] zen-disco-elected-as-master ([0] nodes joined), reason:
new_master
{5Viw2iF}{5Viw2iFFSraid8DsATRv0Q}{c6ZTtwwQQ1eGMmDmW6BvbA}{192.168.150.101}{192.168.150.101:9300}{ml.machine_memory=1907941376,
xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}
[2020-06-08T08:18:47,235][INFO ][o.e.c.s.ClusterApplierService]
[5Viw2iF] new_master
{5Viw2iF}{5Viw2iFFSraid8DsATRv0Q}{c6ZTtwwQQ1eGMmDmW6BvbA}{192.168.150.101}{192.168.150.101:9300}{ml.machine_memory=1907941376,
xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}, reason:
apply cluster state (from master [master
{5Viw2iF}{5Viw2iFFSraid8DsATRv0Q}{c6ZTtwwQQ1eGMmDmW6BvbA}{192.168.150.101}{192.168.150.101:9300}{ml.machine_memory=1907941376,
xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true} committed
version [1] source [zen-disco-elected-as-master ([0] nodes
joined)]])
[2020-06-08T08:18:47,607][INFO
][o.e.h.n.Netty4HttpServerTransport] [5Viw2iF] publish_address
{192.168.150.101:9200}, bound_addresses {192.168.150.101:9200}
[2020-06-08T08:18:47,608][INFO ][o.e.n.Node ] [5Viw2iF] started
[2020-06-08T08:18:48,134][WARN
][o.e.x.s.a.s.m.NativeRoleMappingStore] [5Viw2iF] Failed to clear
cache for realms [[]]
[2020-06-08T08:18:48,371][INFO ][o.e.l.LicenseService ]
[5Viw2iF] license [25b1507f-4db2-4bdb-9f72-bf19ed92defe] mode
[basic] - valid
[2020-06-08T08:18:48,434][INFO ][o.e.g.GatewayService ]
[5Viw2iF] recovered [0] indices into cluster_state

 

使用curl命令测试一下,或在浏览器中输入 http://192.168.150.101:9200/ 也会返回相同的信息,单节点安装完成。

[root@host101 config] curl http://192.168.150.101:9200/
{
"name" : "5Viw2iF",
"cluster_name" : "elasticsearch",
"cluster_uuid" :
"IKcwVC2QSZyoMuq0CKC7cA",
"version" : {
"number" : "6.8.8",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "2f4c224",
"build_date" :
"2020-03-18T23:22:18.622755Z",
"build_snapshot" : false,
"lucene_version" : "7.7.2",
"minimum_wire_compatibility_version" :
"5.6.0",
"minimum_index_compatibility_version" :
"5.0.0"
},
"tagline" : "You Know, for Search"
}

以守护进程进行启动:

./bin/elasticsearch -d -p pid

pid将保存在执行命令时所在目录

添加认证:

vi ./config/elasticsearch.yml

#set auth
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true

保存后执行

./bin/elasticsearch-setup-passwords interactive

添加认证后测试9200

curl -u elastic:password http://192.168.0.1:9200


WhoCare
随时发疯
公告

这是一个疯子的自白
最新评论

加载中...