Old 1st December 2003, 23:43   #1
Fake667
Junior Member
 
Join Date: Jan 2003
Location: Van Buren AR
Posts: 6
Send a message via AIM to Fake667
Clustering multiple Servers

Hiya, ive got about 5 people who are wanting to help my Radio station with hosting, i would love it if i knew how to get all of them together like the big stations do, well down to the base question, how do i make all the servers a cluster?
Fake667 is offline   Reply With Quote
Old 2nd December 2003, 00:09   #2
FesterHead
Alumni
 
FesterHead's Avatar
 
Join Date: Sep 2001
Location: Maui, Hawaii
Posts: 14,108
Setup another DNAS (the other folks) and have it relay the main DNAS (yours).

From the DNASs sc_serv.ini/conf configuration file:
code:
; RelayPort and RelayServer specify that you want to be a relay server.
; Relay servers act as clients to another server, and rebroadcast.
; Set RelayPort to 0, RelayServer to empty, or just leave these commented
; out to disable relay mode.
; RelayPort=8000
; RelayServer=192.168.1.58



Set relayport of the secondary DNAS to the portbase of the main DNAS.
Set relayserver of the secondary DNAS to the ip of the main DNAS.

Also, don't forget to remove the comment designator ( ; ) from the front of both lines after making the changes then restart the DNAS.

FesterHead is offline   Reply With Quote
Old 2nd December 2003, 00:35   #3
Fake667
Junior Member
 
Join Date: Jan 2003
Location: Van Buren AR
Posts: 6
Send a message via AIM to Fake667
thx

Thanks, It worked, "now to move to about 5 servers" ^^
Fake667 is offline   Reply With Quote
Old 3rd December 2003, 00:16   #4
vnRock
Junior Member
 
Join Date: Dec 2003
Posts: 6
Send a message via AIM to vnRock Send a message via Yahoo to vnRock
festerhead
Do we need to change the these setting in relay server?
;PortBase=8000
;SourceIP=ANY

the main server I use port 272, the relay server I use port 8000, is that OK...

I see both server in the yp directory. How can we fix that?
vnRock is offline   Reply With Quote
Old 3rd December 2003, 00:34   #5
FesterHead
Alumni
 
FesterHead's Avatar
 
Join Date: Sep 2001
Location: Maui, Hawaii
Posts: 14,108
Leave SourceIP as ANY.

If the selected portBase is available, use it. Else, select another portBase. (remember both portBase and portBase+1 need to be free)

************************

Once relayed, the DNASs will [cluster] in the SHOUTcast yp. Give it a little time.

FesterHead is offline   Reply With Quote
Old 3rd December 2003, 22:06   #6
vnRock
Junior Member
 
Join Date: Dec 2003
Posts: 6
Send a message via AIM to vnRock Send a message via Yahoo to vnRock
Got it festerhead, thank. Now everything makes sense, "load balancing", "relay", "cluster" really make sense. I didn't get the load balancing to work. But I'll try more.
vnRock is offline   Reply With Quote
Old 10th October 2004, 03:54   #7
theravenz
Junior Member
 
Join Date: Oct 2004
Location: Melbourne Australia
Posts: 12
Alright, I found a script on this site somewhere, which i modified for my own site, so im going to post my modification here, You might see this script somewhere (thanks to whoever posted it - forgot who)

But anyways, it didnt have listener count on it, like the shoutcast.com cluster link did, so i pretty much made it identical to the cluster link, here it is

code:

<?
##Settings##

//Define all servers here (add more if needed)
$server_address[0]='65.75.186.30';
$server_port[0]=8400;
$server_title[0]='fuseRADIO 24/7 Mix';

$server_address[1]='67.19.102.78';
$server_port[1]=8010;
$server_title[1]='fuseRADIO 24/7 Mix';

$server_address[2]='67.19.102.78';
$server_port[2]=8012;
$server_title[2]='fuseRADIO 24/7 Mix';

