ES 7.4.1 和logstash7.4.1 组合搭建mysql数据同步

1.服务器环境介质

服务器java系统
Linuxjava 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/ 目录下

 

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值