脚本宝典收集整理的这篇文章主要介绍了

虚拟机centos7全新安装 elasticsearch 6.3

脚本宝典小编觉得挺不错的,现在分享给大家,也给大家做个参考,希望能帮助你少写一行代码,多一份安全和惬意。

**下载ES文件** wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.3.1.zip unzip elasticsearch-6.3.1.zip cd elasticsearch-6.3.1/  wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.3.1.tar.gz tar -xzf elasticsearch-6.3.1.tar.gz cd elasticsearch-6.3.1/   **安装JAVA** #下载java到opt目录 mkdir /usr/java tar zxvf /opt/jdk-8u172-linux-x64.tar.gz -C /usr/java #解压到/usr/java下(重要) vim /etc/profile #编辑环境变量 #在文件末尾增加以下配置并执行 source /etc/profile 让其生效 JAVA_HOME=/usr/java/jdk1.8.0_172 JRE_HOME=/usr/java/jdk1.8.0_172/jre PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin export JAVA_HOME JRE_HOME PATH #新建一个软链接到/usr/bin 下 ln -s /usr/java/jdk1.8.0_172/bin/java /usr/bin/java #测试 java -version   运行./bin/elasticsearch  #报错 需要创建用户 [2018-07-17T19:24:45,552][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] 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:140) ~[elasticsearch-6.3.1.jar:6.3.1]     at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127) ~[elasticsearch-6.3.1.jar:6.3.1]     at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.3.1.jar:6.3.1]     at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.3.1.jar:6.3.1]     at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.3.1.jar:6.3.1]     at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.3.1.jar:6.3.1]     at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86) ~[elasticsearch-6.3.1.jar:6.3.1] Caused by: java.lang.RuntimeException: can not run elasticsearch as root     at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:104) ~[elasticsearch-6.3.1.jar:6.3.1]     at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:171) ~[elasticsearch-6.3.1.jar:6.3.1]     at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:326) ~[elasticsearch-6.3.1.jar:6.3.1]     at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[elasticsearch-6.3.1.jar:6.3.1]     ... 6 more   **创建elasticsearch用户** groupadd elsearch useradd elsearch -g elsearch -p elasticsearch   运行./bin/elasticsearch  #提示权限不足 Exception in thread "main" java.nio.file.AccessDeniedException: /opt/elasticsearch-6.3.1/config/jvm.options     at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)     at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)     at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)     at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)     at java.nio.file.Files.newByteChannel(Files.java:361)     at java.nio.file.Files.newByteChannel(Files.java:407)     at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)     at java.nio.file.Files.newInputStream(Files.java:152)     at org.elasticsearch.tools.launchers.JvmOptionsParser.main(JvmOptionsParser.java:58)   **设置权限** chown -R elsearch:elsearch elasticsearch-6.3.1 运行./bin/elasticsearch curl 127.0.0.1:9200 #成功安装但是外网无法访问 

图片描述

**设置外网访问和按需设置iptables** vim elasticsearch-6.3.1/config/elasticsearch.yml #修改:network.host: 0.0.0.0 jps | grep Elasticsearch kill pid 运行./bin/elasticsearch #重启后报错虚拟机  ERROR: [2] bootstrap checks failed [1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536] 解决:切换root账户修改配置limits.conf 添加下面两行然后重启计算机 vim /etc/security/limits.conf #<domain><type><item><value> * hard nofile 65536 * soft nofile 65536  [2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] 解决:切换root账户 vim /etc/sysctl.conf 增加一行  vm.max_map_count=655360 接着执行 sysctl -p  运行./bin/elasticsearch #外网访问成功  

图片描述

喜欢可以收藏或者点赞,有疑问可以留言谢谢。

参考链接
https://www.elastic.co/guide/...
http://immm.in/2018/05/centos...
https://www.cnblogs.com/woxpp...
https://blog.csdn.net/qq_3167...
https://blog.csdn.net/buzaiqq...

总结

以上是脚本宝典为你收集整理的

虚拟机centos7全新安装 elasticsearch 6.3

全部内容,希望文章能够帮你解决

虚拟机centos7全新安装 elasticsearch 6.3

所遇到的程序开发问题,欢迎加入QQ群277859234一起讨论学习。如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典网站推荐给程序员好友。 本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。

80%的人都看过