1.服務器環境介質
服務器 | java | 系統 |
Linux | java version "1.8.0_201" |
Centos 6.5 |
2.下載 ES 7.4.1 logstash 7.4.1
//通過tar 或者 unzip 解壓安裝
tar -axvf
unzip
3.啓動報錯解決記錄
ES啓動報錯
1.用root 用戶啓動會報錯
創建非root用戶用於啓動ES
//創建用戶
adduse esStart
//設置密碼
passwd esStart
2.用esStart用戶啓動仍然會報錯
2.3配置其運行環境
1、切換到root用戶,編輯limits.conf 添加類似如下內容 vi /etc/security/limits.conf 添加如下內容: * soft nofile 65536 * hard nofile 131072 * soft nproc 2048 * hard nproc 4096 |
---|
2、切換到root用戶,進入limits.d目錄下修改配置文件。 vi /etc/security/limits.d/90-nproc.conf 修改如下內容: * soft nproc 1024 #修改爲 * soft nproc 2048 |
---|
3、切換到root用戶修改配置sysctl.conf vi /etc/sysctl.conf 添加下面配置: vm.max_map_count=655360 並執行命令: sysctl -p |
---|
3.啓動異常:
ERROR: bootstrap checks failed
system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
問題原因:因爲Centos6不支持SecComp,而ES5.2.1默認bootstrap.system_call_filter爲true進行檢測,所以導致檢測失敗,失敗後直接導致ES不能啓動。詳見 :https://github.com/elastic/elasticsearch/issues/22899
解決方法:在elasticsearch.yml中配置bootstrap.system_call_filter爲false,注意要在Memory下面:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
3.ES中的請自行創建和數據庫對應的index和type
4.將mysql中的數據同步到ES中
logstash 同步數據命令
cd /home/logstash/logstash-7.4.1/bin
./logstash -f logstash-mysql.conf
配置文件logstash-mysql.conf
input {
jdbc {
jdbc_driver_library => "/home/logstash/logstash-7.4.1/logstash-core/lib/jars/mysql-connector-java-5.1.44-bin.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql://127.0.0.1:3306/trsgank?characterEncoding=UTF-8&useSSL=false&autoReconnect=true"
jdbc_user => "nihao"
jdbc_password => "nihao123"
statement => "SELECT * FROM TRSGANK_BOOKMARK"
jdbc_paging_enabled => "true"
jdbc_page_size => "1000"
schedule => "* * * * *"
}
}
output {
elasticsearch {
hosts => ["127.0.0.1"]
index => "gank"
document_type => "bookmark"
document_id => "%{id}"
user => "gank"
password => "gank2018"
}
stdout {
codec => rubydebug
}
}
Logstash 利用mysql同步數據是會報錯
錯誤信息:jdbc_driver_library 不存在
解決辦法
需要將驅動移動到/logstash-7.4.1/logstash-core/lib/jars/ 目錄下