Jump to content

How to share information with two webserver


hno

Recommended Posts

HI,

I have two webserver and two domain and I want to share information between them.What I want to do is this to share the database between two webserver so ,if I add  new information through domain 'A' that information can can be catch from domain "B" and I have that information in domain 'B'.Also the files in one server should be share between two webserver so If I add a new file or make a change in it in domain 'A' it can be retrieve from domain 'B' an I can use it in there.

 

I apologize if it's not so clear .My English is not good.

 

Thanks

The database for the 2 servers can be a common database accessed by both. It can either be on one of the webserver machines, or on a completely separate machine. You need to ensure that the host part of the database connection string, is pointing to the machine on which the database resides.

The database for the 2 servers can be a common database accessed by both. It can either be on one of the webserver machines, or on a completely separate machine. You need to ensure that the host part of the database connection string, is pointing to the machine on which the database resides.

Can you give me more detail.How can I do so?

 

Thanks for your help

Ok, a normal set of connection variables looks like

 

$dbhost = 'localhost';

$dbuser = 'username';

$dbpass = 'password';

$dbname = 'databasename';

 

and you then call mysql_connect() and mysql_select_db() to connect to the database.

 

that is still fine for a webserver where the database server is running on the same machine.

 

If you wish to connect to a database server on another machine, you simply put the IP address of the server where the database is, in the host variable, replacing the word localhost.

 

So you get

$dbhost = '1,2,3,4';  where 1.2.3.4 is the IP address.

 

If the database is on a different machine to either webserver, which is quite common on busy sites, then both webserver machines will need to specify the IP address of the server containing the database server.

 

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.