centos系統(tǒng)環(huán)境搭建專欄??點(diǎn)擊跳轉(zhuǎn)
關(guān)于node的安裝請看上一篇CentOS系統(tǒng)環(huán)境搭建(十三)——CentOS7安裝nvm,??點(diǎn)擊跳轉(zhuǎn)。
CentOS7.9安裝elasticsearch-head
這個(gè)的安裝非常簡單,既然我們的node環(huán)境已經(jīng)安裝完畢,就讓我們快速完成。
1.下載
wget -O /usr/local/elasticsearch-head-5.0.0.zip https://github.com/mobz/elasticsearch-head/archive/refs/tags/v5.0.0.zip
2.解壓
cd /usr/local
unzip elasticsearch-head-5.0.0.zip
3.修改Gruntfile.js
vim Gruntfile.js
添加hostname: '*'
3.安裝
cd /usr/local/elasticsearch-head-5.0.0
npm update
npm install
如果報(bào)錯(cuò),使用淘寶鏡像再嘗試一下。
npm install -g cnpm --registry=https://registry.npm.taobao.org
4.啟動(dòng)elasticsearch-head服務(wù)
npm run start
5.解決跨域
訪問http://ip:9200/
后你發(fā)現(xiàn)明明elasticsearch已經(jīng)啟動(dòng),為什么head沒有監(jiān)控到?那僅僅是因?yàn)槌霈F(xiàn)了跨域問題而已,這時(shí)候需要你修改配置了。
修改elasticsearch.yml
文件
vim /usr/local/elasticsearch-7.17.6/config/elasticsearch.yml
在末尾添加如下內(nèi)容
http.cors.enabled: true
http.cors.allow-origin: "*"
重啟你的elasticsearch,然后再次訪問http://ip:9100/
。
6.效果如下
我的ip要寫成云服務(wù)器ip,各位本地啟動(dòng),想必直接可以了。
7.后臺啟動(dòng)
nohup npm run-script start &
若是出現(xiàn)關(guān)閉命令面板就停止的狀況,使用
disown
命令將當(dāng)前終端會(huì)話與腳本進(jìn)程分離文章來源:http://www.zghlxwxcb.cn/news/detail-656270.html
disown -a
這將分離當(dāng)前終端會(huì)話中的所有作業(yè),包括腳本進(jìn)程。這樣,即使您關(guān)閉終端,腳本也會(huì)繼續(xù)運(yùn)行。文章來源地址http://www.zghlxwxcb.cn/news/detail-656270.html
到了這里,關(guān)于CentOS系統(tǒng)環(huán)境搭建(十四)——CentOS7.9安裝elasticsearch-head的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!