//Set mode (either load_balancing, random, or new_random)
// $mode='load_balancing';
// $mode='random';
$mode='load_balancing';

##Settings complete##

if($mode=='random'){
mt_srand((double) microtime() * 1000000);
for($i=0; $i<count($server_address); $i++){
$server[$i]=mt_rand(0, count($server_address)-1);
for($j=0; $j<$i; $j++){
if($server[$j]==$server[$i]){
$i--;
break;
}
}
}

}
elseif($mode=='load_balancing'){
//This is really not a good way to do this since each request will
//query all the servers. It would be better to have a cache that is updated
//periodically (file or database) and just grab the current numbers from there,
//but since this is just something to go off of I will do it by contacting each
//server.
for($i=0; $i<count($server_address); $i++){
$fp = fsockopen($server_address[$i], $server_port[$i], $errnum, $errstr, 2);
if ($fp){
$buffer='';
fwrite($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Playlist Generator(Mozilla)\r\n\r\n");
while(!feof($fp)){
$buffer.=fread($fp, 1024);
}
fclose($fp);
$data=eregi_replace(".*<body>(.*)</body>.*", '\1', $buffer);

$numbers=explode(",", $data);

$lnr[$i]=$numbers[0];
$mx[$i]=$numbers[3];
$percent_filled[$i][0]=$numbers[0]/$numbers[3];
$percent_filled[$i][1]=$i;
}
else{
$lnr[$i]=$listen;
$mx[$i]=$max;
$percent_filled[$i][0]=1.1;
$percent_filled[$i][1]=$i;
}

}
sort($percent_filled);
reset($percent_filled);
for($i=0; $i<count($server_address); $i++){
$server[$i]=$percent_filled[$i][1];

}
}
elseif($mode=='new_random'){
//Doubt it is useful for this, but if you had a LARGE number of servers this would
//be faster since in the other random there are only as many random numbers as servers
//and technically you could get stuck in a for loop for a long time trying to get an unused
//random number. This method uses 1000 times the number of servers so the probability
//of getting repeats is much less meaning less time in the for loop that makes sure the
//random numbers are unique.
mt_srand((double) microtime() * 1000000);
for($i=0; $i<count($server_address); $i++){
$rand[$i][0]=mt_rand(0, (1000*count($server_address)));
$rand[$i][1]=$i;
for($j=0; $j<$i; $j++){
if($rand[$j][0]==$rand[$i][0]){
$i--;
break;
}
}
}
sort($rand);
reset($rand);
for($i=0; $i<count($server_address); $i++){
$server[$i]=$rand[$i][1];
}

}
else{
for($i=0; $i<count($server_address); $i++){
$server[$i]=$i;
}
}
$totall=$lnr[$server[0]]+$lnr[$server[1]]+$lnr[$server[2]];
$totalm=$mx[$server[0]]+$mx[$server[1]]+$mx[$server[2]];
$total_entries=count($server_address)+1;


header("Content-Type: audio/x-scpls");

echo("[playlist]\n");
for($i=0; $i<count($server_address); $i++){
$file=$i+1;
echo('File'.$file.'=http://'.$server_address[$server[$i]].':'.$server_port[$server[$i]].'/');
echo("\n");
echo('Title'.$file.'=(#'.$file.' '.$lnr[$server[$i]].'/'.$mx[$server[$i]].') '.$server_title[$server[$i]].'');
echo("\n");
echo("Length$file=-1\n");
}
echo("File4=http://hmmm:8743/");
echo("\n");
echo("Title4=Current total listeners (".$totall."/".$totalm.")");
echo("\n");
echo("Length4=-1\n");
echo("NumberOfEntries=$total_entries\n
Version=2\n");

?>



This is the script i use,
theres 2 copies of it of you guys wanna test it out, links should be in my sig, else here they are again :P

http://fuseradio.com.au/alt.pls
http://fuseradio.com.au/trance.pls

Have fun.
theravenz is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Shoutcast > Shoutcast Technical Support

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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