Re: merging a table from multiple servers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Well,

I would do the following, lets assume some servers here :
Server1 - Your server
Server2 - Someone you want data from
Server3 - Another one you want data from

I would create a script which must be installed on every server you need
data from, call it generate.php for example. This script would pull out
all the data your would want to use on your site, format the the data
however youd like it, as a CSV file, MySQL queries or whatever.
Each generate script will write back to the file : batch.txt for example.
(Or it could spit out the results as you trigger the scrupt, but incase
there
are many servers you would encounter the 30second limit on PHP scripts).
For the case of argument we say that the generate.php script spits out
the results the way you want them.

What your server would need to do then would be the following :
You could use fopen to trigger each generate.php file like this from your
site :

--->
function fetchpage($page){
 $fd=fopen($page,"r");
 while ($line=fgets($fd,1000)) { $text.=$line; } fclose ($fd);
return $text;
}
$data2 = fetchpage('http://server2/generate.php');
$data3 = fetchpage('http://server3/generate.php');
--->

You now have all you need in $data and $data2, you would then
pull your own stats into $data1 and do whatever you like with this.
You could pump all the results into a new table for statistics, or
do it at once and present the result as a HTML.

You should also create a trigger or something for this script so that
it doesnt run on every pageload, maby once an hour or something.

I hope you got the the hang of it.

-- 
-- 
Kim Steinhaug
----------------------------------------------------------------------
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
----------------------------------------------------------------------
www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
----------------------------------------------------------------------

"Seth Bembeneck" <sbdataspiller@xxxxxxxxxxxxx> wrote in message
news:20040508140324.80901.qmail@xxxxxxxxxxxxxxx
> How would I generate the file?
> Make each record 1 line in the file?
>
> After the file is created, how do I download it?
>
> Thanks,
>
> Seth
>
> "Kim Steinhaug" <kim@xxxxxxxxxxxxx> wrote in message
> news:20040507214429.98012.qmail@xxxxxxxxxxxxxxx
> > I would imagine the best way would be a system that triggers a
> > script on the different serveres. This script creates a datafile
> > which you import with fopen and then you create the database
> > set you need to generate nice stats from.
> >
> > Else you would need the different servers to accept incoming
> > connections on their MySQL from your host, which I would think
> > would be alot of work to accomplish. Preparing datasets on the
> > different servers with a script sounds much more simple in my
> > opinion, after all this script will only be "updated" at given
> > intervals.
> >
> > -- 
> > -- 
> > Kim Steinhaug
> > ----------------------------------------------------------------------
> > There are 10 types of people when it comes to binary numbers:
> > those who understand them, and those who don't.
> > ----------------------------------------------------------------------
> > www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
> > ----------------------------------------------------------------------
> >
> > "Seth Bembeneck" <sbdataspiller@xxxxxxxxxxxxx> wrote in message
> > news:20040507050847.48400.qmail@xxxxxxxxxxxxxxx
> > > I'm trying to work on a project that gathers info from different
> servers,
> > > then combines them and displays it.
> > >
> > > Is it possble to merge the tables from the different servers into 1
> table
> > > using php?
> > >
> > > My one solution to this was to have a php script on each server, then
> have
> > > my website call each php script, retrieve the info then insert it into
> my
> > > database.
> > >
> > > For a glimps of the amount of data I'm trying to merge:
> > > http://cwhq.net/index.php?action=stats&mod=kill_stats_totals
> > >
> > > Now imagine 10 different servers with similer data.
> > >
> > > I'm trying to provide a way for Deltaforce Gamers to see their stat
from
> > all
> > > the game servers that collect the stats in 1 location.
> > >
> > > Thanks,
> > >
> > > Seth
> > >
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux