Now that we have configured a
scheduled task to perform an automated daily backup of our PI Data
Archive to a dedicated drive on our PI Data Archive
machine, there is only one more thing
that we have to do for our backup plan. Even though we have our
backups currently being stored on the dedicated disk
drive, this will only protect them against hardware failure
in either the disk drive that holds our PI Data Archive or our archive files.
What would happen if we lost the entire
PI Data Archive machine itself? For this reason,
in addition to our automated backups on our separate
drive on our PI Data Archive machine, we should
also take a backup of our backup directory and store it on another
remote medium. This should be entirely separate
from our PI Data Archive machine. Again, this is to
allow for data recovery if the entire PI
Data Archive machine is lost. Additionally,
on the remote directory, we can create
a backup repository or a collection of various backups
at different restore points. To show you what that would look
like, I'm going to navigate to another
machine called KHolstein-Back which is a machine
solely for my backups. Here you can see
I have a collection of various PI Data
Archive backups on different dates. You may be wondering
why this is advantageous. Well consider the following,
what if you discover a configuration issue
two weeks after the fact? You've been taking your
automated daily backups on your PI Data Archive,
however it always goes to this same backup directory.
Therefore you do not have a backup from before the configuration change
occurred two weeks prior. On the other
hand, if you have a backup repository such as that shown
here, you would be able to find a backup from three weeks
prior that you could use to restore your PI Data Archives
configuration as the backup is from before
the configuration change happened.
As you can see within each of these files is a full
backup of my PI Data Archive from the date specified
in the directory itself.
Please note that is recommended that you use a 3rd party backup
tool to accomplish this as part of your
IT's backup process. Thus you should check with your IT department
first and see if they have a 3rd party tool
available to help copy your local backup directory from your PI Data
Archive to a remote location. However if your IT
department is unable to assist you with this, you can use the
same PISiteBackup.bat script that we saw in the previous
video which helped us include our PIPC directories in our automated
daily backups. So let's take a look at what that entails.
If I navigate back to my PI Data Archive
machine,
which in my case is KBHPISRV
I'm going to open up notepad
and select run it as administrator.
Then I can open
the PISiteBackup.bat script that we looked at in the previous video.
This is in my PI Data Archive installation directory.
Which by default is
C:Program FilesPI
Within the ADM folder, and right now
it's a .bat file. So if I change to all file
types and find my PISiteBackup.bat
Once I open this within notepad,
you can see the instructions for the script
itself.
Again we performed task one in the previous
video which was to include our PIPC directories in our automated
daily backup. So now we are going to focus on how to
perform task two, which is to backup
our intermediate backup directory to a remote location.
For task two, there are two different types of remote backups that we can do.
One is to take a full copy of our backup
directory each time the scheduled task runs and
append the date of that backup. This can be used
to create the backup repository that I just showed you on my
other machine with different restore points for your PI Data Archive.
The other option is to copy our backup directory
to the same directory every time. However
this will only keep one backup and thus not allow
us to restore from an older backup if necessary.
Now in order to perform the two different type of backups
for task two, we will
use either UNC path 1 or UNC path 2
to set our remote backup directory location.
So if we select UNC path 1, it
will call the backup routine, backup the backup
example 1. Where it says UNC path 2, we'll call backup the backup
example 2. If I take a look further down below,
I can find the particular subroutine.
So in this case, I found
backup the backup example 1. And
again, this copies our entire PI Data Archive backup
directory to a new directory on a remote location each
time the scheduled task runs.
This will place it in a subfolder
for the computer name and then the
date that the backup is run. Therefore this is used to create
a repository of our PI Data Archive backups.
If I do not want to store a new copy of my backup every time,
I can use backup the backup example 2.
Which in this, as you can see here, it copies
our backup directory to the same remote location every
time. And therefore we'll only have one copy of our
backup directory available on a remote node in the
event that our entire PI Data Archive machine is lost.
Since I'd like to create a repository
of my PI Data Archive backups, I'm going to use
backup the backup example 1,
and therefore set UNC path 1.
Before I can set my remote directory, I have to
choose a location where I'd like to store these backups remotely,
as well as ensure that the user running my automated
daily backup task has access to the remote directory and the
ability to write in that location. Therefore,
first I'm going to open up the Windows Task
Scheduler on my PI Data Archive
machine and take a look at my automated scheduled tasks
for my PI Data Archive backups.
Within the Task Scheduler Library,
I can see my PI Data Archive backup.
If I double click on it, it will let me edit
its configuration. By
default, it runs as your local system
account. However since I need the user running
my automated backup to have access to the remote
directory, I'm going to change this to a domain
account. You can either select a service
account that you've created or in my case, I'll just use
my domain account because I know it has
access to the remote directory I'm going to specify.
Similarly, I'm going to select
run with the highest privileges
as it's my administrative abilities that will give me access to my remote directory.
Once I select OK,
it will prompt me for the credentials for that account.
Now I can see that I've successfully
changed the user that will run my automated
task. In order to confirm that my user has access
to the remote directory, I'm going to navigate to my
remote machine. Again in my case,
this is my backup machine.
Here I have a dedicated drive for my
remote PI backups. And this is where I'm going to
store my backups.
If I right click on the directory I'd like to place my
backups and select
properties, I can confirm that within
security, the account that I specify to run my
scheduled task will have the ability to access and
write to this remote directory.
Now that I have confirmed that this user
can access the remote directory, I'll
navigate back to my PI Data Archive
machine and return to the notepad
where we have the PISiteBackup
script open. Now I can set the UNC path
for my remote backup directory by removing
the REM from the line to uncomment it.
And then specifying the computer name which in
my case is KHolstein-Back. And then the directory that I'd like.
So for me, this is on my
E drive in a folder called
PI Backups. Once I select save,
I can close the PISiteBackup.bat script.
And we can go test this now.
If I open up my Task Scheduler,
I can choose to run my automated backup
task now. And because we've specified
the UNC path for our remote backup location,
it will be included in the scheduled task.
So once I select run,
I can choose to display all running tasks
to watch the current status of my automated
task.
Once my scheduled task has disappeared
from my running tasks list, I'm going to
go and check the remote directory that we specified
for my remote backups. Therefore I'm going to
navigate back to my backup machine.
And within the location I specified,
which was my E drive, PI Backups.
I can see that a directory was created with the name of my
PI Data Archive. Within that,
there was another folder
created with the date that the automated task ran on.
And finally within that,
I can see the backup of my PI Data Archive was copied to
this remote directory. Now not
only will my data be safe in the case of hardware failure
on the drive that holds my PI Data Archive or my
archive files themselves. So now I'm protected
against an entire machine failure for my PI Data Archive,
since I have my backups copied to a remote
location. Now that we have our full backup procedure
in place, we can talk about how to monitor
and check the status of your backups in the next video.