|-转 elasticsearch异常问题 discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
另外可以用root用户直接执行运行,不用切用户
命令:./elasticsearch -d报错,完整代码如下。
[root@10-7-188-37 elasticsearch-7.10.1]# cd bin
[root@10-7-188-37 bin]# su es
[es@10-7-188-37 bin]$ ./elasticsearch -d
Exception in thread "main" java.lang.RuntimeException: starting java failed with [1]
output:
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 1073741824 bytes for committing reserved memory.
# An error report file with more information is saved as:
# logs/hs_err_pid28830.log
error:
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c0000000, 1073741824, 0) failed; error='Not enough space' (errno=12)
at org.elasticsearch.tools.launchers.JvmErgonomics.flagsFinal(JvmErgonomics.java:126)
at org.elasticsearch.tools.launchers.JvmErgonomics.finalJvmOptions(JvmErgonomics.java:88)
at org.elasticsearch.tools.launchers.JvmErgonomics.choose(JvmErgonomics.java:59)
at org.elasticsearch.tools.launchers.JvmOptionsParser.jvmOptions(JvmOptionsParser.java:137)
at org.elasticsearch.tools.launchers.JvmOptionsParser.main(JvmOptionsParser.java:95)
复制下载链接后,可直接在Linux环境下载
wget https://mirrors.huaweicloud.com/elasticsearch/7.10.1/elasticsearch-7.10.1-linux-x86_64.tar.gz
解压文件
tar -zxvf elasticsearch-7.10.1-linux-x86_64.tar.gz
赋予文件夹及子文件可执行权限
chmod -R +x elasticsearch-7.10.1
创建elasticsearch启动用户:can not run elasticsearch as root
adduser es
更改文件夹(elasticsearch-7.10.1)的所属用户
chown -R es elasticsearch-7.10.1
赋予用户(es)该文件夹(elasticsearch-7.10.1)的执行权限
chmod -R +x es elasticsearch-7.10.1
切换到config目录文件
cd elasticsearch-7.10.1/config/
编辑 elasticsearch.yml
cluster.name: elasticsearch node.name: node-1
切换到bin目录文件
cd elasticsearch-7.10.1/bin/
切换用户(es),使用用户(es)后台启动elasticsearch
su es ./elasticsearch -d
访问链接,查看启动效果
curl http://localhost:9200
Ps:部署配置过程中需要注意以下几点:
1.赋予elasticsearch文件执行权限
2.创建elasticsearch启动用户,root用户不能直接启动
3.赋予elasticsearch文件用户执行权限
4.更换elasticsearch文件所属用户
5.修改elasticsearch/config/elasticsearch.yml文件中的cluster.name、node.name: node-1
6.su 切换刚创建的elasticsearch文件所属用户启动
7.elasticsearch默认访问端口为9200,若外部访问则必须开放9200映射端口
命令:/sbin/iptables -I INPUT -p tcp --dport 9200 -j ACCEPT,要在root用戶下...