关于elasticsearch 6.x及其插件head安装(单机与集群)5分钟解决

第一步,下载es6 +head

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.3.2.zip

wget https://github.com/mobz/elasticsearch-head/archive/master.zip

顺便安装一下node.js环境

wget  https://npm.taobao.org/mirrors/node/v10.8.0/node-v10.8.0-linux-x64.tar.xz

解压: tar -xvf   xxxx.tar.xz   

③确认一下nodejs下bin目录是否有node 和npm文件,如果有执行软连接,如果没有重新下载执行上边步骤;

建立软连接,变为全局

ln -s /usr/local/nodejs/bin/npm /usr/local/bin/

ln -s /usr/local/nodejs/bin/node /usr/local/bin/

最后一步检验nodejs是否已变为全局

在Linux命令行node -v 命令会显示nodejs版本

然后进入head插件目录,安装  npm install

输入 npm run start   运行head插件

第二,修改es配置,集成head插件

对于该文件配置详解在:https://www.ibm.com/support/knowledgecenter/zh/SSFPJS_8.5.6/com.ibm.wbpm.main.doc/topics/rfps_esearch_configoptions.html

修改es目录的config/elasticsearch.yml

vim config/elasticsearch.yml

若集群配置:

master:

http.cors.enabled: true

http.cors.allow-origin: "*"

cluster.name:escluster

node.name:master

node.master:true

 

slave1:

http.cors.enabled: true

http.cors.allow-origin: "*"

cluster.name: escluster

node.name: slave1

http.port: 8200

discovery.zen.ping.unicast.hosts: ["127.0.0.1"]

slave2:

http.cors.enabled: true

http.cors.allow-origin: "*"

cluster.name: escluster

node.name: slave2

http.port: 8000

discovery.zen.ping.unicast.hosts: ["127.0.0.1"]

 

 在复制备用es,建议拷贝zip包,或者事先解压后拷贝。

不然可能会出现

报错with the same id but is a different node instance

是因为复制虚拟机时,elsticsearch时,将elsticsearch文件夹下的data文件夹一并复制了。而在前面测试时,data文件夹下已经产生了data数据,于是报上面的错误。

解决办法:删除elsticsearch文件夹下的data文件夹下的节点数据

单机启动可能会出现一下情况

注:ES有执行脚本的能力,因安全因素,不能在root用户下运行,强行运行会报如下错误:

org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root

解决方案:

groupadd es          #增加es组

useradd es -g es -p pwd          #增加es用户并附加到es组

chown -R es:es elasticsearch-5.1.1          #给目录权限

su es          #使用es用户

./bin/elasticsearch -d          #后台运行es

外网访问

vi conf/elasticsearch.yml

修改network.host: 0.0.0.0

再次启动linux可能出现如下类似错误 

bootstrap checks failed

max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]

解决方案

1、vi /etc/sysctl.conf

新增

只要将vm.max_map_count的大于65536即可

vm.max_map_count=65536+

保存之后sysctl -p使设置生效

2、vi /etc/security/limits.conf 新增

* soft nofile 655350

* hard nofile 655350

3、重新使用SSH登录,再次启动elasticsearch即可。

外网访问:serverip:9200/

外网访问问题

权限不够问题

log权限不够问题等

该地址有解释:http://www.bubuko.com/infodetail-2108888.html

https://blog.csdn.net/qq942477618/article/details/53414983

猜你喜欢

转载自www.cnblogs.com/wchxj/p/9478462.html