vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   2 vbulletin dbs bridge? (https://vborg.vbsupport.ru/showthread.php?t=174642)

k007 03-31-2008 12:34 AM

2 vbulletin dbs bridge?
 
is there a script/hack out there that bridges two vbulletin databases? i dont want to merge them, i just want to be able to use both of them at the same time.

Dismounted 03-31-2008 04:35 AM

There may well be, but none that I know of.

Adrian Schneider 04-01-2008 07:28 AM

I've created one but the complexity of it is nearly overkill for just synchronizing users.

A simple option (passed my basic proof of concept test) would be using MySQL's new view functionality instead. Absolutely backup first.

For every shared table (user, usergroup, userfield, access, etc.) you would need to drop the original table, and then recreate it as a view:

Code:

CREATE VIEW user as
    SELECT * FROM source_db.user;

MySQL properly optimizes away the view since it's a simple view.

So, automatically, when vBulletin performs queries on any of these "view" tables, MySQL will simply replace the database/table names so it directly touches the other database.

Pros
  • Easy to maintain
  • Should be very fast
Cons
  • Limited to same physical server
  • More risk (6 sites dependent on one)
  • Not stress tested -- Possible complications... ?

Dismounted 04-01-2008 08:02 AM

So basically a symbolic link to another database? That's cool, when was it introduced into MySQL, Adrian? I'm afraid I don't really keep up with MySQL :p.

Adrian Schneider 04-01-2008 08:05 AM

Not really new... but new enough for most people not to have it. 5.01, according to the docs.

This isn't really what they were meant for, but hey it works. :up:

Wilfred1 07-19-2009 02:06 AM

Quote:

Originally Posted by SirAdrian (Post 1479822)
I've created one but the complexity of it is nearly overkill for just synchronizing users.

A simple option (passed my basic proof of concept test) would be using MySQL's new view functionality instead. Absolutely backup first.

For every shared table (user, usergroup, userfield, access, etc.) you would need to drop the original table, and then recreate it as a view:

Code:

CREATE VIEW user as
    SELECT * FROM source_db.user;

MySQL properly optimizes away the view since it's a simple view.

So, automatically, when vBulletin performs queries on any of these "view" tables, MySQL will simply replace the database/table names so it directly touches the other database.

Pros
  • Easy to maintain
  • Should be very fast
Cons
  • Limited to same physical server
  • More risk (6 sites dependent on one)
  • Not stress tested -- Possible complications... ?

I know this is a bit old but how did the views option go?

I would very much like to test this so any idea what the source_db syntax would be for the user table located in a separate db on the same server?

Adrian Schneider 07-19-2009 03:08 AM

I've only tested it in a development environment... never on a production site.

"source_db" is the name of the other database that you want to pull the users from.

Wilfred1 07-19-2009 03:16 AM

Thanks Sir Adrian but wouldn't need some form of connection string not just the name but username and password as well?

Dismounted 07-19-2009 04:02 AM

No, the database user that you access the DB with just needs to have permissions to the other DB.


All times are GMT. The time now is 09:59 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00968 seconds
  • Memory Usage 1,728KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete