elasticsearch-jdbc icon indicating copy to clipboard operation
elasticsearch-jdbc copied to clipboard

Installation post 1.5, more information needed

Open Jrizzi1 opened this issue 9 years ago • 5 comments

I am trying to determine the last two steps of the new installation guide

  1. modify script in the bin directory to your needs (Elasticsearch cluster address)
  2. run script with a command that starts org.xbib.tools.JDBCImporter with the lib directory on the classpath

I currently am running ES 1.3.2, and previously I put the river SQL in _meta using the sense/marvel plugin. I know the river is deprecated from 1.5 moving forward, at the same time I am at a loss as to how to execute the final two steps

Any extra information is greatly appreciated

Jrizzi1 avatar Jul 07 '15 13:07 Jrizzi1

What information is needed? I am afraid I do not understand what is missing.

jprante avatar Jul 07 '15 16:07 jprante

which script do i modify? whats my elasticsearch cluster address, is that for instance my localhost address? what do i run the script command in? what is a "lib directory on the classpath"?

understand I am coing at this as having only experience with your river plugin pre 1.5, and I am sorry I am lost but it is a little more confusing than _river setup

Jrizzi1 avatar Jul 07 '15 18:07 Jrizzi1

Did you unpack the JDBC importer? Then you see bin and lib directory. You need to modify the importer script in the bin directory to set the correct path where you unpacked the JDBC importer to. Ask your Elasticsearch administrator for the address to connect with a TransportClient, if you can not find it. You run the JDBC importer script in a shell like bash, like Elasticsearch script itself. It is very similar.

jprante avatar Jul 08 '15 10:07 jprante

I'm with you Jrizzi1 on this one! I downloaded elasticsearch-jdbc-1.7.2.1, but I still don't know what this famous "importer script is"? Is it log4j2.xml?

brownerg avatar Oct 20 '15 13:10 brownerg

@Jrizzi1 After unpacking the zip file, do the following:

  1. export JDBC_IMPORTER_HOME=path/where/you/unpacked
  2. export PATH=$PATH:/path where you have the lib folder
  3. Make sure you add the right JDBC driver jar to the lib folder. In my case, I wanted to pull data from SQL server. Hence I downloaded the tar file from https://www.microsoft.com/en-us/download/details.aspx?id=11774 and added sqljdbc4.jar to the lib folder.
  4. In the bin folder, oracle-connection-properties.sh is the script you need to modify. Modify this to suit your data source and elasticsearch config. Since my data source was SQL server, my properties files looks something like this:

"type" : "jdbc",
"jdbc" : {
"driver":"com.microsoft.sqlserver.jdbc.SQLServerDriver",
"url" : "jdbc:sqlserver://xx;databaseName=yy",
"user" : "",
"password" : "",
"sql" : "" "index":"elasticsearch index where you want to push data",
"type":"",
"elasticsearch" : {
"cluster" : "ES cluster name",
"host" : "ES host name",
"port" : 9300
},
"max_bulk_actions" : 20000,
"max_concurrent_bulk_requests" : 10,
"index_settings" : {
"index" : {
"number_of_shards" : 1,
"number_of_replica" : 0
}
}
}
}
' | java \
-cp "${lib}/*" \
-Dlog4j.configurationFile=${bin}/log4j2.xml \
org.xbib.tools.Runner \
org.xbib.tools.JDBCImporter

  1. Make sure you already have the index created in elasticsearch and have the tcp port to be 9300.
  2. Now just run this script and you will be able to see data in your elasticsearch index.

ChristinaJuliet avatar Dec 30 '16 20:12 ChristinaJuliet