将Postgresql数据索引到ElasticSearch中 - 无法连接到localhost / 127.0.0.1:9300

时间:2015-08-03 23:37:16

标签: indexing elasticsearch

我正在尝试使用JDBC importer for Elasticsearch将PostgreSQL数据库索引到ElasticSearch中。我按照section on PostgreSQL中自述文件中列出的说明进行操作。这是我试图运行的脚本:

bin=<path to elasticsearch-jdbc-1.7.0.1 /bin folder> 
lib= <path to elasticsearch-jdbc-1.7.0.1 /lib folder>
    echo '{
        "type" : "jdbc",
        "jdbc" : {
            "url" : "jdbc:postgresql://localhost:5432/<name of db>",
            "user" : "<username>",
            "password" : "<password>",
            "sql" : "select *, id as _id from paragraphs",
            "index" : "<name of index>"
        }
    }' | java \
           -cp "${lib}/*" \
           -Dlog4j.configurationFile=${bin}/log4j2.xml \
           org.xbib.tools.Runner \
           org.xbib.tools.JDBCImporter

但是这个脚本没有执行。我在日志中得到的错误是:

...some stuff...
[01:01:03,976][INFO ][BaseTransportClient      ][pool-2-thread-1] trying to connect to [inet[localhost/127.0.0.1:9300]]
[01:01:04,257][WARN ][org.elasticsearch.transport.netty][elasticsearch[importer][transport_client_worker][T#1]{New I/O worker #1}] [importer] Message not fully read (response) for [0] handler future(org.elasticsearch.client.transport.TransportClientNodesService$SimpleNodeSampler$1@4748ede7), error [false], resetting
[01:01:04,256][INFO ][org.elasticsearch.client.transport][pool-2-thread-1] [importer] failed to get node info for [#transport#-1][andrey-ThinkPad-T430][inet[localhost/127.0.0.1:9300]], disconnecting...
org.elasticsearch.transport.RemoteTransportException: Failed to deserialize response of type [org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse]
Caused by: org.elasticsearch.transport.TransportSerializationException: Failed to deserialize response of type [org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse]

您能告诉我这个问题的原因是什么以及如何解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

也许我可以帮助你

节点不可用#616

https://github.com/jprante/elasticsearch-jdbc/issues/616

您必须从源项目更改pom.xml并重建它。这是指令:

git clone https://github.com/jprante/elasticsearch-jdbc.git cd elasticsearch-jdbc 编辑pom.xml =&gt;改变&#34; elasticsearch.version&#34;到1.7.1 制作包裹 cd lib 将文件elasticsearch-jdbc-1.7.0.1-uberjar.jar复制到您的部署目录希望此帮助。