[wp-hackers] How to sync/mirror 2 WP multisite installs using one database?

Wilson Ricardo wrgallinari at gmail.com
Fri May 27 00:22:53 UTC 2011


Don't install 2 instances, just block the login from external network(or
unlock for intranet and block the rest).
It can be done using .htaccess on apache, limiting the access on wp-*login*.

On Thu, May 26, 2011 at 4:49 AM, Claudio Simeone <mrbrog at gmail.com> wrote:

> Hi all,
> For reasons that don't depends from me, I have to use two separate
> servers to run an enterprise WP multisite.
> So I have this setup:
> server 1: Back-end with a WP with Multisite active (e.g.
> www.private-wp.com)
> server 2: Front-end with a mirrored copy of the WP install on server 1
> (e.g. www.public-wp.com)
> server 3: mySQL server, running on a separate machine, but accessible
> from both server 1 and server 2
> the backend install is only used to manage all the content: posts,
> pages, sites etc... and is restricted to an editorial team and it is a
> private website.
> the frontend install is on the public website and it's a read only
> version (with wp-admin not used).
> Now, since the multisite feature is active, I need in the public
> website to have correct urls of blogs created and managed in the
> private website.
> For example in these tables
> wp_options (siteurl, home)
> wp_site (domain)
> wp_sitemeta (siteurl)
> wp_blogs (domain)
> and in every wp_N_options table (siteurl, home)
> all field values refer to the private-wp URL/domain, for example:
> www.private-wp.com/myblog/mypost/
> Now, in the public website, this has to be
> www.public-wp.com/myblog/mypost/
> and so on...
> Now, I can use 2 distinct databases (wp_private_db and wp_public_db)
> and sync the public one every night through a PHP script that
> - drops all tables in wp_public_db
> - copies all tables from wp_private_db to wp_public_db
> - replaces all urls in all tables in wp_public_db with correct values
> I tried this and it seems to work, but I don't like too much this
> solution because the DB is large and I fear that dropping/copying a
> lot tables can create problems, so I wonder if there's a simpler
> solution to my problem, for example using just one DB and replacing
> URLS on the fly with something like in wp-config.php
> define('WP_SITEURL', 'http://www.public-wp.com');
> define('WP_HOME', 'http://www.public-wp.com');
> Any ideas on the best way to get this work?
> Thank you in advance,
> Claudio
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list