Note: Development and Testing purposes only. Not supported in production environments.
Link to other containerization articles
PI Data Archive 2018 has been released on 27 Jun 2018! It is now time for us to upgrade to experience all the latest enhancements.
Legacy subsystems such as PI AF Link Subsystem, PI Alarm Subsystem, PI Performance Equation Scheduler, PI Recalculation Subsystem and PI Batch Subsystem are not installed by default. These legacy subsystems mentioned above will not be in the PI Data Archive 2018 container because of the command line that I have chosen for it. This upgrade procedure assumes that you were not using any of these legacy subsystems.
We also have client side load balancing in addition to scheduled archive shifts for easier management of archives. Finally, there is the integrated PI Server installation kit which is the enhancement I am most excited about. The kit has the ability to let us generate a command line statement for use during silent installation. No more having to comb through the documentation to find the feature that you want to install. All you have to do is just use the GUI to select the features that you desire and save the command line to a file. The command line is useful in environments without a GUI such as a container environment.
Today, I will be guiding you on a journey to upgrade your PI Data Archive 2017R2 container to the PI Data Archive 2018 container. In this article, Overcome limitations of the PI Data Archive container, I have addressed most of the limitations that were present in the original article Spin up PI Data Archive container. We are now left with the final limitation to address.
This example doesn't support upgrading without re-initialization of data.
I will show you how we can upgrade to the 2018 container without losing your data. Let's begin on this wonderful adventure!
Create 2017R2 container and inject data
See the "Create container" section in Overcome limitations of the PI Data Archive container for the detailed procedure on how to create the container. In this example, my container name will be pi17.
docker run -id -h pi17 --name pi17 pidax:17R2
Once your container is ready, we can use PI SMT to introduce some data which we can use as validation that the data has been persisted to the new container. I will create a PI Point called "test" to store some string data.
We will also change some tuning parameters such as Archive_AutoArchiveFileRoot and Archive_FutureAutoArchiveFileRoot to show that they are persisted as well.
Take a backup
Before proceeding with the upgrade, let us take a backup of the container using the backup script found here. This is so that we can roll back later on if needed.
The backup will be stored in a folder named after the container.
Build 2018 image
1. Get the files from elee3/PI-Data-Archive-container-build
2. Get the PI Server 2018 integrated install kill from techsupport website
3. Procure a PI License that doesn't require a MSF such as the demo license on the techsupport website
4. Your folder structure should look similar to this now.
5. Run build.bat.
Upgrade from 2017R2 to 2018
Now that we have the image built. We can perform the upgrade. To do so, stop the pi17 container.
docker stop pi17
Create the PI Data Archive 2018 container (I will name this pi18) by mounting the data volumes from the pi17 container.
docker run -id -h pi18 --name pi18 --volumes-from pi17 pidax:18
Now let us verify that the container named pi18 has our old data and tuning parameters and also let us check its version. We can do so with PI SMT.
Data has been persisted!
Tuning parameters has also been persisted!
Version is now 3.4.420.1182 which means the upgrade is successful. Note that the legacy subsystems that were mentioned above are no longer present.
Congratulations. You have successfully upgraded to the PI Data Archive 2018 container and retained your data.
Now what if you want to rollback to the previous version for whatever reasons? I will show you that it is also simple to do. There are two ways that we can go about doing this.
|Restore||Will always work||Data added after the upgrade will be lost after the rollback. Only data prior to the backup will be present. Requires a backup|
|Non-Restore||Data added after the upgrade is persisted after the rollback||Might not always work. It depends on whether the configuration files are compatible between versions. E.g. it works for 2018 to 2017R2 but not for 2015 to earlier versions|
We will explore both methods in this blog since both methods will work for rolling back 2018 to 2017R2.
In this method, we can remove pi17, recreate a fresh instance and restore the backup. In the container world, we treat software not as pets but more like cattle.
docker rm pi17 docker run -id -h pi17 --name pi17 pidax:17R2 docker stop pi17
Copy the backup folders into the appropriate volumes at C:\ProgramData\docker\volumes
docker start pi17
Now let us compare pi17 and pi18 with PI SMT. We can see that they have the same data but their versions are different.
In this method, data that is added AFTER the upgrade will still be persisted after rollback. Let us add some data to the pi18 container.
We shall also change the tuning parameter from container17 to container18.
Now, let's remove any pi17 container that exists so that we only have the pi18 container running. After that, we can do
docker rm -f pi17 docker stop pi18 docker run -id -h pi17 --name pi17 --volumes-from pi18 pidax:17R2
We can now verify that the data added after the upgrade still exists when we roll back to the 2017R2 container.
In this article, we have shown that it is easy to perform upgrades and rollbacks with containers while preserving data throughout the process. Upgrades that used to take days can now be done in minutes. There is no worry that upgrading will break your container since data is separated from the container. One improvement that I would like to see is that archives can be downgraded by an older PI Archive Subsystem automatically. Currently, this cannot be done. If you try to connect to a newer archive format with an older piarchss without downgrading the version manually, you will see
However, the reverse is possible. Connecting to an older archive format with a newer piarchss will upgrade the version automatically.