Samethings
Samethings

Reputation: 31

Use 1 table in 5 mysql server and connect servers togther

hello this is my mysql table

table_clients

  client_id
  client_username (UNIQUE)
  client_password

now i want to get 5 servers and install mysql on each server and use this table on each 5 servers.

my question is: is there any way that all 5 servers connected to each other (by 1 request) and converted to 1 big server? i mean if there is one user with username (hiworld) in server 2, can not create it this user again in other servers !. (connect all 5 server with same table together and make them 1 big server) .. is it possible?

my queries are too big (2-3 bilion) and i want to share them between 3-4 servers but (make servers united) like when use 1 server )

Upvotes: 1

Views: 34

Answers (1)

M T Head
M T Head

Reputation: 1290

How to create linked server MySQL

"Cross Linked Servers" a functionality that exists on Ms Sql is the type of thing your looking for.

You would need to do some sort of insert trigger that checked to see if the name existed on the other server.

But this will be slow plus there is a risk of two servers getting the same name at the same time and allowing the insert because when it checked the other name was not already there.

No real good way of doing this. One idea may be to have only one master table for the table_clients. Make it a master to slave relationship. Any time you have to do an insert you insert to the master table/database, then copy that data to the slave instances. But you would still have to cross link the servers for this to work. What you are describing would require waiting on 5 servers to tell if the name has already been used. This way you only have to check on one server.

Upvotes: 1

Related Questions