国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

Elasticsearch開篇-環(huán)境搭建

solocoder / 2365人閱讀

摘要:說(shuō)明建議將整篇文章看完后再進(jìn)行操作,文章結(jié)尾有我遇到的坑及解決方案,可以看看務(wù)必在安裝好的環(huán)境下進(jìn)行一準(zhǔn)備工作下載地址下載地址由于下載太慢,可以到下載在權(quán)限下操作創(chuàng)建用戶創(chuàng)建組創(chuàng)建用戶創(chuàng)建家目錄改變家目錄權(quán)限二開始搭建下載解壓到指

說(shuō)明

建議將整篇文章看完后再進(jìn)行操作,文章結(jié)尾有我遇到的坑及解決方案,可以看看!

務(wù)必在java安裝好的環(huán)境下進(jìn)行

一、準(zhǔn)備工作:

Ubuntu 16.04.2 x86_64

Elasticsearch 5.1.2 下載地址:https://artifacts.elastic.co/...

Kibana 5.1.2 下載地址:https://artifacts.elastic.co/...

由于oracal下載java太慢,可以到CSDN下載 https://download.csdn.net/dow...

在root權(quán)限下操作創(chuàng)建用戶:
創(chuàng)建elasticsearch組:groupadd elasticsearch
創(chuàng)建elasticsearch用戶:useradd elasticsearch -g elasticsearch
創(chuàng)建elasticsearch家目錄:mkdir /home/elasticsearch
改變家目錄權(quán)限:chown -R mkdir elasticsearch:elasticsearch /home/elasticsearch

二、開始搭建 1. Elasticsearch 5.1.2:
-  下載Es:`wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.2.tar.gz`
- 解壓Es到指定目錄:`tar -zxf elasticsearch-5.1.2.tar.gz -C /usr/local/`
- 改變目錄權(quán)限:`chown -R elasticsearch:elasticsearch  elasticsearch-5.1.2/`
- 在Java環(huán)境變量配置好的情況下執(zhí)行后臺(tái)啟動(dòng)es:`sudo ./bin/elasticsearch -d -p pid`
- 關(guān)閉es:``kill `cat pid```   #pid是后臺(tái)啟動(dòng)es時(shí)的進(jìn)程號(hào),文件是在/usr/local/elasticsearch-5.1.2/pid
- 在服務(wù)器執(zhí)行:`curl localhost:9200`
- 如果有如下json返回表示安裝成功:
```json
{
  "name" : "9bUWQKn",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "2J3aD8mISy2A6l7JP6T4cA",
  "version" : {
    "number" : "5.1.2",
    "build_hash" : "c8c4c16",
    "build_date" : "2017-01-11T20:18:39.146Z",
    "build_snapshot" : false,
    "lucene_version" : "6.3.0"
  },
  "tagline" : "You Know, for Search"
}
```
2、Kibana 5.1.2
- 下載Kibana:`wget https://artifacts.elastic.co/downloads/kibana/kibana-5.1.2-linux-x86_64.tar.gz`
- 解壓:`tar -zxf kibana-5.1.2-linux-x86_64.tar.gz -C /usr/local/`
- `cd /usr/local/kibana-5.1.2-linux-x86_64`
- 改變kibana的擁有者為elasticsearch:`sudo chown elasticsearch:elasticsearch -R kibana-5.1.2-linux-x86_64/`
- 啟動(dòng)kibana:`./bin/kibana`
- 訪問(wèn):用瀏覽器http://192.168.10.10:5601/ 此時(shí)會(huì)進(jìn)不去頁(yè)面
    - 原因:kibana的默認(rèn)限制了訪問(wèn)ip
    - 解決:`vim /usr/local/kibana-5.1.2-linux-x86_64/config`
      將:server.host前的注釋打開,最終是:server.host: "0.0.0.0"要重啟kibana:`./bin/kibana`
    - 再次訪問(wèn):http://192.168.10.10:5601/   就ok了額外說(shuō)下:有了kibana了就不用安裝sense這個(gè)插件了,因?yàn)閗ibana 5.1.2默認(rèn)集成了sense

三、用chrome裝es的head擴(kuò)展

不用elasticsearch-plugin安裝head了,直接Chrome擴(kuò)展:https://chrome.google.com/web...

四、坑 1、用root用戶權(quán)限運(yùn)行es會(huì)報(bào):

