Using Drush Alias

drush aliases allow you to run a drush commands on your local server but actually execute the command on a remote server.

One can create aliases in a folder that drush recognizes, mostly inside the .drush folder for Linux Based Systems. For a mysite example, we can create a file called as mysite.aliases.drushrc.php inside the .drush folder (Or any folder which Drush goes through before executing). All aliases in a site can also be combined in a single file called as aliases.drushrc.php

Example data that can be added to mysite.aliases.drushrc.php

<?php
$aliases
['mysite.local'] = array(
 
'uri' => 'localhost/mysite',
 
'root' => '/var/www/mysite',
 
'path-aliases' => array(
   
'%files' => 'sites/default/files',
  ),
);
$aliases['mysite.production'] = array(
 
'uri' => 'mysite.org',
 
'root' => '/var/www/mysite/public_html',
 
'dump-dir' => '/home/myuser/drush-dump',
 
'remote-host' => 'mysite.org',
 
'remote-user' => 'myuser',
 
'path-aliases' => array(
   
'%files' => 'sites/default/files',
  ),
);
?>

Rsyncing Local instance of mysite with production can be achieved via the command

drush rsync @mysite.production @mysite.local
drush core-rsync @mysite.production @mysite.local --include-conf --exclude=*.sql  --delete

Syncing SQL from Production instance with local instance can be achieved via the command.

drush sql-sync @mysite.production @mysite.local --create-db

The --create-db option deletes the Database in the local instance and updates with the production sql instance instead of merging which happens by default.

One can check the status of the remote instance via the command

drush @mysite.production status

Alternately, creating site-aliases can be automated via drush with the command:

drush site-alias --with-db --show-passwords --with-optional @self

or better still

drush site-alias --with-db --show-passwords --with-optional @self > ~/.drush/mysite.aliases.drushrc.php

--
Source
https://drupal.org/node/670460
http://drush.ws/examples/example.aliases.drushrc.php
http://soundpostmedia.com/article/drush-tip-use-sql-sync-quickly-and-eas...
http://deeson-online.co.uk/labs/drupal-drush-aliases-and-how-use-them