On Tue, Jun 14, 2016 at 8:30 AM, sushovan majumdar <sushovan....@gmail.com> wrote:
> Hello, > I have to move data from database server to new database server. Schema is > same for both. > I want to write a cron job which would keep replicating data from old > server to newer one. > In future I will throw away the old database server. > In general, you probably don't want to do this with a cron job, unless you are moving the data for archival purposes, and are not relying on it as live data for a separate instance of your application. Is this part of a backup strategy? Are both databases in production? If you really want/need cron to handle the job, then the mysqldump command will be your friend. http://dev.mysql.com/doc/refman/5.7/en/mysqldump.html > I was looking into database routers in django to achieve this ( > https://docs.djangoproject.com/en/1.9/topics/db/multi-db/) but I couldn't > decide how the solution would look like, > > I can write a new django app in old server and setup database router in > that? > Given that you are concerned with the same data/structure in both databases, DB replication is likely to be much more resilient and more importantly, accurate. It also doesn't require any changes at the application (Django) level, all synchronization is handled by MySQL. I can't think of any reason this would be done at the app level, and it sounds like it would add unnecessary complication to your application, not to mention the performance hit, if it would even work. > Can some point me to existing solutions regarding this or how can I > achieve this? > http://dev.mysql.com/doc/refman/5.7/en/replication.html http://dev.mysql.com/doc/refman/5.7/en/replication-solutions.html http://dev.mysql.com/doc/refman/5.7/en/replication-howto.html If you are replicating across the Internet, ensure that the replication traffic is sent over a secure channel (such as SSH), otherwise an attacker can literally listen and grab any data that you are inserting/updating in your DB. -James -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Be%2BciVtkvz92efuVGM93aWUX4UwgLY6%3DhcLg7rHtbr-f74whw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.