You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by rachun <ra...@gmail.com> on 2014/02/03 05:44:53 UTC

Import data from mysql to sold

Dear all gurus,

I would like to import my data (mysql) about 4 Million rows  into solar 4.6.
What is the best way to do it?

Please suggest me.

Million thanks,
Chun.
 



--
View this message in context: http://lucene.472066.n3.nabble.com/Import-data-from-mysql-to-sold-tp4114982.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Import data from mysql to sold

Posted by rachun <ra...@gmail.com>.
I just would like to thank you for all guru's comments ;)
Now i got it work!!!!

Thank you for sharing and helps.
_/|\_
Chun.



--
View this message in context: http://lucene.472066.n3.nabble.com/Import-data-from-mysql-to-sold-tp4114982p4115431.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Import data from mysql to sold

Posted by rachun <ra...@gmail.com>.
I agree with you.
I finally have another solution for this problem we will import all data
directly from mysql instead.


Thank you for all comments,
keep sharing keep learning :)

_/|\_
Chun.



--
View this message in context: http://lucene.472066.n3.nabble.com/Import-data-from-mysql-to-sold-tp4114982p4115764.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Import data from mysql to sold

Posted by Jack Krupansky <ja...@basetechnology.com>.
It appears that at this moment the best approach would be to write a Java 
program that reads from MongoDB and writes to Solr (Solr XML update 
requests.) Or, write a program that reads from MongDB and outputs a CSV 
format text file and then import that directly into Solr.

-- Jack Krupansky

-----Original Message----- 
From: rachun
Sent: Wednesday, February 5, 2014 11:14 PM
To: solr-user@lucene.apache.org
Subject: Re: Import data from mysql to sold

Hi Jack,


Thank you very much for your reply.
I've read that article already but it seem not what i am looking for.
I'm not sure if it's possible to do what i want or not.
Now I can import all data from mysql to Solr but my boss just want me to
find the way to import from MongoDB into solr.


Best regards,
Chun.



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Import-data-from-mysql-to-sold-tp4114982p4115745.html
Sent from the Solr - User mailing list archive at Nabble.com. 


Re: Import data from mysql to sold

Posted by rachun <ra...@gmail.com>.
Hi Jack,


Thank you very much for your reply.
I've read that article already but it seem not what i am looking for.
I'm not sure if it's possible to do what i want or not.
Now I can import all data from mysql to Solr but my boss just want me to
find the way to import from MongoDB into solr. 


Best regards,
Chun.



--
View this message in context: http://lucene.472066.n3.nabble.com/Import-data-from-mysql-to-sold-tp4114982p4115745.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Import data from mysql to sold

Posted by Jack Krupansky <ja...@basetechnology.com>.
I think this is the first time I have seen a request for import from MongoDB 
on this list. Do a Google search for "solr and mongodb" and you will find a 
bunch of links right away. Are you not seeing these? There is something 
called "Mongo Connector", but it uses the "push" model, as opposed to the 
Solr DIH "pull" model.

See:
http://blog.mongodb.org/post/29127828146/introducing-mongo-connector

-- Jack Krupansky

-----Original Message----- 
From: rachun
Sent: Wednesday, February 5, 2014 6:25 AM
To: solr-user@lucene.apache.org
Subject: Re: Import data from mysql to sold

Hi gurus,

after I got Solr DIH work with mysql now I need to make figure out how to
make it work with MongoDB.
I have been searching for all day but I don't have luck with it. So could
anyone please suggest me any site for my solution?


Thank you very much,
Chun.



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Import-data-from-mysql-to-sold-tp4114982p4115509.html
Sent from the Solr - User mailing list archive at Nabble.com. 


Re: Import data from mysql to sold

Posted by rachun <ra...@gmail.com>.
Hi gurus,

after I got Solr DIH work with mysql now I need to make figure out how to
make it work with MongoDB.
I have been searching for all day but I don't have luck with it. So could
anyone please suggest me any site for my solution?


Thank you very much,
Chun. 



--
View this message in context: http://lucene.472066.n3.nabble.com/Import-data-from-mysql-to-sold-tp4114982p4115509.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Import data from mysql to sold

Posted by Alexei Martchenko <al...@martchenko.com.br>.
1) Yes, its the JDBC connection URL/URI. You can use a JNDI preconfigured
datasource instead. It's all here
http://wiki.apache.org/solr/DataImportHandler

2) It's a mapping: column is the database column and name is your solr
destination field. You only need to specify name when both differ.

DIH looks like a 7-headed dragon first time you see it, but by the end of
the day you'll love it.



