Elasticsearch-----------安装过程及报错解决总结

本文详细介绍了Elasticsearch的下载、解压、配置及常见问题解决方法,包括远程访问设置、用户组创建、内存限制调整及日志配置等。

一、下载Elasticsearch

1.自行从官方下载

2.解压及配置文件修改

cd /usr/local/src 
 
rz命令,将本地Elasticsearch压缩包上传 
 
tar -zxvf elasticsearch-6.5.0.tar.gz   
 
mv elasticsearch-6.5.0 /usr/local/tools/
 
#远程访问开启:yml文件修改:
network.host:内网ip地址
http.port:9200
 
#重启即可
#若报bind Exception 则检查机器ip是否正确

3.添加es用户并启动

#添加用户及用户组
groupadd esgroup;
useradd esuser -g esgroup -p 123456;
[root@iz2zebdl5tab26agsgfhvwz tools]# chown -R esuser:esgroup elasticsearch-6.5.0
su esuser;
 
#普通启动
./bin/elasticsearch
 
#后台启动
./bin/elasticsearch -d

4.遇到的问题及解决方法:

1.若出现以下错误:
max file descriptions[4096] for elasticsearch process is too low...
max number of thread |3790| for user esuser is too low...
max virtual memory areas vm.max_map_count 65536 is too low...
则解决方式如下:
 
su root
vim /etc/security/limits.conf
esuser soft nofile 65536
esuser hard nofile 65536
esuser soft nproc 4096
esuser hard nproc 4096
 
vim /etc/security/limits.d/20-nproc.conf
esuser soft nproc 4096
 
vim /etc/sysctl.conf
vm.max_map_count=655360
执行sysctl -p生效
 
 
2.若出现启动失败显示killed:
则解决方式如下:
vim config/jvm.options
-Xms512m
-Xmx512m
 
3.遇到以下问题:
main ERROR Could not register mbeans java.security.AccessControlException: 
access denied ("javax.management.MBeanTrustPermission" "register")
基本就是权限问题了,解决
查看文件所属用户:ll
为esyonghu设权限:chown -R esyonghu:eszu elasticsearch-6.5.0
[esuser@iz2zebdl5tab26agsgfhvwz elasticsearch-6.5.0]$ ./bin/elasticsearch
Exception in thread "main" 2021-04-25 14:55:32,274 main ERROR No Log4j 2 configuration file found. Using default configuration (logging only errors to the console), or user programmatically provided configurations. Set system property 'log4j2.debug' to show Log4j 2 internal initialization logging. See https://logging.apache.org/log4j/2.x/manual/configuration.html for instructions on how to configure Log4j 2
SettingsException[Failed to load settings from [elasticsearch.yml]]; nested: ParsingException[Failed to parse object: expecting token of type [START_OBJECT] but found [VALUE_STRING]];
	at org.elasticsearch.common.settings.Settings$Builder.loadFromStream(Settings.java:1216)
	at org.elasticsearch.common.settings.Settings$Builder.loadFromPath(Settings.java:1189)
	at org.elasticsearch.node.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPreparer.java:100)
	at org.elasticsearch.cli.EnvironmentAwareCommand.createEnv(EnvironmentAwareCommand.java:95)
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124)
	at org.elasticsearch.cli.Command.main(Command.java:90)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86)
Caused by: ParsingException[Failed to parse object: expecting token of type [START_OBJECT] but found [VALUE_STRING]]
	at org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken(XContentParserUtils.java:78)
	at org.elasticsearch.common.settings.Settings.fromXContent(Settings.java:696)
	at org.elasticsearch.common.settings.Settings.access$500(Settings.java:84)
	at org.elasticsearch.common.settings.Settings$Builder.loadFromStream(Settings.java:1212)
	... 8 more



#解决
这个问题是空格引起的,
注意冒号后加空格然后是参数值,注意检查配置文件

 

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值