简体   繁体   中英

Indexing Postgresql data into ElasticSearch — can't connect to localhost/127.0.0.1:9300

I am trying to index a PostgreSQL database into ElasticSearch using JDBC importer for Elasticsearch . I am following the instructions listed in the Readme in the section on PostgreSQL . Here is a script that I am trying to run:

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

But this script doesn't execute. The error I am getting in the log is:

...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]

Could you please advise what the cause of this problem may be and how it could be fixed?

maybe I can help you

node not available #616

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

You have to change pom.xml from source project and rebuild it. Here is the instruction:

git clone https://github.com/jprante/elasticsearch-jdbc.git cd elasticsearch-jdbc edit pom.xml => change "elasticsearch.version" to 1.7.1 make package cd lib copy file elasticsearch-jdbc-1.7.0.1-uberjar.jar to your deployment directory Hope this help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM