ElasticSearch installation

Download the ElasticSearch

Website address: https://www.elastic.co/products/elasticsearchCopy the code

Upload the ElasticSearch

You can use the third-party tool Filezilla

Unpack the elasticsearch – 6.4.0. Tar. GzThe tar - ZXVF elasticsearch - 6.4.0. Tar. Gz

[root@localhost elasticsearch]# tar - ZXVF elasticsearch - 6.4.0. Tar. GzElasticsearch 6.4.0 /...Copy the code

Go to the ElasticSearch directory to view the contents of the folderCD elasticsearch - 6.4.0

[root@localhost elasticsearch]# CD elasticsearch - 6.4.0[root @ localhost elasticsearch - 6.4.0]# llTotal usage 436 drwxr-xr-x. 3 root root 4096 8月 29 17:52 bin drwxr-xr-x. 2 root root 148 8月 18 07:23 config drwxr-xr-x. 3 root Root 4096 August 18 07:23 lib-rw-r --r--. 1 root root 13675 August 18 07:11 license. TXT drwxr-xr-x. 2 root root 6 August 18 07:22 Logs drwxr-xr-x. 27 root root 4096 8月 18 07:23 modules-rw-r --r-- 1 root root 401465 8月 18 07:22 NOTICE. TXT drwxr-xr-x 2 root root 6 8月 18 07:22 plugins-rw-r --r--. 1 root root 8511 8月 18 07:11 README. Textile [root@localhost Elasticsearch - 6.4.0]# 

Copy the code

Run ealashicSearch under bin./bin/elasticsearch

Root @ localhost elasticsearch - 6.4.0]# ./bin/elasticsearch[the 2018-08-29 T18:07:52, 437] [WARN] [O.E.B.E lasticsearchUncaughtExceptionHandler] [] uncaught exceptioninthread [main] org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:140) ~ [elasticsearch - 6.4.0 jar: 6.4.0] at org. Elasticsearch. The bootstrap. Elasticsearch. Execute (elasticsearch. Java: 127) ~ [elasticsearch - 6.4.0 jar: 6.4.0] the at Org. Elasticsearch. Cli. EnvironmentAwareCommand. Execute (EnvironmentAwareCommand. Java: 86) ~ [elasticsearch - 6.4.0. Jar: 6.4.0] At org.elasticsearch.cli.Com mand. MainWithoutErrorHandling (124). The Command Java: ~ [elasticsearch - cli - 6.4.0. Jar: 6.4.0] the at Org.elasticsearch.cli.Com mand. Main (90). The Command Java: ~ [elasticsearch - cli - 6.4.0. Jar: 6.4.0] the at Org. Elasticsearch. The bootstrap. Elasticsearch. Main (elasticsearch. Java: 93) ~ [elasticsearch - 6.4.0. Jar: 6.4.0] the at Org. Elasticsearch. The bootstrap. Elasticsearch. Main (elasticsearch. Java: 86) ~ [elasticsearch - 6.4.0. Jar: 6.4.0] under Caused by: java.lang.RuntimeException: can not run elasticsearch as root at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:104) ~ [elasticsearch - 6.4.0 jar: 6.4.0] at org. Elasticsearch. The bootstrap. The bootstrap. Setup (171) the bootstrap. Java: ~ [elasticsearch - 6.4.0 jar: 6.4.0] at org. Elasticsearch. The bootstrap. The bootstrap. Init (326) the bootstrap. Java: ~ [elasticsearch - 6.4.0 jar: 6.4.0] at org. Elasticsearch. The bootstrap. Elasticsearch. Init (elasticsearch. Java: 136) ~ [elasticsearch - 6.4.0 jar: 6.4.0]... Six more [root @ localhost elasticsearch - 6.4.0]# 

Copy the code

The error occurred because you cannot start as root and must create a new user and group

  1. Create Create an ES group
[root @ localhost elasticsearch - 6.4.0]# groupadd eszu
Copy the code
  1. Creating an ES User
