使用Mongodb Java Driver从MongoDB准备数据并将其推送到ElasticSearch时,我遇到了以下错误 -
错误:未加载mongodb.jdbc.MongoDriver。您确定在jdbc_driver_library中包含了正确的jdbc驱动程序吗?
平台信息:
OS- RHEL 6.6
Logstash- 5.5.0
Elasticsearch- 5.5.0
Mongodb- 3.2.13
Jars-mongodb-driver-core-3.4.2.jar,mongo-java-driver-3.4.2.jar and bson-3.4.2.jar
Logstash config
input{
jdbc{
jdbc_driver_library => "/home/pdwiwe/logstash-5.5.0/bin/mongo-java-driver-3.4.2.jar"
jdbc_driver_class => "mongodb.jdbc.MongoDriver"
jdbc_connection_string => "jdbc:mongo://hostname:27017?authSource=admin"
jdbc_user => "user"
jdbc_password => "pwd"
statement => "select * from system.users"
}
}
output {
if "_grokparsefailure" not in [tags]{
elasticsearch {
hosts => [ "localhost:9200" ]
index => "mongodb-data"
}
}
}
Logstash服务开始:
/home/pdwiwe/logstash-5.5.0/bin$ sh logstash -f mongo.conf
答案 0 :(得分:0)
mongodb.jdbc.MongoDriver不是mongo-java-driver中的驱动程序类。
AFAIK-此驱动程序不支持JDBC 各种JDBC驱动程序都包装了mongo-java-driver,例如Unity,Simba,DbSchema