alexei martchenko
Facebook <http://www.facebook.com/alexeiramone> |
Linkedin<http://br.linkedin.com/in/alexeimartchenko>|
Steam <http://steamcommunity.com/id/alexeiramone/> |
4sq<https://pt.foursquare.com/alexeiramone>| Skype: alexeiramone |
Github <https://github.com/alexeiramone> | (11) 9 7613.0966 |


2014-02-04 rachun <ra...@gmail.com>:

> please see below code..
>
> <dataConfig>
>   <dataSource type="JdbcDataSource"
>               driver="com.mysql.jdbc.Driver"
>               url="jdbc:mysql://localhost:3306/mydb01"
>               user="root"
>               password=""/>
>   <document>
>     <entity name="users" query="select id,firstname,username from users">
>         <field column="id" name="user_id" />
>         <field column="firstname" name="user_firstname" />
>     </entity>
>   </document>
> </dataConfig>
>
> my question is..
> 1. what is the url for?  (url="jdbc:mysql://localhost:3306/mydb01" )
> does it means my database url?
>
> 2. did i do it right with this
> <field column="id" name="user_id" />
> i'm not sure name means the field in Solr?
>
>
> Thank you very much,
> Chun.
>
>
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Import-data-from-mysql-to-sold-tp4114982p4115191.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Import data from mysql to sold

Posted by Gora Mohanty <go...@mimirtech.com>.
On 4 February 2014 15:28, rachun <ra...@gmail.com> wrote:
> please see below code..
>
> <dataConfig>
>   <dataSource type="JdbcDataSource"
>               driver="com.mysql.jdbc.Driver"
>               url="jdbc:mysql://localhost:3306/mydb01"
>               user="root"
>               password=""/>
>   <document>
>     <entity name="users" query="select id,firstname,username from users">
>         <field column="id" name="user_id" />
>         <field column="firstname" name="user_firstname" />
>     </entity>
>   </document>
> </dataConfig>
>
> my question is..

Please check the URL that you were referred to:
http://wiki.apache.org/solr/DataImportHandler

> 1. what is the url for?  (url="jdbc:mysql://localhost:3306/mydb01" )
> does it means my database url?

It is the JDBC URL: Please see
http://wiki.apache.org/solr/DataImportHandler#Configuring_JdbcDataSource

> 2. did i do it right with this
> <field column="id" name="user_id" />
> i'm not sure name means the field in Solr?

Yes, the "column" is the database column name, and "name"
the Solr field name that must be defined in schema.xml.

Regards,
Gora

Re: Import data from mysql to sold

Posted by rachun <ra...@gmail.com>.
please see below code..

<dataConfig>
  <dataSource type="JdbcDataSource" 
              driver="com.mysql.jdbc.Driver"
              url="jdbc:mysql://localhost:3306/mydb01" 
              user="root" 
              password=""/>
  <document>
    <entity name="users" query="select id,firstname,username from users">
        <field column="id" name="user_id" />           
        <field column="firstname" name="user_firstname" />
    </entity> 
  </document>
</dataConfig>

my question is..
1. what is the url for?  (url="jdbc:mysql://localhost:3306/mydb01" )
does it means my database url?

2. did i do it right with this
<field column="id" name="user_id" /> 
i'm not sure name means the field in Solr?


Thank you very much,
Chun.






--
View this message in context: http://lucene.472066.n3.nabble.com/Import-data-from-mysql-to-sold-tp4114982p4115191.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Import data from mysql to sold

Posted by Alexei Martchenko <al...@martchenko.com.br>.
I've been using DIH to import large Databases to XML file batches and It's
blazing fast.


alexei martchenko
Facebook <http://www.facebook.com/alexeiramone> |
Linkedin<http://br.linkedin.com/in/alexeimartchenko>|
Steam <http://steamcommunity.com/id/alexeiramone/> |
4sq<https://pt.foursquare.com/alexeiramone>| Skype: alexeiramone |
Github <https://github.com/alexeiramone> | (11) 9 7613.0966 |


2014-02-03 rachun <ra...@gmail.com>:

> Dear all gurus,
>
> I would like to import my data (mysql) about 4 Million rows  into solar
> 4.6.
> What is the best way to do it?
>
> Please suggest me.
>
> Million thanks,
> Chun.
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Import-data-from-mysql-to-sold-tp4114982.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Import data from mysql to sold

Posted by Gora Mohanty <go...@mimirtech.com>.
On 3 February 2014 10:14, rachun <ra...@gmail.com> wrote:
> Dear all gurus,
>
> I would like to import my data (mysql) about 4 Million rows  into solar 4.6.
> What is the best way to do it?

Try using the Solr DataImportHandler:
http://wiki.apache.org/solr/DataImportHandler

Searching Google for "solr mysql" also turns up many links on how to index
data into Solr from mysql.

Regards,
Gora