How to pre-import files from Rsync daemon - Video CDN
How to pre-import files from Rsync daemon - Video CDN [EN]
This guide relates to Rsync.
Preparations
Before you begin, ensure you have access to a Linux server with root privileges.
This guide assumes the server is running Ubuntu 24.04. If you’re using a different distribution, adjust the steps accordingly.
For the purposes of this example, our vCDN Resource ID will be vcdn10000000.
Install the daemon
We’ll use the system user foo with the home directory /home/foo:
# connect to the server
ssh foo@origin-1.example.com
# install rsync daemon
sudo apt-get update
sudo apt-get install rsyncOnce installed, we can configure the daemon:
# make a folder for content
mkdir /home/foo/content
# configure daemon
sudo echo > /etc/rsyncd.conf <<EOF
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
[content]
path = /home/foo/content
comment = sample video content
uid = foo
gid = foo
read only = yes
list = yes
auth users = vcdn
secrets file = /etc/rsyncd.secrets
EOFHere, we define the [content] module, make it read-only, and require authentication using the vcdn user. Next, we create the authentication file /etc/rsyncd.secrets:
# configure authentication secrets
sudo echo > /etc/rsyncd.secrets <<EOF
vcdn:axT882LasxoA
EOF
# set secure permissions
sudo chmod 600 /etc/rsyncd.secretsNow restart the daemon and verify it’s running:
# we're ready, restart the service
sudo systemctl restart rsync
# check if the port is open
sudo netstat -atnp | grep rsync
# output will be like this:
# tcp 0 0 0.0.0.0:873 0.0.0.0:* LISTEN 1911/rsync
# tcp6 0 0 :::873 :::* LISTEN 1911/rsync
# let’s add a sample file to test the setup:
cd /home/foo/content
wget http://example.com/sample1.mp4Finally, confirm you can list files over rsync from the local host:
rsync -avzn rsync://vcdn@origin-1.example.com:873/content/ ./content/
# enter the password: axT882LasxoA
# output will be like this:
# Transfer starting: 2 files
# ./
# sample1.mp4
#
# sent 28 bytes received 105 bytes 1330000 bytes/sec
# total size is 1570024 speedup is 11804,60At this point, the origin server is ready.
Configuring files import from origin
Go to Resources.
Select the required resource
Then open the File Import tab and click Add new source:
In the dialog that appears:
Enter the rsync URL in the format:
rsync://<user>:<password>@<hostname>:<port>/<module>/.
For example:
rsync://vcdn:axT882LasxoA@origin-1.example.com:873/content/Click Add new source to save the configuration.
The CDN is starting importing files from the origin. This process can take several minutes: up to about 5 minutes for small and medium-sized files.
Check the result
You can watch on the rsync daemon log to see the import progress:
tail -f /var/log/rsync.log
Once the import is complete, the status will change to Active:
You can now fetch files via the CDN using your own domain or the system domain:
curl -vL http://vcdn10000000.blazingcdn2.net/sample1.mp4