Server upload in nodejs

1

a query, how would you do a server upload in nodejs, with a load balancer like nginx?

I give you this scenario.

Server A, Server B, the 2 with the same app running on a port, and balancing it with nginx, for example I have a form which will upload photos and different files, as well as some data, when they are saved, they are saved in a folder / upload with respect to the server where the request was made, then as in the bd I work with urls, there is no problem in bringing all the data, however my query goes more to the part of it is scalable to do it from that shape ? , I want to store all the uploads of the x servers that I have in only 1 server dedicated only to it, and serve it as static files, however, all that path from the server x to the server upload, I'm not sure how to do it, use ssh within node, to move the files? , or as you would do.

    
asked by Kevin AB 15.02.2017 в 17:30
source

1 answer

1

You can make servers that are not destined for upload mount a folder of the uploads server using NFS. This way all the files uploaded to any server are actually stored in the upload server.

NFS has its disadvantages too. In particular, writing to disk over an NFS folder will have more latency and lower speed than writing to a physical disk of the machine.

    
answered by 15.02.2017 в 17:51