PDA

View Full Version : Cloned forum/database changing bburl of one affects both - what's going on?


SToP_GAP
11-28-2012, 12:46 AM
Hi, I'd appreciate any help anyone can offer here...

I have duplicated my forum folder and created a copy of the database with a different name. I've also created a new user in the database users with no access given to the original database. I have modified the config.php accordingly also.

The point of this exercise was to create a development clone of my live forum, to test a patch upgrade on it rather than the live site... nothing nefarious :)

I can only access one site at a time. If I change the bburl via the admin->options to the new forum then the new clone works fine, but, the original then ceases to work (I get a white page with no content). The admin panels remain functional at this point so if I now change the URL back on the original site, it then works fine but the clone is once again disabled.

Any changes to one seem to affect the other, despite the different databases and the user account for the clone being denied access to the original database. I'm a bit stumped here... can anyone offer any advice?

I should add that the content displayed on both sites is coming from the correct databases as posts are showing up on the original and not the clone.

I have tried clearing the cache table, no joy. xcache is installed but disabled right now. I've restarted lighttpd but nothing changed. The style being displayed is even different (as it should be, it was changed on the original after the data was exported and prior to importing it into the new clone database).

kh99
11-28-2012, 11:22 AM
Try going to Settings > Options > Site Name / URL / Contact Details and making sure "Forum URL" is correct in each database.

SToP_GAP
11-28-2012, 11:40 AM
Hey, thanks for replying. I can confirm that the control panels both correctly show the respective URLs, as do both databases from what I can tell (the datastore, settings and options tables - in serialised arrays).

This is vB 4.2.0 (no patches - FYI)

kh99
11-28-2012, 11:51 AM
Oh, I see now - that's the same setting you're changing to cause one site or the other to work. :o That is strange that changing one database would affect the other site.

What do you have for cookie path under "Cookies and HTTP Header Options"? If you're using the same domain name but a different path for your test site, you might need to change that to someting other than '/'.

SToP_GAP
11-28-2012, 12:27 PM
Those settings were all at / or blank (on both versions).

I should add that the original forum is being accessed via a domain which points to the server, the other is accessed directly from the IP of the same server. These are set to point to different places on the server and I confirm that this is working as I can load scripts with the same name but different output via both URLs. I have moved the test site into a sub-folder in its original root and updated paths accordingly (including cookie path). The exact same issue happens again however - When I set the cookie path or any setting it seems for one site, despite retaining the correct data, the other site ceases to load.

When I came to this setup there was originally the configuration I'm trying to achieve in place but it broke when I tried to run the upgrade scripts on the test site (this was v4.1.1 not 4.2), so it definitely has worked in this scenario before...

It feels as though there's some clash somewhere, possibly some oddness with a cache? I'm trying from different browsers with all cache cleared, xcache is off on the server as I said... I'm very confused!

--------------- Added 1354110188 at 1354110188 ---------------

I've just noticed that when I first log on, both are accessible just fine most of the time. However, when I do, the Forum Name (bbtitle) set on the original site is being used on the cloned site's pages, even when the options and databases show different settings to each other.

I can only assume that somehow the data is being mixed up, but it's very strange as it's only some data. I was able to change the text of a notice via the admin panel of the clone site for example, and the message remained as it should on the original site and remained changed on the clone site. Setting this did not cause either site to become unavailable, so it seems to happen when options are set.

Lynne
11-28-2012, 04:18 PM
So you have checked each database and each is pointing to a different URL? Have you checked your config.php files for each site to make sure they are each pointing to a different database?

SToP_GAP
11-28-2012, 04:40 PM
To be honest Lynne I'm totally confused now about this... When I go to options to change the bburl field, both correctly list the base URL respectively. When you change, it changes and saves on the correct forum (but breaks the other forum until you go and re-save the same field on that one).

I have checked the "options" entry of the "datastore" table for each database and the changes are reflected correctly in just the one place.

However if I change the title of a forum it changes in both places and yet the last post date on the clone remains at 1 day old (which is correct as of when I cloned the data from the main database).

I think there is something sticking in caches somewhere. To the best of my knowledge I've disabled xcache - I really don't know what else to do!

Lynne
11-28-2012, 04:44 PM
Did you check your config.php files to see if you are using any caching? You may need to set the Datastore prefix is different in both configs and also the cookie prefix.

SToP_GAP
11-28-2012, 04:45 PM
Strike that, I just did a reboot and it is working now... My guess is that it was indeed xcache not being disabled properly.

Thanks to you both for helping :)

Lynne
11-28-2012, 04:46 PM
Glad it's working now. :)

SToP_GAP
11-28-2012, 05:26 PM
So to sum up for anyone else in the same situation, this is what I did to clone the database:

Switch off the forum from the admin panel->options->Turn Your vBulletin On and Off

use mysqldump to copy out the existing database:
mysqldump -h [server_ip_here] -u -p[password] [database_name_here] > liveforumdump.sql

(for most people, server_ip_here will just need to be localhost however if you are connecting to a database on a remote machine via an IP address this will need to go here)

copy the entire forum root folder, [U]including owner and groups
cp -a /pathtosourcefolder /pathtodestfolder

If you forget to use the -a (archive) option then you may need to chown the files to the apache/lighttpd/(whichever webserver user) account on your system.

Next create a new database to house the duplicate in:
log in to mysql as root (or other suitably privileged user): mysql -u root -p
From the mysql command prompt: CREATE DATABASE cloned_forum_db_name;
Next give this account a new user: GRANT ALL PRIVILEGES ON cloned_forum_db_name.* TO clone_user@localhost IDENTIFIED BY 'password_here';
Exit mysql promptquit

Now restore the liveforum.sql to the new database: mysql -u root -p cloned_forum_db_name < liveforumdump.sql

Next you must edit clonedforumfolder/includes/config.php

Make sure that you change the following lines to match the user, database and passwords which you have used in the previous steps:
$config['Database']['dbname'] = 'cloned_forum_db_name';
$config['MasterServer']['username'] = 'clone_user';
$config['MasterServer']['password'] = 'password_here';

You may also need to alter:
$config['Misc']['forumpath'] = 'forum_root_path_here';
$config['Misc']['cookieprefix'] = 'cookie_prefix_here';
$config['Datastore']['class'] = 'vB_Datastore_Filecache';
$config['Datastore']['prefix'] = 'datastore_prefix_here';


It is possible that you will need to alter the cache type - if XCache was selected for example then both forums will be trying to share the same cache files and you will get the same conflicts that I wrote about earlier in this thread. In theory, simply changing the cache prefix should be sufficient to fix this.

You may also need to change the settings under:
admin->settings->options->Site Name / URL / Contact Details
if they don't automatically reflect the new path etc. that you enter in config.php

Finally, if you want to put this new copy in development mode you can set:
$config['Misc']['debug'] = true;

A reboot may be required but that should be all that you need to get your forum cloned to run as a development copy. I hope this helps someone else too.

Don't forget to switch your main forum back on afterwards! :)