在安裝es的目錄/usr/local/elasticsearch-5.1.2運(yùn)行es:./bin/elasticsearch

會(huì)報(bào)如下錯(cuò)誤:
root@homestead:/usr/local/elasticsearch-5.1.2# ./bin/elasticsearch
2018-03-26T15:17:52,954[o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
原因:es不能以root用戶啟動(dòng)
解決:切換成elasticsearch用戶 su elasticsearch

2、運(yùn)行./bin/elasticsearch -d -p pid會(huì)報(bào)
elasticsearch@homestead:/usr/local/elasticsearch-5.1.2$ Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error="Cannot allocate memory" (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 2060255232 bytes for committing reserved memory.

原因:我是在Mac下安裝了Virtual Box,只分配了2g的內(nèi)存,這是由于內(nèi)存不足引起的
解決:
修改es的配置文件:vim /usr/local/elasticsearch-5.1.2/config/jvm.options
將:-Xms2g 改為 -Xms1g,如果1g還不夠的話,可以改為-Xms512m
將:-Xmx2g 改為 -Xmx1g,如果1g還不夠的話,可以改為-Xmx512m
修改完jvm.options后,再執(zhí)行./bin/elasticsearch -d -p pid

3、./bin/elasticsearch -d -p pid會(huì)報(bào)
elasticsearch@homestead:/usr/local/elasticsearch-5.1.2$ 2018-03-26 15:44:22,462 main ERROR RollingFileManager (/usr/local/elasticsearch-5.1.2/logs/elasticsearch.log) java.io.FileNotFoundException: /usr/local/elasticsearch-5.1.2/logs/elasticsearch.log (Permission denied) java.io.FileNotFoundException: /usr/local/elasticsearch-5.1.2/logs/elasticsearch.log (Permission denied)

原因:權(quán)限不夠,導(dǎo)致/usr/local/elasticsearch-5.1.2/logs/elasticsearch.log日志文件以elasticsearch的文件沒(méi)權(quán)限寫入
解決:sudo chown -R elasticsearch:elasticsearch elasticsearch-5.1.2
再次執(zhí)行:./bin/elasticsearch -d -p pid

4、在啟動(dòng)es時(shí)報(bào):
main ERROR Unable to inject fields into builder class for plugin type class org.apache.logging.log4j.core.appender.RollingFileAppender

原因:es是在java環(huán)境下運(yùn)行的,所以要先安裝java,并配置好相應(yīng)的環(huán)境變量
解決:以下操作在root用戶下操作將java解壓到要安裝的目錄:/usr/local/jdk1.8.0_161
配置java環(huán)境變量
vim /etc/profile
在/etc/profile文件末尾添加如下幾行,根據(jù)你所安裝的目錄修改
JAVA_HOME=/usr/local/jdk1.8.0_161
CLASSPATH=.:$JAVA_HOME//usr/local/jdk1.8.0_161/lib/tools.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH
再執(zhí)行source /etc/profile生效

5、kibana的版本和es的版本務(wù)必一致

如:Elasticsearch 5.1.2與Kibana 5.1.2,版本都5.1.2,不同版本的話,在啟動(dòng)kibana時(shí)會(huì)報(bào)錯(cuò)

6、啟動(dòng)es時(shí)報(bào)
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

臨時(shí)解決:sudo sysctl -w vm.max_map_count=262144 #重啟linux會(huì)失效
永久解決:sudo vim /etc/sysctl.conf
加入:vm.max_map_count=262144
再重啟linux生效

7、用chrome訪問(wèn)192.168.10.10:9200時(shí)出進(jìn)入不了頁(yè)面

原因:es的配置文件限制了指定的ip訪問(wèn),默認(rèn)是服務(wù)器的locallhost:9200
解決:
sudo vim /usr/local/elasticsearch-5.1.2/config/elasticsearch.yml
將:network.host的注釋打開,最終是network.host: 0.0.0.0,表示不限制訪問(wèn)ip
kill `cat pid` #殺掉es進(jìn)程
./bin/elasticsearch -d -p pid #啟動(dòng)es
再用瀏覽器訪問(wèn):192.168.10.10:9200

文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請(qǐng)注明本文地址:http://specialneedsforspecialkids.com/yun/28488.html

相關(guān)文章

0條評(píng)論

最新活動(dòng)
閱讀需要支付1元查看
<