anlek / mongify

Mongify allows you to map your data from a sql database and into a mongodb document database.
http://github.com/anlek/mongify
MIT License
317 stars 82 forks source link

Cannot connect to remote mysql server #103

Closed dinhkhanh closed 8 years ago

dinhkhanh commented 8 years ago

I use mongify in localhost successfully.

When I try to connect to a remote database server, an error occurs because of incorrect username.

My config file:

sql_connection do
  adapter   "mysql"
  host      "10.10.10.10"
  username  'test@10.10.10.10'
  password  "test@123"
  database  "test"
end

mongodb_connection do
  host      "localhost"
  database  "test"
end

where 10.10.10.10 is my remote server IP address.

Output log:

$mongify ck database.conf translate.rb 
$/Users/myuser/.rvm/gems/ruby-2.3.0@global/gems/activerecord-3.2.22.2/lib/active_record/connection_adapters/mysql_adapter.rb:411:in `real_connect': Access denied for user 'test@10.10.10.10'@'10.8.8.42' (using password: YES) (Mysql::Error)

where 10.8.8.42 is my computer IP address.

Means mongify automatically append local IP into username.

Note: If I remove @10.10.10.10 in username, the log will say ...Access denied for user 'test'@'10.8.8.42' ... which is not the expected username using to login the server.

How to change configuration file to make it work properly?

bhumipatel1512 commented 8 years ago

use $mongify check database.config command for Checks connection for sql and no_sql databases

anlek commented 8 years ago

Remove the @10.10.10.10 in the username.

Also, Mongify is NOT recommended to use via network to transfer data. The amount of read/writes the system does means it will take 10x or more to do the same action as if it was on a local system. Furthermore, Mongify is not able to recover from any network failures, so you might lose your progress hours into the translation. I'd recommend you download a copy of the remote server and load it into your local db, do the translation and export the data back to the remote server.

Good luck, Andrew

dinhkhanh commented 8 years ago

@anlek I thought I would do that way. Mongify "almost" everything in a local copy, then use sync to update if there is any new record in the remote database later.