es通过JDBC导数测试

来源:互联网 发布:北京阿里云公司在哪 编辑:程序博客网 时间:2024/05/22 00:22

硬件环境:
1、mac 10.12
2、8G内存、256G SSD
3、2.4GHz I5

测试数据
50G CSV格式
每行6个字段

测试一:使用es默认配置
es版本2.3.4
es-jdbc版本2.3.4.0
通过es-jdbc方式耗时40小时+
索引建立完成12亿+
索引所占空间为52G左右

测试二:使用es默认配置
es版本5.3.0
logstash版本5.3.1
通过logstash-input-jdbc方式,导入失败,数据太大

测试三:使用优化后配置
es版本2.3.4
es-jdbc版本2.3.4.0
修改配置文件
indices.store.throttle.max_bytes_per_sec: 200mb
indices.store.throttle.type: none
index.translog.flush_threshold_size: 1GB
index.refresh_interval: -1
index.number_of_replicas: 0
index.number_of_shards: 20
索引完成一半,导数进行了10小时左右时JAVA heap溢出
索引所占磁盘空间为110G左右

使用es-jdbc方式的配置文件

!/bin/sh

bin=JDBCIMPORTERHOME/binlib=JDBC_IMPORTER_HOME/lib
echo ‘{
“type” : “jdbc”,
“jdbc”: {
“elasticsearch.autodiscover”:true,
“elasticsearch.cluster”:”my-application”,
“url”:”jdbc:mysql://127.0.0.1:3306/test”,
“user”:”root”,
“password”:”root”,
“sql”:”select * from qqinfo”,
“elasticsearch” : {
“host” : “127.0.0.1”,
“port” : 9300
},
“index” : “myindex1”,
“type” : “mytype1”
}
}’| java -cp “lib/"Dlog4j.configurationFile={bin}/log4j2.xml org.xbib.tools.Runner org.xbib.tools.JDBCImporter

使用logstash-input-jdbc方式的配置文件
input {
jdbc {
jdbc_driver_library => “/Users/luobao/study/apache-hive-0.13.1-bin/lib/mysql-connector-java-5.1.34.jar”
jdbc_driver_class => “com.mysql.jdbc.Driver”
jdbc_connection_string => “jdbc:mysql://127.0.0.1:3306/test”
jdbc_user => “root”
jdbc_password => “root”
# or jdbc_password_filepath => “/path/to/my/password_file”
statement => “SELECT * from qqinfo”
jdbc_paging_enabled => “false”
}
}
output {
stdout {
codec => rubydebug
}
elasticsearch {
hosts => “localhost:9200”
index => “contacts”
}
}

0 0
原创粉丝点击