1.下載軟件elasticsearch-5.6.12.tar.gz到/home/resources目錄下
- 鏈接: https://pan.baidu.com/s/19zIrYrrwHAmEjljxPYj6nQ 提取碼: 2e3z
- 官網(wǎng):https://www.elastic.co/products/elasticsearch
2.解壓文件到/home/software目錄下
tar -xf elasticsearch-5.6.12.tar.gz -C /home/software
3.啟動(dòng)Elasticsearch
1.注意不能使用root用戶(hù)啟動(dòng)
image.png- 2.創(chuàng)建用戶(hù)組和用戶(hù)
groupadd es
useradd es -g es(用戶(hù)組) -p es()密碼- 3.修改新用戶(hù)權(quán)限
chown -R es:es /home/software/elasticsearch-5.6.12- 4 啟動(dòng)
su es : 切換用戶(hù)
cd /home/software/elasticsearch-5.6.12/bin : 進(jìn)去啟動(dòng)文件所在文件夾
./elasticsearch 啟動(dòng)- 5.問(wèn)題解決
5.1:內(nèi)存不足問(wèn)題
image.png解決方案:修改配置文件/home/software/elasticsearch-5.6.12/config/jvm.options
vim /home/software/elasticsearch-5.6.12/config/jvm.options
image.png5.2.bootstrap加載失敗
image.png解決方案:修改配置文件/home/software/elasticsearch-5.6.12/config/elasticsearch.yml
vim /home/software/elasticsearch-5.6.12/config/elasticsearch.yml
修改完成之后整吆,需要重啟服務(wù)器
image.png
6.測(cè)試啟動(dòng)成功與否
curl localhost:9200
image.png
7.后臺(tái)啟動(dòng)(如有需要)
./elasticsearch -d 后臺(tái)啟動(dòng)
tail -f xxxx.log 動(dòng)態(tài)觀察日志
4.對(duì)外提供訪(fǎng)問(wèn)
- 1 修改配置文件vim /home/software/elasticsearch-5.6.12/config/elasticsearch.yml
image.png
image.png
image.png
image.png
- 2 此時(shí)啟動(dòng)會(huì)報(bào)錯(cuò)溯香,
image.png
- 原因1:默認(rèn)的最大可創(chuàng)建線(xiàn)程數(shù)是1024,不滿(mǎn)足es程序的要求颠蕴,設(shè)置為2048即可
- 解決方案:vim /etc/security/limits.d/90-nproc.conf
image.png
- 原因二:虛擬內(nèi)存太小
- 解決方案:修改配置文件vim /etc/sysctl.conf,末尾添加一行,改完后重啟系統(tǒng)
image.png
- 3 啟動(dòng)依舊有問(wèn)題:
image.png
解決方案:修改配置文件vim /etc/security/limits.conf 末尾添加兩行
* hard nofile 65536
* soft nofile 65536
- 4 瀏覽器訪(fǎng)問(wèn)
對(duì)外訪(fǎng)問(wèn)ip:9200
image.png
5.安裝HEAD插件,方便查看Elasticsearch中保存的數(shù)據(jù)
1.安裝node.js環(huán)境
鏈接: https://pan.baidu.com/s/1InI9Cf9SqV2a2pgFryL_VA 提取碼: 5y1v
- 1.1 解壓
tar -xf ../resources/node-v8.12.0-linux-x64.tar.xz -C /home/software
- 1.2 安裝npm
yum install npm
- 1.3 進(jìn)入到node.js根目錄下的bin目錄艾蓝,執(zhí)行npm命令
npm install -g grunt-cli
1.4 驗(yàn)證安裝是否成功
image.png
2.安裝HEAD插件
- 鏈接: https://pan.baidu.com/s/1-dGkWhHFhAVs6NyLcqLxhg 提取碼: kv66
- 2.1 解壓到/home/software(如果沒(méi)有unzip丽蝎,使用yum install unzip)
unzip elasticsearch-head-master.zip -d ../software/
- 2.2 允許外部插件訪(fǎng)問(wèn)Elasticsearch飒房,修改配置文件
vim /home/software/elasticsearch-5.6.12/config/elasticsearch.yml
末尾添加
http.cors.enabled: true
http.cors.allow-origin: "*"
image.png
- 2.3 允許外部訪(fǎng)問(wèn)HEAD插件
vim /home/software/elasticsearch-head-master/Gruntfile.js
image.png
- 2.4 啟動(dòng)插件(在插件根目錄執(zhí)行命令)
grunt server
- 2.5 如果啟動(dòng)如下錯(cuò)誤
image.png
- 2.6 執(zhí)行以下兩條命令(在插件根目錄執(zhí)行命令)
npm install -g grunt :全局安裝grunt
npm install grunt :將grunt安裝到當(dāng)前目錄
- 2.7 繼續(xù)啟動(dòng)報(bào)錯(cuò),缺少grunt支持部件
image.png
- 2.8 挨個(gè)安裝缺少的部件
npm install grunt-contrib-clean
npm install grunt-contrib-concat
npm install grunt-contrib-watch
npm install grunt-contrib-connect
npm install grunt-contrib-copy
npm install grunt-jasmine
- 2.9 啟動(dòng)成功
image.png
- 2.10 瀏覽器訪(fǎng)問(wèn),并且連接剛搭建的Elasticsearch節(jié)點(diǎn)
外網(wǎng)訪(fǎng)問(wèn)ip:9100
image.png