database backup - how to?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • siliconmike

    #1

    database backup - how to?

    How do I synchronize MySQL table data of my home PC with latest data
    from a remote server ?

    My home PC is on a very slow internet connection, so implementing
    replication will cause long time read lock on remote server, which is
    not desirable.

    What are the tools for manual sync of tables ?

    I'm running FreeBSD on my home PC.

    Mike

  • Aggro

    #2
    Re: database backup - how to?

    siliconmike wrote:
    [color=blue]
    > What are the tools for manual sync of tables ?[/color]

    If the size of database is not too big:

    Use mysqldump to create dump of the whole database. Use gzip or similar
    tool to make it smaller for the transfering. On your computer, unzip it
    and read it in using mysql-command line tool.

    You can use mysqldump to get only given tables, in case you habe very
    large static table and few small dynamic tables.

    Comment

    • siliconmike

      #3
      Re: database backup - how to?



      Aggro wrote:[color=blue]
      > siliconmike wrote:
      >[color=green]
      > > What are the tools for manual sync of tables ?[/color]
      >
      > If the size of database is not too big:
      >
      > Use mysqldump to create dump of the whole database.[/color]

      Oh O! The tables are Biiiiiiiiiiiiii iigggggggg!!

      Comment

      • jerry gitomer

        #4
        Re: database backup - how to?

        siliconmike wrote:[color=blue]
        > How do I synchronize MySQL table data of my home PC with latest data
        > from a remote server ?
        >
        > My home PC is on a very slow internet connection, so implementing
        > replication will cause long time read lock on remote server, which is
        > not desirable.
        >
        > What are the tools for manual sync of tables ?
        >
        > I'm running FreeBSD on my home PC.
        >
        > Mike
        >[/color]

        Mike,

        If you can modify the programs on the server have them write the
        SQL statements that insert or update your server database to a
        flat file. Download the flat file and run it against your home
        PC database.

        As long as every SQL statement is terminated with a semi-colon
        you can execute the contents of your flat file using:

        mysql -u user_name database_name < flat_file_name

        HTH

        Jerry

        Comment

        • Olivier M.

          #5
          Re: database backup - how to?

          <siliconmike@ya hoo.com> ecrivait/schrieb/wrote:[color=blue][color=green]
          >> Use mysqldump to create dump of the whole database.[/color]
          >
          > Oh O! The tables are Biiiiiiiiiiiiii iigggggggg!![/color]

          even if you compress them with bzip2/gzip? (generaly work
          quite well on dumps).

          Olivier

          --
          _______________ _______________ _______________ _______________ _____
          Olivier M. - spam-2005-06@8304.ch - PGP: 0E84D2EA - Switzerland

          Comment

          • siliconmike

            #6
            Re: database backup - how to?

            Sounds good. But I would prefer another approach - putting a column
            called NEEDS_BACK_UP in each remote table to keep track of whether a
            record needs to be backed up.

            In what you advise, probably a failed sql statement in a flat file
            might leave the rest of the sql statements meaningless.

            Although, my scheme I guess needs considerable change in my code.

            Or there is another scheme - updated-timestamp in each remote table...

            Mike

            jerry gitomer wrote:
            [color=blue]
            > Mike,
            >
            > If you can modify the programs on the server have them write the
            > SQL statements that insert or update your server database to a
            > flat file. Download the flat file and run it against your home
            > PC database.
            >
            > As long as every SQL statement is terminated with a semi-colon
            > you can execute the contents of your flat file using:
            >
            > mysql -u user_name database_name < flat_file_name
            >
            > HTH
            >
            > Jerry[/color]

            Comment

            • siliconmike

              #7
              Re: database backup - how to?

              Olivier M. wrote:[color=blue]
              > <siliconmike@ya hoo.com> ecrivait/schrieb/wrote:[color=green][color=darkred]
              > >> Use mysqldump to create dump of the whole database.[/color]
              > >
              > > Oh O! The tables are Biiiiiiiiiiiiii iigggggggg!![/color]
              >
              > even if you compress them with bzip2/gzip? (generaly work
              > quite well on dumps).[/color]

              The site will initially have 2 GB tables, which will grow..

              Comment

              • Aggro

                #8
                Re: database backup - how to?

                siliconmike wrote:
                [color=blue]
                > In what you advise, probably a failed sql statement in a flat file
                > might leave the rest of the sql statements meaningless.[/color]

                No, if you use --force parameter (if I remember the syntax correctly),
                which will force it continue after errors also.

                Comment

                • siliconmike

                  #9
                  Re: database backup - how to?



                  Aggro wrote:[color=blue]
                  > siliconmike wrote:
                  >[color=green]
                  > > In what you advise, probably a failed sql statement in a flat file
                  > > might leave the rest of the sql statements meaningless.[/color]
                  >
                  > No, if you use --force parameter (if I remember the syntax correctly),
                  > which will force it continue after errors also.[/color]

                  What I mean is that there is no meaning to continue backup in case a
                  sql command fails. Because some of the future sql commands might be
                  depending on the result of the one that failed. The backup-data then
                  wouldn't be equivalent to the original one.

                  Comment

                  • steve

                    #10
                    Re: database backup - how to?

                    "" wrote:[color=blue]
                    > How do I synchronize MySQL table data of my home PC with
                    > latest data
                    > from a remote server ?
                    >
                    > My home PC is on a very slow internet connection, so
                    > implementing
                    > replication will cause long time read lock on remote server,
                    > which is
                    > not desirable.
                    >
                    > What are the tools for manual sync of tables ?
                    >
                    > I'm running FreeBSD on my home PC.
                    >
                    > Mike[/color]

                    I have followed this thread...

                    but have a basic question..

                    Why do you want to ’synchronize’ db with your home pc? Since you
                    mention slow connection, you obvisouly only using your home pc for
                    back. Then there are no stringent requiremetns for synch’ing. All
                    you need is simple backups, which have been amply explained.

                    By the way, on a 2Gig DB, the best approach is mysqlhotcopy, if you
                    have root access. All the other approaches can be problematic:
                    mysqldump can fail on big db’s, and taring the files directly fails
                    too, since the files may be updating in middle of tar.

                    --
                    Posted using the http://www.dbforumz.com interface, at author's request
                    Articles individually checked for conformance to usenet standards
                    Topic URL: http://www.dbforumz.com/mySQL-databa...ict237213.html
                    Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbforumz.com/eform.php?p=824569

                    Comment

                    • siliconmike

                      #11
                      Re: database backup - how to?

                      steve wrote:[color=blue]
                      > "" wrote:[color=green]
                      > > How do I synchronize MySQL table data of my home PC with
                      > > latest data
                      > > from a remote server ?
                      > >
                      > > My home PC is on a very slow internet connection, so
                      > > implementing
                      > > replication will cause long time read lock on remote server,
                      > > which is
                      > > not desirable.
                      > >
                      > > What are the tools for manual sync of tables ?
                      > >
                      > > I'm running FreeBSD on my home PC.
                      > >
                      > > Mike[/color]
                      >
                      > I have followed this thread...
                      >
                      > but have a basic question..
                      >
                      > Why do you want to 'synchronize' db with your home pc?[/color]

                      To keep the new data posted by people on the website server, so that in
                      case the server crashes, I have a copy.

                      Since you[color=blue]
                      > mention slow connection, you obvisouly only using your home pc for
                      > back. Then there are no stringent requiremetns for synch'ing. All
                      > you need is simple backups, which have been amply explained.
                      >
                      > By the way, on a 2Gig DB, the best approach is mysqlhotcopy, if you
                      > have root access.[/color]

                      Correct me- but mysqlhotcopy acquires read locks, and since I'm on a
                      slow connection, long time read locks would prevent other threads from
                      reading the tables while it is being backed up.. right?

                      All the other approaches can be problematic:[color=blue]
                      > mysqldump can fail on big db's, and taring the files directly fails
                      > too, since the files may be updating in middle of tar.[/color]

                      Comment

                      • Aggro

                        #12
                        Re: database backup - how to?

                        siliconmike wrote:
                        [color=blue]
                        > Correct me- but mysqlhotcopy acquires read locks, and since I'm on a
                        > slow connection, long time read locks would prevent other threads from
                        > reading the tables while it is being backed up.. right?[/color]

                        Can you not create the copy to the server. After copy is ready, then
                        transfer it to your home computer?

                        Comment

                        • steve

                          #13
                          Re: Re: database backup - how to?

                          "" wrote:[color=blue]
                          > steve wrote:[color=green]
                          > > "" wrote:[color=darkred]
                          > > > How do I synchronize MySQL table data of my home PC with
                          > > > latest data
                          > > > from a remote server ?
                          > > >
                          > > > My home PC is on a very slow internet connection, so
                          > > > implementing
                          > > > replication will cause long time read lock on remote[/color][/color]
                          > server,[color=green][color=darkred]
                          > > > which is
                          > > > not desirable.
                          > > >
                          > > > What are the tools for manual sync of tables ?
                          > > >
                          > > > I'm running FreeBSD on my home PC.
                          > > >
                          > > > Mike[/color]
                          > >
                          > > I have followed this thread...
                          > >
                          > > but have a basic question..
                          > >
                          > > Why do you want to 'synchronize' db with your home pc?[/color]
                          >
                          > To keep the new data posted by people on the website server,
                          > so that in
                          > case the server crashes, I have a copy.
                          >
                          > Since you[color=green]
                          > > mention slow connection, you obvisouly only using your home[/color]
                          > pc for[color=green]
                          > > back. Then there are no stringent requiremetns for[/color]
                          > synch'ing. All[color=green]
                          > > you need is simple backups, which have been amply explained.
                          > >
                          > > By the way, on a 2Gig DB, the best approach is mysqlhotcopy,[/color]
                          > if you[color=green]
                          > > have root access.[/color]
                          >
                          > Correct me- but mysqlhotcopy acquires read locks, and since
                          > I'm on a
                          > slow connection, long time read locks would prevent other
                          > threads from
                          > reading the tables while it is being backed up.. right?
                          >
                          > All the other approaches can be problematic:[color=green]
                          > > mysqldump can fail on big db's, and taring the files[/color]
                          > directly fails[color=green]
                          > > too, since the files may be updating in middle of tar.[/color][/color]

                          mysqlhotcopy works on the remote server itself (again assuming you
                          have root access). It takes care of all the locking, so that a live
                          database can be backed up. If you, instead, use TAR or mysqldum, you
                          will notice that the db will be brought down to its feet.

                          Backups can be had for very cheap these days, a few dollars a month.
                          There is no reason to back up over slow lines to your local PC. Just
                          backup over high speed to a 3rd party location. Try GNAX, you can
                          back up your 2Gig for $1.00 !! a month
                          http://www.gnax.net/backup/index.php

                          --
                          Posted using the http://www.dbforumz.com interface, at author's request
                          Articles individually checked for conformance to usenet standards
                          Topic URL: http://www.dbforumz.com/mySQL-databa...ict237213.html
                          Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbforumz.com/eform.php?p=824634

                          Comment

                          Working...