elk安裝筆記

安裝jdk

  1. 下載jdk8
  2. 設(shè)置環(huán)境變量
 vim /etc/profile

export JAVA_HOME=/usr/local/jdk1.8.0_181
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib/dt.JAVA_HOME/lib/tools.jar:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:${PATH}

 source /etc/profile

系統(tǒng)設(shè)置

#設(shè)置hostname,打開文件筋蓖,將內(nèi)容改為  (不是必須的马僻,可跳過)
vi /etc/hostname
* elk-server

[http://www.reibang.com/p/8fd07c60f23f](http://www.reibang.com/p/8fd07c60f23f)
[https://www.cnblogs.com/silent2012/p/4682770.html](https://www.cnblogs.com/silent2012/p/4682770.html)

#關(guān)閉防火墻(如果因為其他原因不能關(guān)閉防火墻拂檩,也請不要禁止80端口)
systemctl stop firewalld.service
systemctl stop iptables.service

#禁止防火墻自動啟動:
systemctl disable firewalld.service
systemctl disable iptables.service

#打開添加下面四行內(nèi)容:
vi /etc/security/limits.conf
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096

#soft nproc: 可打開的文件描述符的最大數(shù)(軟限制)
#hard nproc: 可打開的文件描述符的最大數(shù)(硬限制)
#soft nofile:單個用戶可用的最大進程數(shù)量(軟限制)
#hard nofile:單個用戶可用的最大進程數(shù)量(硬限制)

#打開文件/etc/sysctl.conf睹逃,添加下面一行內(nèi)容
vi /etc/sysctl.conf
vm.max_map_count=655360
vm.overcommit_memory = 1


#max_map_count定義了一個進程擁有的最多內(nèi)存區(qū)域屡律,默認(rèn)為65536

# 加載sysctl配置肥缔,執(zhí)行命令
sysctl -p 

# 重啟電腦撒轮;

安裝elasticsearch

#創(chuàng)建elasticsearch用戶,注意elasticsearch不能在root中啟動
groupadd elasticsearch
useradd elasticsearch -g elasticsearch

tar zxvf elasticsearch-6.5.3.tar.gz -C /usr/local/elk/
cd /usr/local/elk
chown -R elasticsearch:elasticsearch elasticsearch-6.5.3/

cd elasticsearch-6.5.3/

# nohup bin/elasticsearch -d  >elkrunlog/elasticsearch.log 2>&1 &

#修改配置文件
vi config/elasticsearch.yml
cluster.name=es_cluster
node.name=node0
path.data=/tmp/elasticsearch/data
path.logs=/tmp/elasticsearch/logs
#當(dāng)前hostname或IP醇锚,我這里是centos2
network.host=centos2
network.port=9200


#切換用戶
su elasticsearch

#使用后臺進程的方式啟動
./bin/elasticsearch &

#有響應(yīng)內(nèi)容則啟動成功
curl 127.0.0.1:9200

#退出elasticsearch用戶
exit

安裝Logstash

tar zxvf logstash-6.5.3.tar.gz -C /usr/local/elk/
cd /usr/local/elk/logstash-6.5.3

#添加配置文件
vi config/log4j_to_es.conf
# For detail structure of this file
# Set: https://www.elastic.co/guide/en/logstash/current/configuration-file-structure.html
input {
  # For detail config for log4j as input, 
  # See: https://www.elastic.co/guide/en/logstash/current/plugins-inputs-log4j.html
  log4j {
    mode => "server"
    host => "centos2"
    port => 4567
  }
}
filter {
  #Only matched data are send to output.
}
output {
  # For detail config for elasticsearch as output, 
  # See: https://www.elastic.co/guide/en/logstash/current/plugins-outputs-elasticsearch.html
  elasticsearch {
    action => "index"          #The operation on ES
    hosts  => "centos2:9200"   #ElasticSearch host, can be array.
    index  => "applog"         #The index to write data to.
  }
}


--------------------default.conf
# Sample Logstash configuration for creating a simple
# Beats -> Logstash -> Elasticsearch pipeline.

input {
  beats {
    port => 8021
  }
}

output {
  elasticsearch {
    hosts => ["http://localhost:9200"]
    #index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
    index => "testlog"
    #user => "elastic"
    #password => "changeme"
  }
}


#啟動
bin/logstash -f config/log4j_to_es.conf &


netstat -tunlp
netstat -tunlp|grep 9600

安裝kibana

tar zxvf kibana-6.5.3-linux-x86_64.tar.gz -C /usr/local/elk/
cd /usr/local/elk/kibana-6.5.3-linux-x86_64/

#修改以下幾項
vi config/kibana.yml
server.port: 5601
server.host: “centos2”
elasticsearch.url: http://localhost:9200
kibana.index: “.kibana”


# 啟動kibana
./bin/kibana &

#用瀏覽器打開該地址:
localhost:5601


https://blog.csdn.net/wu2700222/article/details/85044117
https://blog.csdn.net/wu2700222/article/details/82792708
https://my.oschina.net/itblog/blog/547250

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末哼御,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子搂抒,更是在濱河造成了極大的恐慌艇搀,老刑警劉巖,帶你破解...
    沈念sama閱讀 219,539評論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件求晶,死亡現(xiàn)場離奇詭異焰雕,居然都是意外死亡,警方通過查閱死者的電腦和手機芳杏,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,594評論 3 396
  • 文/潘曉璐 我一進店門矩屁,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人爵赵,你說我怎么就攤上這事吝秕。” “怎么了空幻?”我有些...
    開封第一講書人閱讀 165,871評論 0 356
  • 文/不壞的土叔 我叫張陵烁峭,是天一觀的道長。 經(jīng)常有香客問我,道長约郁,這世上最難降的妖魔是什么缩挑? 我笑而不...
    開封第一講書人閱讀 58,963評論 1 295
  • 正文 為了忘掉前任,我火速辦了婚禮鬓梅,結(jié)果婚禮上供置,老公的妹妹穿的比我還像新娘。我一直安慰自己绽快,他們只是感情好芥丧,可當(dāng)我...
    茶點故事閱讀 67,984評論 6 393
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著坊罢,像睡著了一般续担。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上艘绍,一...
    開封第一講書人閱讀 51,763評論 1 307
  • 那天赤拒,我揣著相機與錄音秫筏,去河邊找鬼诱鞠。 笑死,一個胖子當(dāng)著我的面吹牛这敬,可吹牛的內(nèi)容都是我干的航夺。 我是一名探鬼主播,決...
    沈念sama閱讀 40,468評論 3 420
  • 文/蒼蘭香墨 我猛地睜開眼崔涂,長吁一口氣:“原來是場噩夢啊……” “哼阳掐!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起冷蚂,我...
    開封第一講書人閱讀 39,357評論 0 276
  • 序言:老撾萬榮一對情侶失蹤缭保,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后蝙茶,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體艺骂,經(jīng)...
    沈念sama閱讀 45,850評論 1 317
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 38,002評論 3 338
  • 正文 我和宋清朗相戀三年隆夯,在試婚紗的時候發(fā)現(xiàn)自己被綠了钳恕。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 40,144評論 1 351
  • 序言:一個原本活蹦亂跳的男人離奇死亡蹄衷,死狀恐怖忧额,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情愧口,我是刑警寧澤睦番,帶...
    沈念sama閱讀 35,823評論 5 346
  • 正文 年R本政府宣布,位于F島的核電站耍属,受9級特大地震影響托嚣,放射性物質(zhì)發(fā)生泄漏大咱。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 41,483評論 3 331
  • 文/蒙蒙 一注益、第九天 我趴在偏房一處隱蔽的房頂上張望碴巾。 院中可真熱鬧,春花似錦丑搔、人聲如沸厦瓢。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,026評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽煮仇。三九已至,卻和暖如春谎仲,著一層夾襖步出監(jiān)牢的瞬間浙垫,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 33,150評論 1 272
  • 我被黑心中介騙來泰國打工郑诺, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留夹姥,地道東北人。 一個月前我還...
    沈念sama閱讀 48,415評論 3 373
  • 正文 我出身青樓辙诞,卻偏偏與公主長得像辙售,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子飞涂,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 45,092評論 2 355

推薦閱讀更多精彩內(nèi)容