ECP Connection to remote data server
Hello,
I work on deploying IRIS inside Docker container. I really like %Installer class can automate many steps. I want to establish an ECP connection to a mirror database and then define a remote database on the application server. I have already seen we can create local database and namespace in %Installer. What code is needed to establish ECP connection?
Classes:
I would recommend creating mirror manually, checking values in Config classes and moving from that.
Again, ICM can do that automatically. This is a preferred alternative.
Good morning Eduard,
I have looked at class documentations. Config.* classes are persistant, but I did not see the data server in there. I would use the classes to edit iris.cpf? I think I should check for this before starting the application IRIS container. I will look more into this soon.
Config package is a wrapper over CPF file.
You edit the objects of these classes and CPF file is edited automatically by Caché.
You can check in the CPF file where data server is defined and get the corresponding Config object.
WRC may provide more info I think.
You can do this with:
set props("Address") = serverAddr set props("Port") = serverPort set props("MirrorConnection") = 1 set sc=##class(Config.ECPServers).Create(ECPServerName,.props)
And
set props("Server") = ECPServerName set props("Directory") = ":mirror:"_mirrorName_":" _databaseName set sc=##class(Config.Databases).Create(databaseName,.props)
Then you need the Namespace created pointing to that remote database and that can be done via the %Installer (I've not found a way of doing the above with %Installer but you can call class methods for the above from %Installer):
<Namespace Name="${newNS}" Create="yes" Ensemble="0" Code="${SourceCodeNameSpace}"> <Configuration> <Database Name="${newNS}" Create="no" /> </Configuration> </Namespace
This looks like exactly what I was looking for. Thank you, Jeremy !!!
I was able to define ECP connection in Installer class that I run when I build docker image for my Docker IRIS application. Now I start to use Amazon ECS and Autoscaling. When a new instance is created and it runs the IRIS container, I want it to "register" as an Application server on the remote database server. What code can I execute to add an ip address as an Application Server?