Scenario:
You have decided to use the Ubiquiti UniFi Video NVR for a camera surveillance system. The NVR will be installed onsite where the cameras are located but you want a remote backup solution in the event that if the onsite NVR is stolen or destroyed you can still review the video surveillance footage to catch the person(s) responsible.
Requirements:
- (1 Local and 1 Remote) UniFi-Video Controller 3.1.1 or later running on Debian / Ubuntu (or AirVision-C NVR)
- Plenty of bandwidth between the local and remote backup location :-)
Preparation:
This blog assumes you already have an NVR and Cameras deployed (configured and recording). It is also assumed that both Local and Remote NVR are on the same LAN segment. You will need to have end to end connectivity for both Local and Remote NVR's which means they either need to be accessible to each other via Public IP or using a VPN tunnel which is not covered in this blog.
Local NVR IP Address: 192.168.1.30/24
Remote NVR IP Address: 192.168.1.40/24
If you wish to use nano for editing files you may need to install it first using sudo apt-get install nano
Step 1 - Login to your Local NVR:
Login to your AirVision-C NVR or Linux Machine which is running the UniFi-Video Controller via SSH (Windows Users can use PuTTY):
Step 2 - Update packages and install lsyncd on both Local and Remote NVR's:
sudo apt-get update; apt-get install lsyncd
sudo mkdir /var/log/lsyncd
touch /var/log/lsyncd/lsyncd.{log,status}
sudo mkdir /etc/lsyncd
sudo nano /etc/lsyncd/lsyncd.conf.lua
settings = {
logfile = "/var/log/lsyncd/lsyncd.log",
statusFile = "/var/log/lsyncd/lsyncd.status"
}
sync {
default.rsyncssh,
source = "/srv/unifi-video/videos",
host = "192.168.1.40",
targetdir = "/srv/unifi-video/videos"
}
Step 5 - Generate SSH Keys between the Local and Remote NVR to allow the Local NVR to login to the Remote NVR via SSH without prompting for a password:
Local NVR:
sudo ssh-keygen -t rsa
sudo ssh-cop-id root@192.168.1.40
Restart the lsyncd Service to initiate mirroring:
sudo service lsyncd restart
Testing:
By default data (recordings) will be synced to the remote NVR every 20 seconds. Generate some motion on your cameras and then perform a database synchronisation on the Remote NVR:
Settings > NVR Settings > Configure > Tools > Analyze
No comments:
Post a Comment