Hello,

I would first like to explain my current setup.

1) Nginx Server (A) which is the front-end proxy
2) Apache/MySQL (B) Serves the normal traffic and holds the databse.
3) Apache servers (x) x-servers are used to help shed the load. (nginx will channel the apache load to both servers but the same database on server B)

How do I go by setting up a MySQL Server which would be a clone of the database of server B and put it elsewhere so the MySQL doesn't get choked.

Basically, I want to have 2-3 servers which have the same thing to shed the load.

I hope someone understands this.

Thank you in advance!

Member Avatar for LastMitch

I hope someone understands this.

I don't understand.

Try not to used term Shedding Load it means saving money but in your case it means saving space?

You want all 3 server have the same amount of data in the database?

Money not an issue.
I have spare servers as well.

2x Dual Xeon, 16GB RAM, 1Gbit
2x i7, 16gb RAM, 1Gbit
and Single Xeon/i5 and others.

current setup can only hold so much visitors and the site goes dead/dead-slow on spikes.

Lets say:
Server A runs my site.
I want Server B and Server C to be same as A so the load gets divided and each server takes a 33.33% of the load so i can serve more people.

Now I've achieved the web server bit by using a nginx-frontend but I would like to do something similar with the database as well, so the server A is not the only one serving the DB but there are other servers in sync(up to the milli nilli second).

Member Avatar for LastMitch

have spare servers as well.

I don't think I ever seem data divided by 3 into 3 server by a COMMAND?

I mean I can provide a code just to copy data one database and transfer to another database.

This the code for it (people used this often):

https://www.digitalocean.com/community/articles/how-to-migrate-mysql-between-two-servers

For example this tutorial regarding about transfering (people also used this often too):

http://www.cyberciti.biz/tips/move-mysql-users-privileges-grants-from-one-host-to-new-host.html

Usually, you can used COMMAND to do transfers data but in your case I don't know if there is a COMMAND to divide the share load by 3.

You can read and try this:

https://www.simple-talk.com/sql/ssis/ssis-basics-using-the-conditional-split/

you can do a simple load balancing through a php script with a number of visitors per db server.
also u will need to setup a database replication.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.