Skip to content

Instantly share code, notes, and snippets.

@igorb
Created August 23, 2013 07:55
Show Gist options
  • Save igorb/6316642 to your computer and use it in GitHub Desktop.
Save igorb/6316642 to your computer and use it in GitHub Desktop.
backup/restore mysql backup/restore redis scp

1. backup/restore mysql

backup: mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql

restore: mysql -u root -p[root_password] [database_name] < dumpfilename.sql

mysqldump -u appzone -pP@rtnerpedia appzone_qa > 1.sql

2. backup/restore redis(http://code.google.com/p/redis-dump/)

sudo gem install redis-dump

help: redis-dump --help

backup: redis-dump -u 127.0.0.1:6379 > db_db15.json

restore: < db_full.json redis-load

3. scp [[user@]from-host:]source-file [[user@]to-host:][destination-file]

from-host Is the name or IP of the host where the source file is, this can be omitted if the from-host is the host where you are actually issuing the command

user Is the user which have the right to access the file and directory, that is supposed to be copied in the case of the from-host, and the user who has the rights to write in the to-host

source-file Is the file or files that are going to be copied to the destination host, it can be a directory but in that case you need to specify the -r option to copy the contents of the directory

destination-file Is the name that the copied file is going to take in the to-host, if none is given all copied files are going to keep its names

SCP Options

-p Preserves the modification and access times, as well as the permissions of the source-file in the destination-file

-q Do not display the progress bar

-r Recursive, so it copies the contents of the source-file (directory in this case) recursively

-v Displays debugging messages

scp deploy@az-qa:~/1.sql ~/partnerpedia

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment