概述
1. 安装ElasticSearch
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.0.0.tar.gz
2.解压安装包
tar -vxf elasticsearch-6.0.0.tar.gz
3.进入bin目录执行 elasticsearch
cd elasticsearch-6.0.0/bin
./elasticsearch
这时会报一个错误
Exception in thread "main" java.lang.RuntimeException: don't run elasticsearch as root. at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:93) at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:144) at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:285) at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35) Refer to the log for complete error details.
这是elasticsearch 不支持在root用户下执行 这时 我们需要创建一个新的用户 并赋予权限去执行
4.创建elsearch用户组及elsearch用户
-
groupadd elsearch
-
useradd elsearch -g elsearch -p elasticsearch
5.
更改elasticsearch文件夹及内部文件的所属用户及组为elsearch:elsearch
-
cd /opt
-
chown -R elsearch:elsearch elasticsearch
6.切换到elsearch用户再启动
-
su elsearch cd elasticsearch/bin
-
./elasticsearch
然后又报了一个java.lang.UnsupportedOperationException: seccomp unavailable: CONFIG_SECCOMP not compiled into kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are needed
的错误
原因是:因为不支持SecComp,而ES默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动解决:修改
解决办法是:在config下的elasticsearch.yml下增加以下内容:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
重新执行elasticsearch 又报了一个
ElasticsearchException[X-Pack is not supported and Machine Learning is not available for [windows-x86]; you can use the other X-Pack features (unsupported) by setting xpack.ml.enabled: false in elasticsearch.yml] 的错误
这是由于32位的linux系统引起的错误
解决办法是:
在elasticsearch下添加以下内容:
xpack.ml.enabled: false
然后重新启动 可以成功正常启动
输入 curl 'http://localhost:9200/'
打印出
{
"name" : "-hvD4Et",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "92ZVeqSdQsusRK3wLB6aOA",
"version" : {
"number" : "6.5.4",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "d2ef93d",
"build_date" : "2018-12-17T21:17:40.758843Z",
"build_snapshot" : false,
"lucene_version" : "7.5.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
到这里 elasticsearch 就安装成功了。
最后
以上就是感动火车为你收集整理的ubantu 下安装 ElasticSearch 时遇到的问题,以及解决方式的全部内容,希望文章能够帮你解决ubantu 下安装 ElasticSearch 时遇到的问题,以及解决方式所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复