Skip to content

Instantly share code, notes, and snippets.

@hariharan-uno
Created November 10, 2013 16:13
Show Gist options
  • Save hariharan-uno/7400113 to your computer and use it in GitHub Desktop.
Save hariharan-uno/7400113 to your computer and use it in GitHub Desktop.
Elastic Search with MySQL
First extract Elastic Search from tarball. (Make sure you are running the latest java version)
Then cd into the folder and type:
bin/plugin -install river-jdbc -url http://bit.ly/1iovWV9
Get the latest version of the JDBC river for elastic search from https://github.com/jprante/elasticsearch-river-jdbc ( or from the url above)
Download a JDBC driver jar from your vendor's site (here MySQL) and put the jar into the folder of the plugin $ES_HOME/plugins/river-jdbc.
For MySQL, the JDBC driver can be obtained from http://dev.mysql.com/downloads/connector/j/
Then fire up a node or two to form a elastic search cluster by the following command:
bin/elasticsearch -f
and then issue the following command:
curl -XPUT 'localhost:9200/_river/my_jdbc_river/_meta' -d '{
"type" : "jdbc",
"jdbc" : {
"driver" : "com.mysql.jdbc.Driver",
"url" : "jdbc:mysql://localhost:3306/test",
"user" : "",
"password" : "",
"sql" : "select * from orders;"
},
"index" : {
"index" : "jdbc",
"type" : "jdbc"
}
}'
The statement inside the sql may vary, To know more about it, visit : https://github.com/jprante/elasticsearch-river-jdbc/wiki/_pages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment