1.首先下载 (这里到华为云下载6.6.0版本)
ElasticSearch:https://mirrors.huaweicloud.com/elasticsearch/
Logstash:https://mirrors.huaweicloud.com/logstash/
Kibana:https://mirrors.huaweicloud.com/kibana/
2.解压安装
Kibana 依赖 Elasticsearch
Logstash 数据 输出到 Elasticsearch
Elasticsearch 数据来源 依赖 Logstash
按照依赖顺序安装相应的服务: ElasticSearch -> Logstash -> Kibana
2.1解压 image.png
2.2安装ElasticSearch
打开cmd切换到 elasticsearch-6.6.0\bin 目录
elasticsearch-service.bat install
elasticsearch-service.bat manager
image.png
image.png
输入网址 http://localhost:9200/,可以看到如下图 image.png
2.3安装 Logstash
打开 \logstash-6.6.0\config
image.png
\logstash-6.6.0\bin 目录下 运行 cmd :
logstash -f ..\config\logstash.conf
image.png
2.4安装 Kibana
进入 \kibana-6.6.0-windows-x86_64\bin 目录 cmd :
kibana.bat
image.png
Kibana 窗口地址 http://localhost:5601
image.png
2.同步oracle数据到es
修改logstash-6.6.0\config\logstash.conf文件
# Sample Logstash configuration for creating a simple
# Beats -> Logstash -> Elasticsearch pipeline.
input {
beats {
port => 5044
codec => plain {
charset => "UTF-8"
}
}
file {
path => "D:/job/elk/elasticsearch-6.6.0/logs/*.*"
start_position => "beginning"
codec => plain{
charset=>"UTF-8"
}
}
jdbc{
jdbc_connection_string => "jdbc:oracle:thin:scott/tiger@//192.168.0.142:1521/hnkcdb" #jdbc数据库连接
jdbc_user => "yjga110" #用户名
jdbc_password => "110110"#密码
jdbc_driver_library => "G:\repository\ojdbc\ojdbc\14\ojdbc-14.jar" #数据库jar包路径
jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver" #数据库驱动
jdbc_paging_enabled => "true"
jdbc_page_size => "5000000" # 同步数据分页设置
statement => "select * from t_jcj_jjd where gxsj > :sql_last_value"#同步SQL语句
#statement_filepath => "D:\logstash-5.6.10\bin\logstash_jdbc_test\jdbc.sql" # 需同步的数据执行的SQL文件路径
schedule => "* * * * *" # 各字段含义(由左至右)分、时、天、月、年,全部为*默认含义为每分钟都更新
type => "t_jcj_jjd" # ES的type类型,相当于数据库中的table,需要配置多个表时,将jdbc整体复制一份,修改对应type
last_run_metadata_path => "logstash-oradb.lastrun"
}
}
output {
elasticsearch {
hosts => ["http://localhost:9200"]
index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
#user => "elastic"
#password => "changeme"
}
}
网友评论