Distributed architecture: multiple transcoding servers and one storage or playback server
This tutorial applies to both Pure theoneffmpeg and Advanced express-ffmpeg-vip. Build this distributed architecture for load balancing, or transcode on inexpensive high-performance machines while providing playback from a lower-spec server with large disks and high bandwidth.
Principle
mongodb was designed for distributed architecture. Its automatically generated OBJECTID is crucial: an ID such as 5d6de52360e715be825959dd contains 24 letters and digits, including a timestamp and server ID. This makes each OBJECTID unique, even when different machines generate them simultaneously, avoiding ID conflicts and enabling this architecture.
Diagram

Steps
Step one: Install Pure theoneffmpeg or Advanced express-ffmpeg-vip on transcoding machines one through four. Use the same installation directory everywhere, such as /www/express-ffmpeg.
Step two: Download the mc client on every transcoding machine. It connects to Amazon S3, minio and google cloud storage.
cd /~
wget https://dl.min.io/client/mc/release/linux-amd64/mc
chmod +x mc
./mc --help
Step three: Install MINIO on the storage or playback server. The minio distributed object-storage system makes a server an object-storage service immediately.
Step four: Configure synchronization on the transcoding servers to automatically copy existing and future segments to storage. Without self-hosted MINIO (step three), Amazon S3 or Google Cloud Storage works equally well.
Example: MinIO cloud storage
Obtain the URL, access key and secret key from MinIO.
./mc config host add minio http://192.168.1.51 BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 S3v4
Example: Amazon S3 cloud storage
Refer to AWS Credentials for your AccessKeyID and SecretAccessKey.
./mc config host add s3 https://s3.amazonaws.com BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 S3v4
Example: Google cloud storage
Refer to Google Credentials Guide for your AccessKeyID and SecretAccessKey.
./mc config host add gcs https://storage.googleapis.com BKIKJAA5BMMU2RHO6IBB V8f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 S3v2
Create a bucket in minio, Amazon S3 or Google storage, such as expressffmpegvip.
Configure the synchronization directory and run it in the background. For four servers running Advanced, the segment directory is /www/express-ffmpeg/public/videos.
./mc mirror -w --older-than 1h /www/express-ffmpeg/public/videos minio/expressffmpegvip &
This command synchronizes local /www/express-ffmpeg/public/videos, continuously watches changes, and copies them to the expressffmpegvip bucket on the minio server. It only synchronizes content older than 1 hour.
Why delay by 1 hour? If a newly sliced m3u8 synchronizes immediately, its M3U8 may contain only one TS entry. A delay improves synchronization.
The distributed architecture, with multiple transcoding servers feeding one storage or playback server, is now complete.


