ElasticSearch的完整安装教程
ElasticSearch安装
下载ElasticSearch
官网地址:
https://www.elastic.co/products/elasticsearch
本地下载:https://www.nhooo.com/codes/579429.html
上传到ElasticSearch
可以使用第三方工具filezilla
解压elasticsearch-6.4.0.tar.gztar-zxvfelasticsearch-6.4.0.tar.gz
[root@localhostelasticsearch]#tar-zxvfelasticsearch-6.4.0.tar.gz elasticsearch-6.4.0/ ...
进入elasticsearch目录查看文件夹内容cdelasticsearch-6.4.0
[root@localhostelasticsearch]#cdelasticsearch-6.4.0 [root@localhostelasticsearch-6.4.0]#ll 总用量436 drwxr-xr-x.3rootroot40968月2917:52bin drwxr-xr-x.2rootroot1488月1807:23config drwxr-xr-x.3rootroot40968月1807:23lib -rw-r--r--.1rootroot136758月1807:11LICENSE.txt drwxr-xr-x.2rootroot68月1807:22logs drwxr-xr-x.27rootroot40968月1807:23modules -rw-r--r--.1rootroot4014658月1807:22NOTICE.txt drwxr-xr-x.2rootroot68月1807:22plugins -rw-r--r--.1rootroot85118月1807:11README.textile [root@localhostelasticsearch-6.4.0]#
运行bin下面的ealashicsearch./bin/elasticsearch
root@localhostelasticsearch-6.4.0]#./bin/elasticsearch [2018-08-29T18:07:52,437][WARN][o.e.b.ElasticsearchUncaughtExceptionHandler][]uncaughtexceptioninthread[main] org.elasticsearch.bootstrap.StartupException:java.lang.RuntimeException:cannotrunelasticsearchasroot atorg.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:140)~[elasticsearch-6.4.0.jar:6.4.0] atorg.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127)~[elasticsearch-6.4.0.jar:6.4.0] atorg.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)~[elasticsearch-6.4.0.jar:6.4.0] atorg.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124)~[elasticsearch-cli-6.4.0.jar:6.4.0] atorg.elasticsearch.cli.Command.main(Command.java:90)~[elasticsearch-cli-6.4.0.jar:6.4.0] atorg.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93)~[elasticsearch-6.4.0.jar:6.4.0] atorg.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86)~[elasticsearch-6.4.0.jar:6.4.0] Causedby:java.lang.RuntimeException:cannotrunelasticsearchasroot atorg.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:104)~[elasticsearch-6.4.0.jar:6.4.0] atorg.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:171)~[elasticsearch-6.4.0.jar:6.4.0] atorg.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:326)~[elasticsearch-6.4.0.jar:6.4.0] atorg.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136)~[elasticsearch-6.4.0.jar:6.4.0] ...6more [root@localhostelasticsearch-6.4.0]#
出错是因为不能以root用户的方式启动,必须新建一个用户和组
1、创建创建es组
[root@localhostelasticsearch-6.4.0]#groupaddeszu
2、创建es用户
[root@localhostelasticsearch-6.4.0]#useraddesyonghu
3、指定用户密码
[root@localhostelasticsearch-6.4.0]#passwdesyonghu 更改用户esyonghu的密码。 新的密码: 重新输入新的密码: passwd:所有的身份验证令牌已经成功更新。 [root@localhostelasticsearch-6.4.0]#
4、修改文件所属用户
[root@localhostelasticsearch]#chown-Resyonghuelasticsearch-6.4.0
5、修改文件所属组
[root@localhostelasticsearch]#chgrp-Reszuelasticsearch-6.4.0
切换用户到esyonghusuesyonghu,启动elasticserach./bin/elasticsearch
[root@localhostelasticsearch-6.4.0]#suesyonghu [esyonghu@localhostelasticsearch-6.4.0]$./bin/elasticsearch [2018-08-30T10:20:25,387][INFO][o.e.n.Node][]initializing... [2018-08-30T10:20:25,919][INFO][o.e.e.NodeEnvironment][cRjfMu5]using[1]datapaths,mounts[[/(rootfs)]],netusable_space[14.8gb],nettotal_space[16.9gb],types[rootfs] [2018-08-30T10:20:25,920][INFO][o.e.e.NodeEnvironment][cRjfMu5]heapsize[1015.6mb],compressedordinaryobjectpointers[true] [2018-08-30T10:20:25,925][INFO][o.e.n.Node][cRjfMu5]nodenamederivedfromnodeID[cRjfMu5qTwmlfTzHHWSAiQ];set[node.name]tooverride [2018-08-30T10:20:25,926][INFO][o.e.n.Node][cRjfMu5]version[6.4.0],pid[1331],build[default/tar/595516e/2018-08-17T23:18:47.308994Z],OS[Linux/3.10.0-862.el7.x86_64/amd64],JVM[OracleCorporation/JavaHotSpot(TM)64-BitServerVM/1.8.0_181/25.181-b13] [2018-08-30T10:20:25,943][INFO][o.e.n.Node][cRjfMu5]JVMarguments[-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=64m,-Des.path.home=/home/elasticsearch/elasticsearch-6.4.0,-Des.path.conf=/home/elasticsearch/elasticsearch-6.4.0/config,-Des.distribution.flavor=default,-Des.distribution.type=tar] [2018-08-30T10:20:32,189][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[aggs-matrix-stats] [2018-08-30T10:20:32,190][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[analysis-common] [2018-08-30T10:20:32,190][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[ingest-common] [2018-08-30T10:20:32,190][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[lang-expression] [2018-08-30T10:20:32,190][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[lang-mustache] [2018-08-30T10:20:32,190][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[lang-painless] [2018-08-30T10:20:32,190][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[mapper-extras] [2018-08-30T10:20:32,190][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[parent-join] [2018-08-30T10:20:32,191][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[percolator] [2018-08-30T10:20:32,191][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[rank-eval] [2018-08-30T10:20:32,191][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[reindex] [2018-08-30T10:20:32,191][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[repository-url] [2018-08-30T10:20:32,192][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[transport-netty4] [2018-08-30T10:20:32,192][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[tribe] [2018-08-30T10:20:32,192][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[x-pack-core] [2018-08-30T10:20:32,192][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[x-pack-deprecation] [2018-08-30T10:20:32,192][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[x-pack-graph] [2018-08-30T10:20:32,192][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[x-pack-logstash] [2018-08-30T10:20:32,193][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[x-pack-ml] [2018-08-30T10:20:32,193][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[x-pack-monitoring] [2018-08-30T10:20:32,193][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[x-pack-rollup] [2018-08-30T10:20:32,193][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[x-pack-security] [2018-08-30T10:20:32,193][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[x-pack-sql] [2018-08-30T10:20:32,194][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[x-pack-upgrade] [2018-08-30T10:20:32,194][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[x-pack-watcher] [2018-08-30T10:20:32,194][INFO][o.e.p.PluginsService][cRjfMu5]nopluginsloaded [2018-08-30T10:20:41,918][INFO][o.e.x.s.a.s.FileRolesStore][cRjfMu5]parsed[0]rolesfromfile[/home/elasticsearch/elasticsearch-6.4.0/config/roles.yml] [2018-08-30T10:20:44,164][INFO][o.e.x.m.j.p.l.CppLogMessageHandler][controller/1379][Main.cc@109]controller(64bit):Version6.4.0(Buildcf8246175efff5)Copyright(c)2018ElasticsearchBV [2018-08-30T10:20:45,321][DEBUG][o.e.a.ActionModule]UsingRESTwrapperfrompluginorg.elasticsearch.xpack.security.Security [2018-08-30T10:20:45,935][INFO][o.e.d.DiscoveryModule][cRjfMu5]usingdiscoverytype[zen] [2018-08-30T10:20:47,619][INFO][o.e.n.Node][cRjfMu5]initialized [2018-08-30T10:20:47,620][INFO][o.e.n.Node][cRjfMu5]starting... [2018-08-30T10:20:48,736][INFO][o.e.t.TransportService][cRjfMu5]publish_address{127.0.0.1:9300},bound_addresses{[::1]:9300},{127.0.0.1:9300} [2018-08-30T10:20:48,772][WARN][o.e.b.BootstrapChecks][cRjfMu5]maxfiledescriptors[4096]forelasticsearchprocessistoolow,increasetoatleast[65536] [2018-08-30T10:20:48,773][WARN][o.e.b.BootstrapChecks][cRjfMu5]maxnumberofthreads[3802]foruser[esyonghu]istoolow,increasetoatleast[4096] [2018-08-30T10:20:48,773][WARN][o.e.b.BootstrapChecks][cRjfMu5]maxvirtualmemoryareasvm.max_map_count[65530]istoolow,increasetoatleast[262144] [2018-08-30T10:20:51,982][INFO][o.e.c.s.MasterService][cRjfMu5]zen-disco-elected-as-master([0]nodesjoined)[,],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} [2018-08-30T10:20:51,993][INFO][o.e.c.s.ClusterApplierService][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:applyclusterstate(frommaster[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}committedversion[1]source[zen-disco-elected-as-master([0]nodesjoined)[,]]]) [2018-08-30T10:20:52,052][WARN][o.e.x.s.a.s.m.NativeRoleMappingStore][cRjfMu5]Failedtoclearcacheforrealms[[]] [2018-08-30T10:20:52,066][INFO][o.e.x.s.t.n.SecurityNetty4HttpServerTransport][cRjfMu5]publish_address{127.0.0.1:9200},bound_addresses{[::1]:9200},{127.0.0.1:9200} [2018-08-30T10:20:52,066][INFO][o.e.n.Node][cRjfMu5]started [2018-08-30T10:20:52,242][INFO][o.e.g.GatewayService][cRjfMu5]recovered[0]indicesintocluster_state [2018-08-30T10:20:52,846][INFO][o.e.c.m.MetaDataIndexTemplateService][cRjfMu5]addingtemplate[.triggered_watches]forindexpatterns[.triggered_watches*] [2018-08-30T10:20:52,902][INFO][o.e.c.m.MetaDataIndexTemplateService][cRjfMu5]addingtemplate[.watches]forindexpatterns[.watches*] [2018-08-30T10:20:52,967][INFO][o.e.c.m.MetaDataIndexTemplateService][cRjfMu5]addingtemplate[.watch-history-9]forindexpatterns[.watcher-history-9*] [2018-08-30T10:20:53,016][INFO][o.e.c.m.MetaDataIndexTemplateService][cRjfMu5]addingtemplate[.monitoring-logstash]forindexpatterns[.monitoring-logstash-6-*] [2018-08-30T10:20:53,106][INFO][o.e.c.m.MetaDataIndexTemplateService][cRjfMu5]addingtemplate[.monitoring-es]forindexpatterns[.monitoring-es-6-*] [2018-08-30T10:20:53,148][INFO][o.e.c.m.MetaDataIndexTemplateService][cRjfMu5]addingtemplate[.monitoring-beats]forindexpatterns[.monitoring-beats-6-*] [2018-08-30T10:20:53,196][INFO][o.e.c.m.MetaDataIndexTemplateService][cRjfMu5]addingtemplate[.monitoring-alerts]forindexpatterns[.monitoring-alerts-6] [2018-08-30T10:20:53,255][INFO][o.e.c.m.MetaDataIndexTemplateService][cRjfMu5]addingtemplate[.monitoring-kibana]forindexpatterns[.monitoring-kibana-6-*] [2018-08-30T10:20:53,489][INFO][o.e.l.LicenseService][cRjfMu5]license[29b596fe-89fc-47bb-9ed5-01827361589d]mode[basic]-valid
这时候elasticsearch已经成功启动,我们来测试一下curllocalhost:9200,如果得到了这些数据就说明成功了,但是在浏览器里面并不能访问,需要修改配置文件
新打开一个窗口,输入curllocalhost:9200 [root@localhost/]#curllocalhost: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":"2018-08-17T23:18:47.308994Z", "build_snapshot":false, "lucene_version":"7.4.0", "minimum_wire_compatibility_version":"5.6.0", "minimum_index_compatibility_version":"5.0.0" }, "tagline":"YouKnow,forSearch" }
配置elasticsearch端口和ip
进入config文件夹,里面有一个elasticsearch.yml文件,使用vimelasticsearch.yml命令来编辑该文件,添加如下内容
network.host:192.168.145.129 http.port:9200
再次启动elasticsearch,会发现已经启动不了了
[esyonghu@localhostelasticsearch-6.4.0]$./bin/elasticsearch [2018-08-30T11:29:22,930][INFO][o.e.n.Node][]initializing... [2018-08-30T11:29:23,380][INFO][o.e.e.NodeEnvironment][cRjfMu5]using[1]datapaths,mounts[[/(rootfs)]],netusable_space[14.8gb],nettotal_space[16.9gb],types[rootfs] [2018-08-30T11:29:23,381][INFO][o.e.e.NodeEnvironment][cRjfMu5]heapsize[1015.6mb],compressedordinaryobjectpointers[true] [2018-08-30T11:29:23,382][INFO][o.e.n.Node][cRjfMu5]nodenamederivedfromnodeID[cRjfMu5qTwmlfTzHHWSAiQ];set[node.name]tooverride [2018-08-30T11:29:23,382][INFO][o.e.n.Node][cRjfMu5]version[6.4.0],pid[1762],build[default/tar/595516e/2018-08-17T23:18:47.308994Z],OS[Linux/3.10.0-862.el7.x86_64/amd64],JVM[OracleCorporation/JavaHotSpot(TM)64-BitServerVM/1.8.0_181/25.181-b13] [2018-08-30T11:29:23,382][INFO][o.e.n.Node][cRjfMu5]JVMarguments[-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=64m,-Des.path.home=/home/elasticsearch/elasticsearch-6.4.0,-Des.path.conf=/home/elasticsearch/elasticsearch-6.4.0/config,-Des.distribution.flavor=default,-Des.distribution.type=tar] [2018-08-30T11:29:31,350][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[aggs-matrix-stats] [2018-08-30T11:29:31,351][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[analysis-common] [2018-08-30T11:29:31,352][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[ingest-common] [2018-08-30T11:29:31,352][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[lang-expression] [2018-08-30T11:29:31,352][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[lang-mustache] [2018-08-30T11:29:31,353][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[lang-painless] [2018-08-30T11:29:31,353][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[mapper-extras] [2018-08-30T11:29:31,354][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[parent-join] [2018-08-30T11:29:31,354][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[percolator] [2018-08-30T11:29:31,354][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[rank-eval] [2018-08-30T11:29:31,355][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[reindex] [2018-08-30T11:29:31,355][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[repository-url] [2018-08-30T11:29:31,356][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[transport-netty4] [2018-08-30T11:29:31,356][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[tribe] [2018-08-30T11:29:31,356][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[x-pack-core] [2018-08-30T11:29:31,357][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[x-pack-deprecation] [2018-08-30T11:29:31,357][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[x-pack-graph] [2018-08-30T11:29:31,357][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[x-pack-logstash] [2018-08-30T11:29:31,358][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[x-pack-ml] [2018-08-30T11:29:31,358][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[x-pack-monitoring] [2018-08-30T11:29:31,359][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[x-pack-rollup] [2018-08-30T11:29:31,359][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[x-pack-security] [2018-08-30T11:29:31,359][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[x-pack-sql] [2018-08-30T11:29:31,370][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[x-pack-upgrade] [2018-08-30T11:29:31,370][INFO][o.e.p.PluginsService][cRjfMu5]loadedmodule[x-pack-watcher] [2018-08-30T11:29:31,372][INFO][o.e.p.PluginsService][cRjfMu5]nopluginsloaded [2018-08-30T11:29:43,859][INFO][o.e.x.s.a.s.FileRolesStore][cRjfMu5]parsed[0]rolesfromfile[/home/elasticsearch/elasticsearch-6.4.0/config/roles.yml] [2018-08-30T11:29:45,757][INFO][o.e.x.m.j.p.l.CppLogMessageHandler][controller/1810][Main.cc@109]controller(64bit):Version6.4.0(Buildcf8246175efff5)Copyright(c)2018ElasticsearchBV [2018-08-30T11:29:47,089][DEBUG][o.e.a.ActionModule]UsingRESTwrapperfrompluginorg.elasticsearch.xpack.security.Security [2018-08-30T11:29:47,915][INFO][o.e.d.DiscoveryModule][cRjfMu5]usingdiscoverytype[zen] [2018-08-30T11:29:50,345][INFO][o.e.n.Node][cRjfMu5]initialized [2018-08-30T11:29:50,345][INFO][o.e.n.Node][cRjfMu5]starting... [2018-08-30T11:29:51,185][INFO][o.e.t.TransportService][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]boundorpublishingtoanon-loopbackaddress,enforcingbootstrapchecks ERROR:[3]bootstrapchecksfailed [1]:maxfiledescriptors[4096]forelasticsearchprocessistoolow,increasetoatleast[65536] [2]:maxnumberofthreads[3802]foruser[esyonghu]istoolow,increasetoatleast[4096] [3]:maxvirtualmemoryareasvm.max_map_count[65530]istoolow,increasetoatleast[262144] [2018-08-30T11:29:51,486][INFO][o.e.n.Node][cRjfMu5]stopping... [2018-08-30T11:29:51,570][INFO][o.e.n.Node][cRjfMu5]stopped [2018-08-30T11:29:51,571][INFO][o.e.n.Node][cRjfMu5]closing... [2018-08-30T11:29:51,633][INFO][o.e.n.Node][cRjfMu5]closed [2018-08-30T11:29:51,634][INFO][o.e.x.m.j.p.NativeController]Nativecontrollerprocesshasstopped-nonewnativeprocessescanbestarted [esyonghu@localhostelasticsearch-6.4.0]$
修改错误,可以看到控制台打印的信息里面有3个错误
[1]:maxfiledescriptors[4096]forelasticsearchprocessistoolow,increasetoatleast[65536] [2]:maxnumberofthreads[3802]foruser[esyonghu]istoolow,increasetoatleast[4096] [3]:maxvirtualmemoryareasvm.max_map_count[65530]istoolow,increasetoatleast[262144]
第一个错误需要将当前用户的软硬调用限制调大
[1]:maxfiledescriptors[4096]forelasticsearchprocessistoolow,increasetoatleast[65536]
切换到root用户,然后执行vim/etc/security/limits.conf
[root@localhostelasticsearch-6.4.0]#vim/etc/security/limits.conf
在文件末尾加上
esyonghusoftnofile65536 esyonghuhardnofile131072 esyonghusoftnproc2048 esyonghuhardnproc4096
第二个错误需要修改/etc/security/limits.d/20-nproc.conf文件
[2]:maxnumberofthreads[3802]foruser[esyonghu]istoolow,increasetoatleast[4096]
修改/etc/security/limits.d/20-nproc.conf文件,这里需要注意一下,可能不叫20-nproc.conf也可能是90-nproc.conf
vim/etc/security/limits.d/20-nproc.conf
在文件中添加
esyonghusoftnproc4096
第三个错误需要修改/etc/sysctl.conf
[3]:maxvirtualmemoryareasvm.max_map_count[65530]istoolow,increasetoatleast[262144]
使用命令vim/etc/sysctl.conf来编辑该文件,在文件中加入如下内容
加上vm.max_map_count=262144
需要使改文件生效,执行sysctl-p
[root@localhostetc]#sysctl-p vm.max_map_count=262144
再次切换到esyonghu去elasticsearch文件目录启动elasticsearch
[root@localhostelasticsearch-6.4.0]#suesyonghu [esyonghu@localhostelasticsearch-6.4.0]$ [esyonghu@localhostelasticsearch-6.4.0]$cd/home/elasticsearch/elasticsearch-6.4.0 [esyonghu@localhostelasticsearch-6.4.0]$./bin/elasticsearch 现在启动成功了,使用浏览器访问试一下
关闭防火墙
再次访问的时候发现还是不行,这时候需要关闭防火墙 检查防火墙状态 先切换到root用户 [esyonghu@localhostelasticsearch-6.4.0]$suroot 密码: [root@localhostelasticsearch-6.4.0]# 查看防火墙状态 [root@localhostelasticsearch-6.4.0]#firewall-cmd--state running [root@localhostelasticsearch-6.4.0]# 状态是running,需要关闭防火墙 执行systemctlstopfirewalld.service [root@localhostelasticsearch-6.4.0]#systemctlstopfirewalld.service 再次检查防火墙状态,就是为运行了 [root@localhostelasticsearch-6.4.0]#firewall-cmd--state notrunning [root@localhostelasticsearch-6.4.0]#
切换到esyonghu再次启动
[root@localhostelasticsearch-6.4.0]#suesyonghu [esyonghu@localhostelasticsearch-6.4.0]$ [esyonghu@localhostelasticsearch-6.4.0]$./bin/elasticsearch [2018-08-30T12:09:59,267][INFO][o.e.n.Node][]initializing... 启动成功,使用浏览器访问就可以了
以后台方式启动elasticsearch
./bin/elasticsearch-d [esyonghu@localhostelasticsearch-6.4.0]$./bin/elasticsearch-d [esyonghu@localhostelasticsearch-6.4.0]$
结束elastsearch
输入jps命令 杀死elasticsearch进程
如果绑定本地ip失败,那么在elasticsearch.yml里面加上
bootstrap.memory_lock:false bootstrap.system_call_filter:false
总结
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对毛票票的支持。