K
K
kiloper2016-02-10 06:30:34
System administration
kiloper, 2016-02-10 06:30:34

What is the best way to sync site files?

Good afternoon. There is a site with a large number of visitors. The site actively works with the database and with the disk system, writes files there from users. The time has come when one server was not enough. I installed a proxy nginx that distributes the load between two servers. BUT how do I sync files? A delay of a couple of minutes is acceptable, but real-time would be ideal.
Tell me, please, in which direction to dig? rsync? rsync ssh? nfs? What other methods can be applied in this situation?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lega, 2016-02-10
@kiloper

The time has come when one server was not enough.

What specifically is missing?
installed proxy nginx
Why load the "balancer" with double traffic, let the clients go directly to the second server.
You can also not synchronize, but scatter files across servers, even on the 1st server, odd on the 2nd, but it's better to make a server prefix in the id (name) of the file.
Thus, there will be disk savings and more efficient use of traffic.
There are pluses in simple duplication (your option):
1) The second server is like a backup if one of the servers dies, although there are better tools for backups.
2) If one server dies, then the service can * continue to work, but more slowly, and with "sharding" (option above), some of the content will not be available.
On the other hand, what will you do when there is not enough disk on the server?
Another option is to transfer files to S3
> would be ideal in real time.
In the place where you save the files, you can add something to save the file in the same way to the mounted server or via ssh.
If it is not possible to add, then you can make an external script that will "listen" to changes in the FS and react (copy to another server).
In such tools as GridFS, you can easily set up replication - there will be real time. But you can’t use it directly (you need to write code), so you can look for competitors.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question