1

表 agent_task_base 有 12000000 行

curl -XPUT 'localhost:9200/river/myjdbc_river1/meta' -d '{
    "type" : "jdbc",
    "jdbc" : {
        "url" : "...",
        "user" : "...",
        "password" : "...",
        "sql" : "select * from agenttask_base where status=1",
        "index" : "my_jdbc_index1",
        "type" : "my_jdbc_type1"
    }
}'

curl -XPUT 'localhost:9200/river/myjdbc_river2/meta' -d '{
    "type" : "jdbc",
    "jdbc" : {
        "url" : "...",
        "user" : "...",
        "password" : "..",
        "sql" : "select * from agenttask_base where status=1",
        "index" : "my_jdbc_index2",
        "type" : "my_jdbc_type2"
    }
}'

两条河一起执行,但最终结果是

my_jdbc_index1 has 10000000+ rows

my_jdbc_index2 has 11000000+ rows

为什么????

4

2 回答 2

1

elasticsearch-jdbc-river (#143) 的 github 上有一个问题,它描述了如上所述的 sam 问题。尝试减少最大批量请求并再次让弹性搜索索引。

有关更多详细信息,请参阅:https ://github.com/jprante/elasticsearch-river-jdbc/issues/143#issuecomment-29550301

我希望这个能帮上忙

于 2014-02-26T18:44:50.507 回答
0

经过多次试验和错误后,我才发现这一点,因为我遇到了同样的问题

对我有用的是定义jdbc河参数bulk_size和max_bulk_requests

curl -XPUT 'localhost:9200/river/myjdbc_river1/meta' -d '{
    "type" : "jdbc",
    "jdbc" : {
        "url" : "...",
        "user" : "...",
        "password" : "...",
        "sql" : "select * from agenttask_base where status=1",
        "index" : "my_jdbc_index1",
        "type" : "my_jdbc_type1",
        "bulk_size" : 160,
        "max_bulk_requests" : 5  
    }
}'

160 的批量大小似乎是我的幻数,500 的批量大小对于我的本地安装来说太高了,并且会返回关闭数据库连接的 java.sql 异常,但对于我的 Web 服务器环境来说还可以

底线是您可以修改这些数字来调整性能,但是通过设置它们,您应该看到您的索引文档计数与您的 sql 结果计数匹配

于 2014-04-02T14:18:21.087 回答