[root @ localhost elasticsearch - 6.4.0]# useradd esyonghu
Copy the code
  1. Specified user password
[root @ localhost elasticsearch - 6.4.0]# passwd esyonghuChange the password of user esyonghu. New password: Re-enter the new password: passwd: All authentication tokens have been updated successfully. [root @ localhost elasticsearch - 6.4.0]# 
Copy the code
  1. Example Modify the owning user of a file
[root@localhost elasticsearch]# chown -R esyonghu elasticsearch-6.4.0
Copy the code
  1. Example Modify the owning group of a file
[root@localhost elasticsearch]# CHGRP -r esZU ElasticSearch -6.4.0
Copy the code

Switch the user to esYONGhusu esyonghu, start elasticserach./bin/elasticsearch

[root @ localhost elasticsearch - 6.4.0]# su esyonghu[esyonghu@localhost elasticSearch -6.4.0]$./bin/ elasticSearch [2018-08-30T10:20:25.387][INFO][o.e.n.mode][] initializing ... [2018-08-30T10:20:25.919][INFO][O.E.E.node environment][cRjfMu5] using [1] Data paths, mounts [[/ (rootfs)]], mounts [/ rootfs] Net usable_space [14.8gb], net total_space [16.9 GB], Types [rootfs] [2018-08-30T10:20:25.920][INFO][O.E.E.NodeEnvironment][cRjfMu5] Heap size [1015.6 MB], compressed ordinary object pointers [true[2018-08-30T10:20:25.925][INFO][O.E.n.mode][cRjfMu5] Node Name Derived from node ID [cRjfMu5qTwmlfTzHHWSAiQ];set[node.name] Override [2018-08-30T10:20:25/926][INFO][O.E.n.mode][cRjfMu5] version[6.4.0], PID [1331], Build/default/tar / 595516/2018-08-17 e T23:18:47. 308994 z], OS/Linux / 3.10.0-862. El7. X86_64 / amd64]. JVM[Oracle Corporation/Java HotSpot(TM) 64-bit Server VM/1.8.0_181/25.181-b13] [2018-08-30T10:20:25.25.943][INFO ][o.e.n.Node ] [cRjfMu5] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -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.CT7q3O6F, -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 = 64 m, - Des. Path. The home = / home/elasticsearch/elasticsearch - 6.4.0, - Des. Path. The conf = / home/elasticsearch/elasticsearch - 6.4.0 / config, - Des. Distribution. The flavor = default, -des.distribution. type=tar] [2018-08-30T10:20:32.189][INFO][o.e.p.luginsService][cRjfMu5] Loaded Module [2018-08-30T10:20:32.190][INFO][O.E.p.luginsService][cRjfMu5] Loaded Module [analysis-common] [2018-08-30T10:20:32.190][INFO][o.E.p.luginsService][cRjfMu5] Loaded Module [ingest-common] [2018-08-30T10:20:32.190][INFO][O.E.P.luginsService][cRjfMu5] Loaded Module [lang-expression] [2018-08-30T10:20:32.190][INFO][O.E.P.luginsService][cRjfMu5] Loaded Module [mustache] [2018-08-30T10:20:32.190][INFO][o.E.p.luginsService][cRjfMu5] Loaded Module [lang-painless] [2018-08-30T10:20:32.190][INFO][O.E.P.luginsService][cRjfMu5] Loaded Module [2018-08-30T10:20:32.190][INFO][o.e.p.pluginsService][cRjfMu5] Loaded Module [parent-join] [2018-08-30T10:20:32.191][INFO][o.E.p.luginsService][cRjfMu5] Loaded Module [percolator] [2018-08-30T10:20:32.191][INFO][o.e.p.luginsService][cRjfMu5] Loaded Module [rank-eval] [2018-08-30T10:20:32.191][INFO][o.E.P.luginsService][cRjfMu5] Loaded Module [reindex] [2018-08-30T10:20:32.191][INFO ][o.e.p.luginsService][cRjfMu5] Loaded Module [repository-url] [2018-08-30T10:20:32.192][INFO][o.e.p.luginsService [2018-08-30T10:20:32.192][INFO][O.e.p.luginsService][cRjfMu5] loaded Module [transport-netty4 [tribe] [2018-08-30T10:20:32.192][INFO][O.E.p.luginsService][cRjfMu5] Loaded Module [x-pack-core] [2018-08-30T10:20:32.192][INFO][O.E.p.pluginsService][cRjfMu5] Loaded Module [X-pack - Deprecation] [2018-08-30T10:20:32.192][INFO][o.e.p.luginsService][cRjfMu5] Loaded Module [x-pack-graph] [2018-08-30T10:20:32.192][INFO][O.E.P.luginsService][cRjfMu5] Loaded Module [X-pack-logstash] [2018-08-30T10:20:32.193][INFO][o.E.p.luginsService][cRjfMu5] Loaded Module [x-pack-ml] [2018-08-30T10:20:32.193][INFO][O.E.P.luginsService][cRjfMu5] Loaded Module [x-pack-monitoring] [2018-08-30T10:20:32.193][INFO][o.E.p.luginsService][cRjfMu5] Loaded Module [x-pack-rollup] [2018-08-30T10:20:32.193][INFO][o.E.P.luginsService][cRjfMu5] Loaded Module [x-pack-Security] [2018-08-30T10:20:32.193][INFO][o.E.p.luginsService][cRjfMu5] Loaded Module [x-pack-sql] [2018-08-30T10:20:32.194][INFO][O.E.P.luginsService][cRjfMu5] Loaded Module [x-pack-upgrade] [2018-08-30T10:20:32.194][INFO][o.E.p.luginsService][cRjfMu5] Loaded Module [x-pack-watcher] [2018-08-30T10:20:32.194][INFO][o.E.P.pluginsservice][cRjfMu5] No plugins loaded [2018-08-30T10:20:41.918][INFO ][o.e.x.s.a.s.FileRolesStore] [cRjfMu5] parsed [0] roles from file [/ home/elasticsearch/elasticsearch - 6.4.0 / config/roles. Yml] [the 2018-08-30 T10: fell, 164] [INFO ][o.e.x.m.j.p.l.CppLogMessageHandler] [controller/1379] [Main.cc@109] controller (64 bit): Version 6.4.0 (Build CF8246175EFFF5) Copyright (C) 2018 Elasticsearch BV [2018-08-30T10:20:45:321][DEBUG][O.E.A. ctionModule] Using REST Wrapper from plugin Org. Elasticsearch. Xpack. Security. Security [the 2018-08-30 T10: tell, 935] [INFO] [O.E.D.D iscoveryModule] [cRjfMu5] using discoverytype[ZEN][2018-08-30T10:20:447,619][INFO][O.E.n.mode][cRjfMu5] Initialized [2018-08-30T10:20:447,620][INFO][O.E.n.mode] [cRjfMu5] starting ... [2018-08-30T10:20:48.736][INFO][O.E.T. ransportService][cRjfMu5] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300} [2018-08-30T10:20:48.772][O.E.B. Botstrapchecks][cRjfMu5] Max file Descriptors [4096]forelasticsearch process is too low, Increase to at least [65536] [2018-08-30T10:20:48.773] WARN [O.E.B. Cootstrapchecks][cRjfMu5] Max number of threads [3802]foruser [esyonghu] is too low, Increase to at least [4096] [2018-08-30T10:20:48.773][O.E.B. Bootstrapchecks][cRjfMu5] Max virtual memory areas vm.max_map_count [65530] is too low, Increase at least [262144] [2018-08-30T10:20:51.982][INFO][O.e.c.s.asterservice][cRjfMu5] zen-disco-elected-as-master ([0] nodes joined)[, ], reason: new_master {cRjfMu5} {cRjfMu5qTwmlfTzHHWSAiQ} {oJoeh0w RAijeCMwTKLe - w} {127.0.0.1} {127.0.0.1:9300} {ml machine_memory = 1021906944, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true} [the 2018-08-30 T10:20:51, 993] [INFO] [O.E.C.S.C lusterApplierService] [cRjfMu5] new_master {cRjfMu5} {cRjfMu5qTwmlfTzHHWSAiQ} {oJoeh0w RAijeCMwTKLe - w} {127.0.0.1} {127.0.0.1:9300} {ml machine_memory = 1021906944, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}, reason: apply cluster state (from master [master {cRjfMu5} {cRjfMu5qTwmlfTzHHWSAiQ} {oJoeh0w RAijeCMwTKLe - w} {127.0.0.1} {127.0.0.1:9300} {ml machine_memory = 1021906944, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true} committed version [1] source[zen-disco-elected-as-master ([0] nodes joined)[, [2018-08-30]]]) T10:20:52, 052] [WARN] [O.E.X.S.A.S.M.N ativeRoleMappingStore] [cRjfMu5] Failed to clear the cacheforRealms [[]] [the 2018-08-30 T10:20:52, 066] [INFO] [O.E.X.S.T.N.S ecurityNetty4HttpServerTransport] [cRjfMu5] publish_address Bound_addresses {127.0.0.1:9200}, {[: : 1) : 9200}. {127.0.0.1:9200} [2018-08-30T10:20:52,066][INFO][O.E.n.ode][cRjfMu5] started [2018-08-30T10:20:52,242][INFO [O.E.g.Gawayservice][cRjfMu5] Recovered [0] Indices into Cluster_state [2018-08-30T10:20:52:846][INFO ][o.e.c.m.MetaDataIndexTemplateService] [cRjfMu5] adding template [.triggered_watches]forThe index patterns [. Triggered_watches *] [the 2018-08-30 T10:20:52, 902] [INFO] [O.E.C.M.M etaDataIndexTemplateService] [cRjfMu5] adding template [.watches]forIndex patterns [. Watches *] [the 2018-08-30 T10:20:52, 967] [INFO] [O.E.C.M.M etaDataIndexTemplateService] [cRjfMu5] adding template [.watch-history-9]forThe index patterns. [watcher - history - 9 *] [the 2018-08-30 T10:20:53, 016] [INFO] [O.E.C.M.M etaDataIndexTemplateService] [cRjfMu5] adding template [.monitoring-logstash]forThe index patterns [. Monitoring - logstash - 6 - *] [the 2018-08-30 T10:20:53, 106] [INFO] [O.E.C.M.M etaDataIndexTemplateService] [cRjfMu5] adding template [.monitoring-es]forThe index patterns [. Monitoring - es - 6 - *] [the 2018-08-30 T10:20:53, 148] [INFO] [O.E.C.M.M etaDataIndexTemplateService] [cRjfMu5] adding template [.monitoring-beats]forThe index patterns [. Monitoring - beats - 6 - *] [the 2018-08-30 T10:20:53, 196] [INFO] [O.E.C.M.M etaDataIndexTemplateService] [cRjfMu5] adding template [.monitoring-alerts]forThe index patterns [. Monitoring alerts - 6] [the 2018-08-30 T10:20:53, 255] [INFO] [O.E.C.M.M etaDataIndexTemplateService] [cRjfMu5] adding template [.monitoring-kibana]forIndex patterns [. Monitoring-kibana-6 -*] [2018-08-30T10:20:53.489][INFO][O.E.L.lyenseservice][cRjfMu5] License [29b596fe-89fc-47bb-9ed5-01827361589d] mode [basic] - valid

