elasticsearch-head 配置


elasticsearch-head

install node.js

  1. Download node.js:

  2. 將下載的包,解壓並配置環境變量

 vim /etc/profile 
 
 #set for nodejs
 export NODE_HOME=/opt/modules/node-v10.9.0-linux-x64
 export PATH=$NODE_HOME/bin:$PATH
 
  1. Install cnpm npm install cnpm -g --registry=https://registry.npm.taobao.org

  2. npm taobao mirror

 1.得到原本的鏡像地址
 npm get registry
 https://registry.npmjs.org/
 設成淘寶的
 npm config set registry http://registry.npm.taobao.org/
 yarn config set registry http://registry.npm.taobao.org/
 2.換成原來的
 npm config set registry https://registry.npmjs.org/
 
  1. 修改Gruntfile.js

 [fan@master elasticsearch-head]$ cd /opt/modules/elasticsearch-head  
 [fan@master elasticsearch-head]$ vim Gruntfile.js
  • 在connect-->server-->options下面添加:hostname:'*', 允許所有ip訪問。

 connect: {
                        server: {
                                options: {
                                        hostname:'*',
                                        port: 9100,
                                        base: '.',
                                        keepalive: true
                                }
                        }
                }
 
  1. 修改默認連接地址

 [fan@master _site]$ cd /opt/modules/elasticsearch-head/_site
 [fan@master _site]$ vim app.js
 
 # 將其中的localhost修改為自己的ip地址
 this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200";
 
 this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://master:9200";
 
  1. 配置elasticsearch允許跨域訪問

 [fan@master config]$ cd /opt/modules/elasticsearch-6.5.0/config
 [fan@master config]$ sudo vim elasticsearch.yml
 
 # 在文件末尾追加,配置elasticsearch允許跨域訪問
 http.cors.enabled:true
 http.cors.allow-origin:"*"
 
  1. 打開9100端口

 # 如果使用的是centos7,則執行
 [fan@master elasticsearch-head]$ firewall-cmd --zone=public --add-port=9100/tcp --parmanent
  1. 啟動elasticsearch

  2. 啟動 elasticsearch-head

 [fan@master elasticsearch-head]$ node_modules/grunt/bin/grunt server

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM