-1

I am setting up a PHP application in 2 nodes and one DB server. Also setting cluster (with HaProxy) which will route traffic on least connections algorithm between both nodes.

The thing I am confused between is, how will I sync data of my applications? I do upload images on my applications daily, they are uploaded in local server only. (Please dont suggest to use CDN or something, strictly need to stick with local server)

Secondly, what about PHP sessions sync? How will that gonna work?

All this sync needs to be done in real time.

Questions is noob type, but I am new to all this cluster and nodes stuffs, your help will be appreciated.

Thanks

  • "Please dont suggest to use CDN or something, strictly need to stick with local server" It might help better suggest options to you if you explain *why*. – ceejayoz Apr 20 '20 at 19:19

1 Answers1

0

You must select shared storage for these appropriate to your environment.

For files, the main categories are network file shares, object storage, or databases.

  • File shares like NFS can be exported from storage arrays and mounted on multiple nodes.
  • Object storage have access APIs that are not traditional block or file based. Usually HTTP based. S3 is object storage.
  • Database blobs are data stuffed into some database system. Rather than an integer, the type is arbitrary data.

Sessions are tiny and not permanent. Simple key value stores, possibly in-memory, are great at that.

Some of these do not look like regular files. Your applications would need to make generic how they deal with storage.

Any of these can be replicated to another copy, as desired.

John Mahowald
  • 32,050
  • 2
  • 19
  • 34