Copy the code

Now that ElasticSearch has successfully started, let’s test itcurl localhost:9200If you get the data, it is successful, but it is not accessible in the browser. You need to modify the configuration file

To open a new window, type curl localhost:9200 [root@localhost /]# curl localhost:9200
{
  "name" : "cRjfMu5"."cluster_name" : "elasticsearch"."cluster_uuid" : "UhsXc7AVTaSCjSxLYNrRfw"."version" : {
    "number" : "6.4.0"."build_flavor" : "default"."build_type" : "tar"."build_hash" : "595516e"."build_date" : "The 2018-08-17 T23:18:47. 308994 z"."build_snapshot" : false."lucene_version" : "7.4.0"."minimum_wire_compatibility_version" : "5.6.0"."minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}
Copy the code

Configure the elasticSearch port and IP address

Yml: elasticSearch. yml: elasticSearch. yml: elasticSearch. yml: elasticSearch. yml

Network. The host: 192.168.145.129 HTTP. Port: 9200Copy the code

If you start ElasticSearch again, it will no longer work

[esyonghu@localhost elasticSearch -6.4.0]$./bin/ elasticSearch [2018-08-30T11:29:22.930][INFO][o.e.n.mode][] initializing ... [2018-08-30T11:29:23.380][INFO][O.E.E.node environment][cRjfMu5] using [1] Data paths, mounts [[/ (rootfs)]], mounts [/ rootfs] Net usable_space [14.8gb], net total_space [16.9 GB], Types [rootfs] [2018-08-30T11:29:23.381][INFO][O.E.E.NodeEnvironment][cRjfMu5] Heap size [1015.6 MB], compressed ordinary object pointers [true[2018-08-30T11:29:23.382][INFO][O.E.n.mode][cRjfMu5] Node Name Derived from node ID [cRjfMu5qTwmlfTzHHWSAiQ];set[node.name] Override [2018-08-30T11:29:23.382][INFO][O.E.n.mode][cRjfMu5] version[6.4.0], PID [1762], Build/default/tar / 595516/2018-08-17 e T23:18:47. 308994 z], OS/Linux / 3.10.0-862. El7. X86_64 / amd64]. JVM[Oracle Corporation/Java HotSpot(TM) 64-bit Server VM/1.8.0_181/25.181-b13] [2018-08-30T11:29:23.382][INFO ][o.e.n.Node ] [cRjfMu5] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -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.o8Uhb9Ro, -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 = 64 m, - Des. Path. The home = / home/elasticsearch/elasticsearch - 6.4.0, - Des. Path. The conf = / home/elasticsearch/elasticsearch - 6.4.0 / config, - Des. Distribution. The flavor = default, -des.distribution. type=tar] [2018-08-30T11:29:31.350][INFO][o.e.p.pluginsService][cRjfMu5] Loaded Module [2018-08-30T11:29:31.351][INFO][O.E.p.pluginsService][cRjfMu5] Loaded Module [analysis-common] [2018-08-30T11:29:31.352][INFO][O.E.p.luginsService][cRjfMu5] Loaded Module [ingest-common] [2018-08-30T11:29:31.352][INFO][O.E.P.luginsService][cRjfMu5] Loaded Module [lang-expression] [2018-08-30T11:29:31.352][INFO][O.E.P.luginsService][cRjfMu5] Loaded Module [mustache] [2018-08-30T11:29:31.353][INFO][O.E.P.luginsService][cRjfMu5] Loaded Module [lang-painless] [2018-08-30T11:29:31.353][INFO][O.E.P.luginsService][cRjfMu5] Loaded Module [2018-08-30T11:29:31.354][INFO][o.E.p.pluginsService][cRjfMu5] Loaded Module [parent-join] [2018-08-30T11:29:31.354][INFO][o.E.p.luginsService][cRjfMu5] Loaded Module [percolator] [2018-08-30T11:29:31.354][INFO][o.E.p.luginsService][cRjfMu5] Loaded Module [rank-eval] [2018-08-30T11:29:31.355][INFO][O.E.P.luginsService][cRjfMu5] Loaded Module [reindex] [2018-08-30T11:29:31.355][INFO ][o.e.p.luginsService][cRjfMu5] Loaded Module [repository-url] [2018-08-30T11:29:31.356][INFO][O.e.p.luginsService [2018-08-30T11:29:31.356][INFO][O.E.p.luginsService][cRjfMu5] loaded module [transport-netty4 [tribe] [2018-08-30T11:29:31/356][INFO][O.E.P.luginsService][cRjfMu5] Loaded Module [x-pack-core] [2018-08-30T11:29:31.357][INFO][O.E.P.pluginsService][cRjfMu5] Loaded Module [X-pack - Deprecation] [2018-08-30T11:29:31.357][INFO][o.E.p.luginsService][cRjfMu5] Loaded Module [x-pack-graph] [2018-08-30T11:29:31.357][INFO][O.E.P.luginsService][cRjfMu5] Loaded Module [X-pack-logstash] [2018-08-30T11:29:31.358][INFO][O.E.p.luginsService][cRjfMu5] Loaded Module [x-pack-ml] [2018-08-30T11:29:31.358][INFO][O.E.P.luginsService][cRjfMu5] Loaded Module [x-pack-monitoring] [2018-08-30T11:29:31.359][INFO][O.E.P.luginsService][cRjfMu5] Loaded Module [x-pack-rollup] [2018-08-30T11:29:31.359][INFO][O.E.P.luginsService][cRjfMu5] Loaded Module [x-pack-Security] [2018-08-30T11:29:31.359][INFO][O.E.p.luginsService][cRjfMu5] Loaded Module [x-pack-sql] [2018-08-30T11:29:31.370][INFO][O.E.P.luginsService][cRjfMu5] Loaded Module [x-pack-upgrade] [2018-08-30T11:29:31.370][INFO][O.E.p.luginsService][cRjfMu5] Loaded Module [x-pack-watcher] [2018-08-30T11:29:31:372][INFO][o.E.P.pluginsservice][cRjfMu5] No plugins loaded [2018-08-30T11:29:43:859 ][o.e.x.s.a.s.FileRolesStore] [cRjfMu5] parsed [0] roles from file [/ home/elasticsearch/elasticsearch - 6.4.0 / config/roles. Yml] [the 2018-08-30 T11:29:45, 757] [INFO ][o.e.x.m.j.p.l.CppLogMessageHandler] [controller/1810] [Main.cc@109] controller (64 bit): Version 6.4.0 (Build CF8246175EFFF5) Copyright (C) 2018 Elasticsearch BV [2018-08-30T11:29:47.089][DEBUG][O.E.A. ctionModule] Using REST Wrapper from plugin Org. Elasticsearch. Xpack. Security. Security [the 2018-08-30 T11:29:47, 915] [INFO] [O.E.D.D iscoveryModule] [cRjfMu5] using discoverytype[ZEN][2018-08-30T11:29:50,345][INFO][O.E.n.mode][cRjfMu5] Initialized [2018-08-30T11:29:50,345][INFO][O.E.N.mode] [cRjfMu5] starting ... [2018-08-30T11:29:51,185][INFO][O.E.T. ransportService][cRjfMu5] publish_address {192.168.145.129:9300}, Bound_addresses {192.168.145.129:9300} [2018-08-30T11:29:51:351][INFO][O.E.B. bootstrapchecks][cRjfMu5] bound or publishing to a non-loopback address, enforcing bootstrap checks ERROR: [3] bootstrap checks failed [1]: max file descriptors [4096]for elasticsearch process is too low, increase to at least [65536]
[2]: max number of threads [3802] foruser [esyonghu] is too low, increase to at least [4096] [3]: max virtual memory areas vm.max_map_count [65530] is too low, Increase at least [262144] [2018-08-30T11:29:51:486][INFO][O.e.n.ode][cRjfMu5] stopping... [2018-08-30T11:29:51:570][INFO][O.E.N.ode][cRjfMu5] Stopped [2018-08-30T11:29:51:571][INFO][O.E.N.ode][cRjfMu5] closing ... [2018-08-30T11:29:51,633][INFO][O.E.N.ode][cRjfMu5] [2018-08-30T11:29:51,634][INFO][2018-08-30T11:29:51,634 ][o.e.x.m.j.p.NativeController] Native controller process has stopped - no new native processes can be started [esyonghu @ localhost elasticsearch - 6.4.0] $Copy the code

Modify the error, you can see that there are three errors in the console printed information

[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max number of threads [3802] for user [esyonghu] is too low, increase to at least [4096]
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
Copy the code
  1. The first error requires that the current user’s hard and soft call limit be increased [1]: Max file Descriptors [4096] for ElasticSearch process is too low, increase to at least [65536] Switch to root user and runvim /etc/security/limits.conf
[root @ localhost elasticsearch - 6.4.0]# vim /etc/security/limits.conf
Copy the code

Add to the end of the file

esyonghu soft nofile 65536
esyonghu hard nofile 131072
esyonghu soft nproc 2048
esyonghu hard nproc 4096
Copy the code
  1. The second mistake need to modify the/etc/security/limits. D / 20 – nproc. [2] the conf file: max number of threads [3802] for user [esyonghu] is too low, increase to at least [4096]

Modify/etc/security/limits. D / 20 – nproc. Conf file, need to pay attention to the here, may not be called 20 – nproc. Conf may also be a 90 – nproc. Conf

vim /etc/security/limits.d/20-nproc.conf
Copy the code

Add to the file

esyonghu   soft    nproc     4096
Copy the code
  1. The third error requires modification to /etc/sysctl.conf [3]: Max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]vim /etc/sysctl.confTo edit the file, add the following to the file
Combined with the vm. Max_map_count = 262144Copy the code
  1. To make the modified file take effect, run sysctl -p
[root@localhost etc]# sysctl -p
vm.max_map_count = 262144
Copy the code

Go to esyonghu again to elasticSearch file directory to start ElasticSearch

[root @ localhost elasticsearch - 6.4.0]# su esyonghu[esyonghu @ localhost elasticsearch - 6.4.0] $[esyonghu @ localhost elasticsearch - 6.4.0] $cd/ home/elasticsearch/elasticsearch - 6.4.0 [esyonghu @ localhost elasticsearch - 6.4.0] $. / bin/elasticsearch start-up success now, try using the browser to accessCopy the code

Disabling the Firewall

[esyonghu@localhost elasticsearch-6.4.0]$su root [root @ localhost elasticsearch - 6.4.0]# Check firewall Status [root@localhost ElasticSearch-6.4.0]# firewall-cmd --stateRunning [root @ localhost elasticsearch - 6.4.0]# Run the systemctl stop firewald. service [root@localhost elasticSearch-6.4.0] command to stop the firewall.# systemctl stop firewalld.service[root@localhost elasticSearch -6.4.0]# firewall-cmd --stateNot running [root @ localhost elasticsearch - 6.4.0]# 
Copy the code

Switch to ESYONGhu and start again

[root @ localhost elasticsearch - 6.4.0]# su esyonghu[esyonghu@localhost elasticSearch -6.4.0]$[esyonghu@localhost elasticSearch -6.4.0]$./bin/ elasticSearch [2018-08-30T12:09:59:267][INFO][O.E.n.ode][] initializing... Start successfully, use a browser to access itCopy the code

Start ElasticSearch in backend mode

./bin/elasticsearch -d[esyonghu @ localhost elasticsearch - 6.4.0] $. / bin/elasticsearch-d[esyonghu @ localhost elasticsearch - 6.4.0] $Copy the code

End elastsearch

Enter the JPS command to kill elasticSearchCopy the code

If binding to local IP fails, add to elasticSearch.yml

bootstrap.memory_lock: false
bootstrap.system_call_filter: false
Copy the code