您现在的位置是: 首页 > 运维 ElasticSearch安装踩坑指南

ElasticSearch安装踩坑指南

2020-05-20 运维 3934人已围观 7460次浏览

简介ElasticSearch安装踩坑指南

常见启动报错
 
问题1:
the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
出现此类错误,主要是因为es是单机部署。7.0.0更新后出现的提示。
解决方案如下
在config/elasticsearch.yml文件中找到下面的代码,去掉前面的注释
node.name: node-1
然后找到
cluster.initial_master_nodes: ["node-1","node-2"]
里面默认有node-1和node-2,因为是单机部署,所以需要去掉node-2,并且去掉这一行前面的注释
 
问题2:
Error: listen EADDRNOTAVAIL: address not available xxx:xxx:xxx:xxx:5601
启动Kibana时出现,由于底层是node,所以实际上就是node的报错。在绑定IP时,出现地址不可用。
解决方案就是设置内网IP,比如192.168.1.1    127.0.0.1这种,而不是直接绑定公网IP,因为在云服务器上公网IP是分离的
{
	"error": {
		"root_cause": [{
			"type": "mapper_parsing_exception",
			"reason": "Root mapping definition has unsupported parameters: [blog_posts : {_source={enabled=true}, properties={title={analyzer=ik_max_word, type=string}, content={analyzer=ik_max_word, type=string}}}]"
		}],
		"type": "mapper_parsing_exception",
		"reason": "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [blog_posts : {_source={enabled=true}, properties={title={analyzer=ik_max_word, type=string}, content={analyzer=ik_max_word, type=string}}}]",
		"caused_by": {
			"type": "mapper_parsing_exception",
			"reason": "Root mapping definition has unsupported parameters: [blog_posts : {_source={enabled=true}, properties={title={analyzer=ik_max_word, type=string}, content={analyzer=ik_max_word, type=string}}}]"
		}
	},
	"status": 400
}

 

问题3:
IK插件各种版本尝试无用,就算是提交上去了有数据。同样也无法避免搜索时找不到相应数据
最终查看引用的插件文档,发现目前最高的ES版本7.X还不支持,最高的版本支持到6.7.2
所以直接改服务端版本为6.7.2 暂时解决了搜索结果是空的问题。

2019年10月26日更新,当前查看ES官网和IK插件的GitHub发现已经都支持最新的7.4.1版本,所以如果是想尝试最新版本,可以直接安装最新的7.4.1版本

 
问题4:
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
解决方案
vim /etc/sysctl.conf
然后在最后面加上下面这句话
vm.max_map_count=262144
保存退出后执行
sysctl -p

查看输出的结果

 
问题5:
默认的内存占用是1G,如果是配置很低的机器强行要用,则需要修改启动参数,降低内存消耗。最低好像是要求512M内存消耗
修改内存占用可以在/config/jvm.options文件中修改
 
问题6:
7.4.0版本出现了这个提示
future versions of Elasticsearch will require Java 11; your Java version from [/opt/jdk1.8.0_231/jre] does not meet this requirement
翻译过来的意思就是,未来的Elasticsearch版本,需要至少Java 11,但是当前安装的Java版本不支持
 
问题7:
在问题6的基础上修改Java版本为11后,出现了一个警告
Java HotSpot(TM) 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
翻译过来的意思就是
Java Hotspot(TM)64位服务器虚拟机警告:选项useConcMarksweepGC在版本9.0中已被弃用,并可能在将来的版本中被删除。

但是目前来说不影响使用

 

问题8:

ES无法通过root用户直接运行,所以需要新建用户

adduser elsearch

然后给这个账号es安装目录的文件夹权限,否则会在启动时出现读取配置文件没有权限的问题
chown -R elsearch:elsearch elasticsearch/

然后

su elsearch

最后cd到es所在的bin目录下执行下面的命令启动(最后的-d就是后台运行的参数,否则就是前台直接运行的,ctrl+c一下就直接stop了)

./elasticsearch -d

 

很赞哦! (0)

站长推荐

站点信息

  • 网站地图