git clone https://github.com/mobz/elasticsearch-head.git
yum install nodejs
npm install
修改Elasticsearch配置,允许跨域访问,修改后重新启动Elasticsearch
vi elasticsearch-7.1.1/config/elasticsearch.yml
#添加如下配置,支持跨域访问
http.cors.enabled: true
http.cors.allow-origin: "*"
启动
# elasticsearch-head目录下执行
npm run start
报错
./bin/elasticsearch
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.
[2019-07-06T17:36:30,052][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [agangdeMacBook-Pro.local] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: failed to obtain node locks, tried [[/docker/elasticsearch-7.1.1/data]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?
解决
原因:线程占用
解决:重新启动
step1:杀死elasticsearch线程
ps -ef | grep elastic
kill -9
XXX
修改 elasticsearch-head 目录下的 Gruntfile.js 文件,在 options 属性内增加 hostname,设置为 0.0.0.0。
connect: {
server: {
options: {
hostname: ‘0.0.0.0‘,
port: 9100,
base: ‘.‘,
keepalive: true
}
}
}
原文地址:https://www.cnblogs.com/agang-php/p/11143494.html