Results 1 to 2 of 2

Thread: Shell script to stop start mysql and do the mysql dump and rsync.

  1. #1
    Junior Member
    Join Date
    Jun 2011
    Posts
    15
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default Shell script to stop start mysql and do the mysql dump and rsync.

    Guys i need help to create a script for my mysql databases that uses two way replication. I wanted to have a script that will automatically stop the databases from serverA then do a mysqldump then do an rsync to serverB and stops the mysql on serverb then load the mysqldump then restart the mysql service both severA nd B. Sorry guys but i'm, not good in scripting. i need the best help that i can get from you guys. Thank you and appreciate it.
    Last edited by redtred; 23rd July 2011 at 02:54 PM. Reason: add details

  2. #2
    Member billconner's Avatar
    Join Date
    Jul 2010
    Posts
    90
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Rep Power
    4

    Default mysql

    mysql has commands to perform the functions you need, just add them to the script along with the proper authentication.

    On the remote server either copy the script over and use ssh to run the script or put it in crontabs on either or both servers.

    Best bet, add a mysql user to each server who can run the scripts. Add the scripts to each server's crontab or "at" if you can't write to crontab. Make sure the mysql user has an .ssh directory on both servers and no password (for unattended execution of the script). Copy each .ssh/public_key to the opposite server and ssh should work both ways.

    Bill

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. MySQL restore a single table from .sql dump file
    By Jai Pagare in forum Databases servers
    Replies: 3
    Last Post: 11th July 2011, 03:55 PM
  2. mysql dump
    By unixadmin007 in forum Databases servers
    Replies: 4
    Last Post: 5th November 2010, 03:44 AM
  3. MYSQL backup script shell
    By sarajusa in forum Shell scripting
    Replies: 2
    Last Post: 21st June 2010, 04:40 AM
  4. [Solved] Mysql won't start. my.cnf problem.
    By skh in forum Web servers
    Replies: 2
    Last Post: 25th March 2010, 12:43 AM
  5. start up and stop the running script
    By mala_un in forum Shell scripting
    Replies: 9
    Last Post: 26th July 2006, 07:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •