美文网首页
【ES-02】CentOS7.6安装Elasticsearch-

【ES-02】CentOS7.6安装Elasticsearch-

作者: 境与界 | 来源:发表于2019-05-12 13:13 被阅读0次

因为head是一个用于管理Elasticsearch的web前端插件,该插件在es5版本以后采用独立服务的形式进行安装使用(之前的版本可以直接在es安装目录中直接安装),因此需要:

1、安装nodejs、npm

yum -y install nodejs npm

2、如果没有安装git,还需要先安装git:

yum -y install git

3、安装elasticsearch-head插件

git clone https://github.com/mobz/elasticsearch-head.git

4、git下载完成后,进入目录,进行操作:

cd elasticsearch-head/
npm install

插件安装相对会慢一些,请耐心等待...

5、配置插件
插件启动前,需要先对插件进行一些相关配置

  • 修改elasticsearch.yml,增加跨域的配置(需要重启es才能生效):
 vim /etc/elasticsearch/elasticsearch.yml
# 加入配置:
http.cors.enabled: true
http.cors.allow-origin: "*"

6、修改Gruntfile.js文件,修改服务监听地址(增加hostname属性,将其值设置为*)


image.png

7、修改head/_site/app.js,修改head连接es的地址(修改localhost为本机的IP地址)


image.png

8、防火墙开启9100端口,并重启防火墙

 firewall-cmd --zone=public --add-port=9100/tcp --permanent
 firewall-cmd --reload

9、启动 ElasticSearch-Head

 cd elasticsearch-head
 npm run start

  • 后台运行
# 采用nohup的形式
nohup npm run start &

10、查看端口

netstat -tunlp

可以看到,目前9100、9200、9300端口正在运行,其中:
9100端口:ElasticSearch-Head 占用端口
9200、9300端口:ElasticSearch 占用端口,9200是http协议的RESTful接口,9300是tcp通讯端口,集群间和TCPClient都走的它
11、停止head插件


image.png

https://blog.csdn.net/zhu815496402/article/details/83181300

相关文章

网友评论

      本文标题:【ES-02】CentOS7.6安装Elasticsearch-

      本文链接:https://www.haomeiwen.com/subject/icfcaqtx.html