Elasticsearch5.X及 head插件 安裝說明:
1、下載elasticsearch安裝文件:
a) 下載官方源碼:
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.0.0.tar.gz
b) 解壓壓縮文件
tar -zxvf elasticsearc-5.0.0.tar.gz
c) 修改es配置文件:elasticsearch.yml
cluster.name: kd-cluster //集群名稱,所有主機相同的集群名稱用於發現集群節點
node.name: node01 //節點名稱
node.master: true //該節點是否用做管理節點
node.data: true //該節點是否用做數據節點
node.attr.rack: r1
path.data: 數據存儲路徑(文件夾)
path.logs: 日志存儲路徑(文件夾)
bootstrap.memory_lock: false
network.host: 172.16.8.229 //節點ip地址
http.cors.enabled: true //head插件的配置
http.cors.allow-origin: "*" //head插件的配置
http.port: 9200 //集群訪問端口
discovery.zen.ping.unicast.hosts: ["node01"] //配置了互信的話這個位置可以使用節點名稱(一般節點名成和計算機名稱的相同的)。未配置互信的話使用主機ip,用於發現管理節點。
discovery.zen.minimum_master_nodes: 1 //集群最大管理節點數(防止腦裂的配置)
gateway.recover_after_nodes: 1
d) 修改主機配置
vi /etc/security/limits.conf :
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
vi /etc/security/limits.d/90-nproc.conf :
* soft nproc 2048
vi /etc/sysctl.conf :
vm.max_map_count=655360
並執行命令:sysctl -p
重啟計算機。
2、下載elasticseatch-head插件:
a) 下載head插件文件:
https://github.com/mobz/elasticsearch-head(下載后上傳到服務器)
git clone git://github.com/mobz/elasticsearch-head.git(git下載)
b) 下載Node.js:
wget https://nodejs.org/dist/v4.6.1/node-v4.6.1-linux-x64.tar.gz(linux命令直接下載)
https://nodejs.org/dist/(官方網站下載后上傳到服務器)
c) 配置node.js環境變量:
vim /etc/profile:
export PATH=/data/elasticsearch/node-v4.6.1-linux-x64/bin:$PATH(根據實際情況添加,路徑和格式參照本機環境)
執行source /etc/profile使環境變量生效
(修改profile文件需要root權限,使環境生效的命令在當前es集群使用用戶下執行)
d) 查看當前head插件目錄下有無node_modules/grunt目錄:
沒有:執行命令創建:npm install grunt --save
e) 安裝head插件:
npm install
或者使用重定向安裝:npm install -g cnpm --registry=https://registry.npm.taobao.org
f) 安裝grunt:
npm install -g grunt-cli
g) 編輯Gruntfile.js
文件93行添加hostname:’0.0.0.0’
h) 檢查head根目錄下是否存在base文件夾
沒有:將 _site下的base文件夾及其內容復制到head根目錄下
i) 啟動grunt server:
在head下運行grunt server -d啟動head插件
j) 訪問head插件:
http://localhost:9100(啟動后會有提示:Started connect web server on http://localhost:9100)
可以發郵件給我:1492370189@qq.com