First step to our dream of a highly available PI system is installing the first AF server. In
this video we'll be installing AF on PISRV01 with a remote SQL database as its backend.
Our database hosted on PISQL01. This is a very common configuration. There’s a fair
few extra steps than our local SQL server installation like we did in the basis class.
When we install AF on PISRV01 we'll be choosing a few different options. We'll choose to install
the SQL scripts but not run them. This copies a set of SQL scripts to the hard drive on PISRV01,
everything we need to set up an AF SQL backend. We'll tell PISRV01 that its AF backend is PISQL01
SQL express but not to validate it yet. After it installs, we'll copy the scripts over to PISQL01
and then run them on the server itself. Now in real life you may or may not be the person that
actually runs these scripts on the SQL server. It's common for a database admin or dba to run
these scripts instead of you. We're going to run these scripts ourselves and see what they do.
So, they do a few things they create and set up a database called PI FD on the SQL server
and also configure security so a local group has access to the database. But in the real world
it's very common to run this without admin access and the script is unable to create
the local groups it needs. We're going to run it and configure security manually. So,
we're going to give the service account that's running the AF server the permissions it needs
on the new PI FD database on the SQL server. Again, we're on PISRV01 and we're going to install
asset framework. So, let's open up PI install kits
and run the PI server installer. So right click, run as administrator.
Now PI data archive is already installed on this machine. We're going to run the installer again to
add the asset framework feature on it as well. So here I’m going to modify the installation
and going to select asset framework server. Now don't worry about notifications or
analysis. Our PISRV02 is going to be our notifications and analysis server later.
We're going to leave everything at defaults and we're going to change some settings here.
So, our SQL server connection, it isn't a local SQL server connection,
it is on PISQL01 and has a server name of SQLexpress.
We would like to install the scripts, but we do not want them to be executed. So, deselect that.
Another option has become available now. We do not want to validate the connection yet
because during installation the SQL server won't be ready for us. We're going to go next here.
We need to select a certificate for the RTQP service. We covered this in the basics course,
we need an SSL certificate already created for us. This has been supplied to us by our IT department.
Next, we need to type in service account names. Now we're using the same service
account names as the basics class, and we are using group managed service accounts here.
We check through the features that are going to be changed and we click modify.
Right, looks like we're done. Okay now let's see what it's installed.
I’m going to navigate into PI system d: drive and inside the program files directory, inside PIPC,
everything that isn't the PI data archive tends to go in the PIPC folder and inside asset framework
AF this SQL folder. This SQL folder contains the scripts we need to run on the SQL database.
I’m going to copy the SQL folder and then paste it in this shared folder directory.
After it's been copied into our shared folder, I’m going to navigate to PISQL01.
I'm going to open the shared folder here and copy over this SQL folder.
Okay, let's close this, open up the local copy of the SQL folder
let's see what's inside. The most important file for us
at least right here is this go.bat. This is the script we need to run that sets up the database.
We're going to go into a command line now and run this file.
So, cd desktop, cd SQL and I’m going to type in go.bat.
We haven't provided it with everything it needs to run, so it tells us what we need to input.
So, it says go.bat. We're not going to use any optional parameters here.
We're going to type in the name of the database here. Our db server is going to be PISQL01 slash
SQLexpress. Our database name is going to be PIFD and I always recommend you type in PIFD as the
database name. For backwards compatibility reasons. Okay that's that. Let's run it.
Okay looks like it's done but there were some errors.
As I said before these errors are because we didn't run this as an administrator,
so we didn't have permission to create groups. So, let's go to this text file and here it is.
Here's our file and just because I know where the error is I’m going to search for it.
I know AF servers is the name of a group that it attempts to create, and it looks
like it's getting an error here. It tries to assign permissions to a local group called
PISQL01\AFServers and it can't find it. This is what you'll see in real life if
you try to run this script without admin rights, which most of the time you will be.
Okay let's fix this. So we're not going to fix this by creating local groups.
We don't really need to, we just need to change the permissions on the database itself.
So, let's close this and we're going to open up Microsoft SQL server management studio.
Okay and we're open. Opening SQL server management studio may or may not take
longer than installing the entirety of asset framework server but okay we're in finally. Now
we're going to connect and set up this security mapping.
Now here's our SQL server. If you're not familiar with Microsoft SQL server don't worry too much.
We're going to go step by step and configure access for our asset framework server to the
database we just set up with those scripts. Expand out security and right click on logins.
We're going to make a new login; we're going to search for the group managed service account
that we ran our asset framework server under. So, we'll change the locations.
We'll search the entire directory, and we'll change the object types to also search for
service accounts and the service account we're searching for is PISCHOOL\SVC-PIAF$.
And there we go. Now we need to configure a user mapping for this login. We're going
to click on user mapping on the left-hand side, we're going to check the box for PIFD
and we're going to give this AF query engine and AF server permissions. This gives it the
permission it needs to make changes to the PI FD database and be an AF server. Okay and with that
we can go and test it. So, I'm going to go back to PISRV01. I'm going to open up PI system explorer
and it says the AF server PISRV01 only contains the system configuration database.
This is good you can actually see that it contains a database. Great it works. Do we
want to create a user database at this time? Yes, let's name our database “development”
and okay. And it works. Now we have AF as a framework server with a remote SQL backend.
The steps we went through there are very close to what you would do in real life,
but most likely you would need a SQL database administrator to do everything we did on PISQL01.