LIUNX下載安裝ES-head

安裝運行

1、前置安裝java8

jdk-8u112-linux-x64.rpm

下載地址:http://www.oracle.com/technetwork/java/javase/downloads/index.html

2、下載

wgethttps://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.zip

3、解壓

unzipelasticsearch-5.1.1.zip

4、運行

./bin/elasticsearch

./bin/elasticsearch-d          #後臺運行

tail -flogs/elasticsearch.log          #查看日誌

 

注:ES有執行腳本的能力,因安全因素,不能在root用戶下運行,強行運行會報如下錯誤:

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

解決方案:

groupaddes          #增加es組

useraddes -g es -p pwd          #增加es用戶並附加到es組

chown -Res:es elasticsearch-5.1.1         #給目錄權限

sues          #使用es用戶

./bin/elasticsearch-d          #後臺運行es

 

外網訪問

viconf/elasticsearch.yml

修改network.host: 0.0.0.0

再次啓動linux可能出現如下類似錯誤 

bootstrapchecks failed

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

解決方案

1、vi /etc/sysctl.conf

設置fs.file-max=655350

保存之後sysctl -p使設置生效

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

* softnofile 655350

* hardnofile 655350

3、重新使用SSH登錄,再次啓動elasticsearch即可。

外網訪問:serverip:9200/

 

安裝elasticsearch-head插件

elasticsearch5以後的版本比較新,不支持直接安裝head插件,以下是github上提供的安裝方法,如下圖示

以下爲我自己整理的方法,參考來源:http://blog.csdn.net/qq942477618/article/details/53637817

1、下載head插件

wgethttps://codeload.github.com/mobz/elasticsearch-head/zip/master

2
、下載nodejs

nodejs
官網下載地址https://nodejs.org/dist/

wgethttps://nodejs.org/dist/v6.9.2/node-v6.9.2-linux-x64.tar.xz

3
、配置node環境變量

xz 
–d node-v6.9.2-linux-x64.tar.xz
tar 
–xvf node-v6.9.2-linux-x64.tar
mv node-v6.9.2-linux-x64 /alidata/app/node

vim /etc/profile
export NODE_HOME=/alidata/app/node
export PATH=$PATH:$NODE_HOME/bin
source /etc/profile

# node 
–v
v6.9.2
# npm 
–v
3.10.9

4
、安裝grunt

cd elasticsearch-head-master
npm install -g grunt--registry=https://registry.npm.taobao.org

5
、測試一下

cd elasticsearch-head-master
grunt

出現以下提示,爲Gruntfile.js引用的,缺少以下包

>> Local Npm module"grunt-contrib-clean" not found. Is it installed?
>> Local Npm module"grunt-contrib-concat" not found. Is it installed?
>> Local Npm module"grunt-contrib-watch" not found. Is it installed?
>> Local Npm module"grunt-contrib-connect" not found. Is it installed?
>> Local Npm module"grunt-contrib-copy" not found. Is it installed?
>> Local Npm module "grunt-contrib-jasmine"not found. Is it installed?
Warning: Task "connect:server" notfound. Use --force to continue.

Aborted due to warnings.

安裝

npm install grunt-contrib-clean--registry=https://registry.npm.taobao.org

npm install grunt-contrib-concat --registry=https://registry.npm.taobao.org

npm install grunt-contrib-watch--registry=https://registry.npm.taobao.org
npm install grunt-contrib-connect--registry=https://registry.npm.taobao.org
npm install grunt-contrib-copy--registry=https://registry.npm.taobao.org
npm install grunt-contrib-jasmine--registry=https://registry.npm.taobao.org

6
、運行

grunt server


7
、測試

http://serverip:9100/

修改head目錄下的Gruntfile.js配置,head默認監聽127.0.0.1

vm Gruntfile.js

hostname: '0.0.0.0',

8
、爲es設置跨域訪問

vi config/elasticsearch.yml        #
新增兩行

http.cors.enabled: true

http.cors.allow-origin: "*"

9、啓動es,啓動head插件


(需注意:ES在阿里雲服務器配置外網訪問需配置跨域)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章