Using NFS on Oracle Cloud
You may want to set up an NFS mount for your OCI instances. This is especially helpful if you have multiple origins and want to use the
append record functionality, as it allows the client to republish against any origin and resume the same stream recording. For more information on Oracle NFS, refer to the OCI File Storage documentation.
Mount target limitations (reference):
Each mount target can accept up to 100,000 NFS client connections.
If you use in-transit encryption, each mount target can accept up to 64 NFS/SSL client connections. See Using In-transit Encryption for more information.
By default, you can create two mount targets per account per availability domain. See Service Limits for a list of applicable limits and instructions for requesting a limit increase.
Before mounting a file system, you must configure security rules to allow network traffic to and from the mount target. You can set up security rules in subnet security lists, network security groups, or by using a combination of both. It's easiest to create the Network Security Group first and choose that for the Mount Target when you create the FileSystem.
Stateful ingress to TCP ports 111, 2048, 2049, and 2050, and UDP ports 111 and 2048.
Stateful egress for TCP source ports 111, 2048, 2049, and 2050, and UDP source port 111.
- From the OCI dashboard, select Storage, File Storage, and then File Systems.
- Make sure to select the Compartment where your autoscale environment is configured.
- Click on Create File System
- Give your filesystem a name that helps you organize it. For example, if you are setting this for a specific autoscale environment use that environment name as a reference. The default properties are fine, and a mount target will be created in conjunction with the new filesystem.
- Select the subnet where your autoscale nodes and stream manager reside, and choose the network security group that you created above.
- Click on the Create button. It will take a few minutes for the new filesystem and mount target to be generated.
- Install NFS
sudo apt-get install nfs-common(this may already be installed on your Ubuntu image)
- Create the mount point directory. In most cases, you'll want to mount the NFS drive on the
streamsdirectory of the webapp you're using, for example,
sudo mkdir -p /usr/local/red5pro/webapps/live/streams
- Mount the filesystem:
sudo mount 10.0.0.39:/AutoScaleTestFileSystem /usr/local/red5pro/webapps/live/streams
- To verify the mount is present, type
df -hto list out all of the mounted filesystems. You should see something like this:
10.0.0.39:/AutoScaleTestFileSystem 8.0E 0 8.0E 0% /usr/local/red5pro/webapps/live/streams
After you've verified that you can mount the drive from your instance, create a script to execute the mount, and then a cron job to run on startup. If you want to remove the NFS mount to test the below script, use the
Replace the mount point value below with yours:
#! /bin/bash nfs_mount_point=10.0.0.39:/AutoScaleTestFileSystem nfs_directory=/usr/local/red5pro/webapps/live/streams sudo mount $nfs_mount_point $nfs_directory
Save the above script as
nfsmount.sh and make executable
chmod +x nfsmount.sh
crontab -e to bring up the cron editor, then select the editor of your choice.
Add to the bottom of the cron file:
Try rebooting (
sudo restart -n) to verify that the cron job and script work. After the server restarts, log back in and run
df -h to list the filesystem mounts.