Go Back   vb.org Archive > Community Discussions > Forum and Server Management

Reply
 
Thread Tools Display Modes
  #1  
Old 05-05-2010, 09:27 PM
SnapOff Racing SnapOff Racing is offline
 
Join Date: Apr 2006
Posts: 336
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Multiple hostnames in the config.php for load balancing / round robin

I am wondering if under the ****** MASTER DATABASE SERVER NAME AND PORT ****** I can add multiple hostnames that will point to one server that is hosting the database but yet that same server has 3 different WAN connections pointing to it. So basically it would look like this in config.php

// ****** MASTER DATABASE SERVER NAME AND PORT ******
// This is the hostname or IP address and port of the database server.
// If you are unsure of what to put here, leave the default values.
$config['MasterServer']['servername'] = '123.123.123.1';
$config['MasterServer']['servername'] = '123.123.123.2';
$config['MasterServer']['servername'] = '123.123.123.3';
$config['MasterServer']['port'] = 3306;

Will vbulletin automatically round robin these entries or will it only use the first connection and then just ignore the rest??
Reply With Quote
  #2  
Old 05-06-2010, 06:13 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That will use whichever you place last. Use:
PHP Code:
$servers = array(
    
'123.123.123.1',
    
'123.123.123.2',
    
'123.123.123.3'
);
$serv_index mt_rand(0, (count($servers) - 1)); 

$config['MasterServer']['servername'] = $servers[$serv_index]; 
Reply With Quote
  #3  
Old 05-06-2010, 11:11 AM
Angel-Wings's Avatar
Angel-Wings Angel-Wings is offline
 
Join Date: Sep 2007
Posts: 206
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm - and if you use instead of some PHP function a real loadbalancer ? Then you can do real load-balancing based on the load of the backends instead of just plain rotating between the backeneds.
Reply With Quote
  #4  
Old 05-06-2010, 06:04 PM
SnapOff Racing SnapOff Racing is offline
 
Join Date: Apr 2006
Posts: 336
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dismounted View Post
That will use whichever you place last. Use:
PHP Code:
$servers = array(
    
'123.123.123.1',
    
'123.123.123.2',
    
'123.123.123.3'
);
$serv_index mt_rand(0, (count($servers) - 1)); 

$config['MasterServer']['servername'] = $servers[$serv_index]; 
Excellent Thank You for that. I will give it a try :up:

--------------- Added [DATE]1273190169[/DATE] at [TIME]1273190169[/TIME] ---------------

Alright I tried that script you posted and it works but if I pull any of the connections the forum stops working. Could you double check the script for me and make certain that a character wasn't accidentally overlooked somewhere?
Reply With Quote
  #5  
Old 05-07-2010, 06:13 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by SnapOff Racing View Post
Alright I tried that script you posted and it works but if I pull any of the connections the forum stops working. Could you double check the script for me and make certain that a character wasn't accidentally overlooked somewhere?
What do you mean by 'pulling any of the connections'?
Reply With Quote
  #6  
Old 05-07-2010, 05:34 PM
Angel-Wings's Avatar
Angel-Wings Angel-Wings is offline
 
Join Date: Sep 2007
Posts: 206
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by SnapOff Racing View Post
Alright I tried that script you posted and it works but if I pull any of the connections the forum stops working. Could you double check the script for me and make certain that a character wasn't accidentally overlooked somewhere?
Well - you may use that PHP code or read the official MySQL documentation since there's already a tool doing exactly what you're looking for.
But if you prefer PHP - ok - your choice
Reply With Quote
  #7  
Old 05-08-2010, 05:14 AM
SnapOff Racing SnapOff Racing is offline
 
Join Date: Apr 2006
Posts: 336
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dismounted View Post
What do you mean by 'pulling any of the connections'?
Ok it's like this, I am running a local webserver with 5 separate internet connections going into one server. They are all run into one router that does the load balancing. But what I wanna do is put my forum on a different server but still host the database from here. So in the config.php file I need to be able to tell it that I have 5 separate connections that it can choose to connect to. I tried using the script you provided which seems to work but if I pull one of the 5 local connections offline then everything stops working where really it should just skip to the next connection if it sees that connection is down. Basically a failover.
Reply With Quote
  #8  
Old 05-08-2010, 09:57 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's difficult to achieve due to the current internal design of vBulletin. It assumes that only one server exists, and this is merely a hacked-up way of getting around that. A solution would be to comment out that server's IP in config.php whenever you take it offline.
Reply With Quote
  #9  
Old 05-08-2010, 11:28 AM
Angel-Wings's Avatar
Angel-Wings Angel-Wings is offline
 
Join Date: Sep 2007
Posts: 206
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for ignoring me but still mysqlproxy can do exactly what you're looking for
Reply With Quote
  #10  
Old 05-08-2010, 10:31 PM
SnapOff Racing SnapOff Racing is offline
 
Join Date: Apr 2006
Posts: 336
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dismounted View Post
That's difficult to achieve due to the current internal design of vBulletin. It assumes that only one server exists, and this is merely a hacked-up way of getting around that. A solution would be to comment out that server's IP in config.php whenever you take it offline.
Ahhh that makes sense, I suppose that would work then. I was also just thinking of creating a new domain specifically for the MySQL database and then just put that one single domain in the config.php then use DNS to round robin the IP Addresses.

But so the script you provided should work just fine with all the connections working then correct? vBulletin will then round robin all of the addresses that I put in that array correct?

Quote:
Originally Posted by Angel-Wings View Post
Thanks for ignoring me but still mysqlproxy can do exactly what you're looking for
Sorry but your post wasn't really all that specific on how this could help my situation. You simply just said I should read the MySQL documentation but didn't specify what exactly I should be looking for. Hence the reason for my paying attention to Dismounted's posts as he has given me something to work with
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:34 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05129 seconds
  • Memory Usage 2,268KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (6)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete