Synchronizing a remote and local site.

Blogging and web publishing for the impatient.
KBleivik
Site Admin
Posts: 178
Joined: Tue Sep 29, 2009 6:25 pm
Location: Moss Norway
Contact:

Synchronizing a remote and local site.

Postby KBleivik » Wed May 25, 2011 10:11 pm

There are two parts that you need to synchronize, the file system and the database. It is easiest to synchronize the file system via most professional IDE's e.g. via Adobe Dreamweaver. There is a very cheap alternative, http://www.smartftp.com/ and http://filezilla-project.org/ is a free option that is good enough for many small web companies.

Synchronizing the remote and the local database can be more difficult. Since professional hosters have their database servers behind firewalls, you will in most cases be denied access to the remote database. One option is to let your hoster know your IP. The he can add an exception to his firewall to let you through. This solution will only work if you're connecting from a location with a static IP. Once a firewall exception is set up, you can use your domain name as the hostname for the MySQL server.

There is another option using PuTTY http://www.putty.org/ If your account includes SSH access, you can set up an SSH tunnel to forward a port on your local computer to the hosters MySQL server. The MySQL traffic will be encrypted and he don't need to change the firewall rule. Ask wich port your hoster uses for SSH connections.

This procedure function on my Vista laptop:

Open PuTTY. In the Category pane of the application window, select the "Tunnels" option found under Connection->SSH. In the main pane, in the "Port Forwarding" section, do this:
  1. By Source Port, add the port that you would like to forward e.g. 3306 for mysql.
  2. By destination, type the hostname you want to connect to e.g. yourdomain.com
  3. At the end of the hostname, add a colon followed by 3306, e.g. yourdomain.com:3306 (the radio buttons under the destination can be left as Local and Auto)
  4. Click add.
  5. Click on the session in the category pane.
  6. Enter the hostname your want to connect to (yourdomain.com) and the port you got from your hoster.
  7. Click open and log into the session.
  8. You can verify if PuTTY has set up the port forwarding correctly by looking at the PuTTY Event Log. To do this, click on the Windows icon in the upper left corner of the menu bar in your open SSH session (small green icon on a black background that can be difficult to see). There from the drop down menu select Event Log, in which you should see if the connection is ok.
  9. For more information please see the PuTTy user manual , especially the section on Port Forwarding.
Now login to cPanel and click on the MySQL icon - newer versions of cPanel have a separate Remote MySQL icon In the access hosts field, you will need to put a "%" sign. Click the "Add Hosts" button.

You should now be able to connect to port 3306 at localhost and it will be fowarded to the remote MySQL server.

If it is impossible to synchronize the local and the remote database, you have no other option than dumping the database as a sql file via the phpMyAdmin export tool or via the wp-db-backup or similar plugins.

Return to “WordPress”

Who is online

Users browsing this forum: No registered users and 1 guest