一、CentOS 7.9 安装 elasticsearch-7.8.1地址
- https://www.elastic.co
- https://www.elastic.co/cn/downloads/past-releases
- https://github.com/elastic
- https://github.com/medcl/elasticsearch-analysis-ik
- https://www.elastic.co/guide/en/logstash/7.8/index.html
文章插图
文章插图
二、安装准备JDK 11+:由于elasticsearch 运行需要JDK环境,如果 JDK 低于 1.8 会有一些问题 。
future versions of Elasticsearch will require Java 11; your Java version from [/opt/jdk1.8.0_333/jre] does not meet this requirement
版本需要和elasticserach版本一致,否则会报错三、安装elasticsearch解压
tar -zxvf /opt/software/elastic/elasticsearch-7.8.1-linux-x86_64.tar.gz -C /opt/elastic/
进入elasticsearch目录中目录中自带了jdk
文章插图
四、修改配置文件1 修改配置:jvm.options
因为默认的jvm参数-Xms和Xmx都是1G 。自己搭的虚拟机可能内存分配不多,会导致启动失败,根据自己的机器情况合理分配 。
vim /opt/elastic/elasticsearch-7.8.1/config/jvm.options################################################################# Xms represents the initial size of total heap space# Xmx represents the maximum size of total heap space-Xms512m-Xmx512m################################################################
2 修改配置:elasticsearch.ymlvim /opt/elastic/elasticsearch-7.8.1/config/elasticsearch.yml# ----------------------------------- Paths ------------------------------------## Path to directory where to store the data (separate multiple locations by comma):#path.data: /opt/elastic/es/data # 数据存放位置## Path to log files:#path.logs: /opt/elastic/es/logs # 日志存放位置# ---------------------------------- Network -----------------------------------## Set the bind address to a specific IP (IPv4 or IPv6):#network.host: 192.168.0. # 开放外网访问## Set a custom port for HTTP:#http.port: 9200 # 设置端口## For more information, consult the network module documentation.
五、尝试启动1 require 必须 Java 112 运行elasticsearch不能使用root用户启动
查看代码
[root@ecs-65685 bin]# /opt/elastic/elasticsearch-7.8.1/bin/elasticsearchfuture versions of Elasticsearch will require Java 11; your Java version from [/opt/jdk1.8.0_333/jre] does not meet this requirementfuture versions of Elasticsearch will require Java 11; your Java version from [/opt/jdk1.8.0_333/jre] does not meet this requirement[2022-10-11T17:40:42,664][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [ecs-65685] 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:174) ~[elasticsearch-7.8.1.jar:7.8.1] at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:161) ~[elasticsearch-7.8.1.jar:7.8.1] at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-7.8.1.jar:7.8.1] at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127) ~[elasticsearch-cli-7.8.1.jar:7.8.1] at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-7.8.1.jar:7.8.1] at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:126) ~[elasticsearch-7.8.1.jar:7.8.1] at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-7.8.1.jar:7.8.1]Caused by: java.lang.RuntimeException: can not run elasticsearch as root at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:111) ~[elasticsearch-7.8.1.jar:7.8.1] at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:178) ~[elasticsearch-7.8.1.jar:7.8.1] at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:393) ~[elasticsearch-7.8.1.jar:7.8.1] at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:170) ~[elasticsearch-7.8.1.jar:7.8.1] ... 6 moreuncaught exception in thread [main]java.lang.RuntimeException: can not run elasticsearch as root at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:111) at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:178) at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:393) at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:170) at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:161) at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127) at org.elasticsearch.cli.Command.main(Command.java:90) at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:126) at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92)For complete error details, refer to the log at /opt/elastic/es/logs/elasticsearch.log[root@ecs-65685 bin]# 2022-10-11 09:40:42,993994 UTC [6056] ERROR CLogger.cc@311 Cannot log to named pipe /tmp/elasticsearch-1369077120224648390/controller_log_5893 as it could not be opened for writing2022-10-11 09:40:42,994085 UTC [6056] INFOMain.cc@104 Parent process died - ML controller exiting
推荐阅读
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 小米盒子怎么安装? 怎么用(小米盒子安装软件提示安装失败)
- Docker | 数据持久化与数据共享
- 小米盒子怎么用安装(小米盒子如何安装kodi)
- 带有pwn环境的Ubuntu22.04快速安装
- 使用docker-compose安装Prometheus
- 手把手教你玩转 Gitea|在 Windows 系统上安装 Gitea
- 已验证 Linux安装中文字体
- CentOS 7.9 安装 rabbitmq-3.10.2
- CentOS 7.9 安装 rocketmq-4.9.2
- 不安装运行时运行 .NET 程序 - NativeAOT