elk-6.1.2學習筆記 一、環境centos7, elasticsearch-6.1.2 安裝openjdk-1.8:
yum install java-1.8.0-openjdk.x86_64 java-1.8.0-openjdk-devel.x86_64
配置JAVA_HOME(~/.bash_profile):
# 添加JAVA_HOME=/usr/lib/jvm/javaPATH=$PATH:$JAVA_HOME/bin
修改檔案:/etc/sysctl.conf
# 執行sysctl -p生效vm.max_map_count = 262144
修改檔案:/etc/security/limits.conf
# 重新登入生效esearch soft nofile 65536esearch hard nofile 131072esearch soft nproc 2048esearch hard nproc 4096
修改檔案/etc/security/limits.d/90-nproc.conf
esearch soft nproc 4096
添加使用者組和使用者,es不能以root使用者運行
# 添加使用者組groupadd es# 查看使用者組cat /etc/group# 添加使用者,並指定組useradd esearch -g es# 設定使用者密碼passwd esearch
elk檔案,分別解壓出來
elasticsearch-6.1.2.zip logstash-6.1.2.tar.gz kibana-6.1.2-linux-x86_64.tar.gz 二、解壓elasticsearch,進入主目錄
1.修改檔案config/elasticsearch.yml
# 修改bootstrap.memory_lock: false# 添加bootstrap.system_call_filter: false
2.啟動
bin/elasticsearch# 以後台方式啟動bin/elasticsearch -d
3.驗證:http://localhost:9200 三、解壓kibana,進入主目錄
1.啟動kibana
bin/kibana# 以後台方式啟動nohup bin/kibana > /dev/null 2>&1 &
3.驗證:http://localhost:5601 四、解壓logstash,進入主目錄
1.建立設定檔my_date.conf,從oracle中匯入資料到elasticsearch
input { jdbc { jdbc_driver_library => "path/to/ojdbc6.jar" jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver" jdbc_connection_string => "jdbc:oracle:thin:@ip:1521:orasid" jdbc_user => "orauser" jdbc_password => "orapwd" parameters => { "max_num" => 100 } statement => "select level my_rowno, sysdate + level my_date from dual connect by level < :max_num" }}output { elasticsearch { hosts => "localhost:9200" index => "my_date" document_id => "%{my_rowno}" }}
2.啟動
/bin/logstash -f my_date.conf
tips
1.elasticsearch-6.1.2/config/elasticsearch.yml
# 配置叢集cluster.name: mst-applicationnode.name: node-2discovery.zen.ping.unicast.hosts: ["ip1", "ip2"]# 指定訪問IPnetwork.host: 0.0.0.0
2.kibana-6.1.2-linux-x86_64/config/kibana.yml
# 指定訪問IPserver.host: "0.0.0.0"
3.elasticsearch結構為: index->type->document, 版本6中一個index只允許一個type
4.index相當於database table, document相當於database row