5.3.1. Using 1C:Enterprise language to access server clusters
5.3.1.1. Via COM connection
The API of 1C:Enterprise server cluster administration is described in Syntax Assistant. To find the description, go to Integration and administration tools –COM connection manager – Server cluster administration.
You can use this feature only if 1C:Enterprise application administering the cluster:
- Runs on Windows.
- Has the same version as the administered server cluster?
Two objects are used for server cluster administration: ConnectServerAgent and ConnectWorkingProcess.
To get ConnectServerAgent, use the ConnectAgent() method of the COM connector object:
COMConnector = New COMObject("V83.COMConnector");
ConnectServerAgent = COMConnector.ConnectAgent ("TestSrv");Server agent connection is used to:
- Authenticate, add, delete, and get a list of main server administrators and cluster administrators.
- Create, delete, and get a list of clusters.
- Create, delete, and get a list of servers.
- Create, delete, and get a list of working processes of a cluster.
- Get a list of cluster services.
- Get a list of infobase sessions.
- Get a list of cluster connections.
- Get a list of infobase connections.
- Get a list of infobases registered in the cluster.
- Get a list of cluster locks.
- Get other information.
To get ConnectWorkingProcess, use the ConnectWorkingProcess() method of the COM connector object:
COMConnector = New COMObject("V83.COMConnector");
ConnectWorkingProcess = COMConnect.ConnectWorkingProcess ("TestSrv: 1562");Working process connection is used to:
- Authenticate infobase users.
- Create, delete, and get a list of infobases registered in the cluster.
- Get a list of infobase connections.
- Disconnect an infobase.
- Connect to an infobase (COM connection).
- Get other information.
5.3.1.2. Via server cluster administration server
The API of 1C:Enterprise server cluster administration using the administration server is described in Syntax Assistant. To find the description, go to Integration and administration tools – 1C:Enterprise server administration.
In 1C:Enterprise, you can administer any number of 1C:Enterprise server clusters using the administration server of 1C:Enterprise server clusters (ras).
Fig. 74. Administration via the administration server
As you can see in the picture, the overall administration algorithm looks as follows:
- A clients application is connected to any administration server.
- The selected administration server establishes connection to required server clusters.
The object model designed for administration server operations is similar to the command-line utility (rac) designed for the same purpose.
Considering this, administration is possible if:
- 1C:Enterprise application administering a server cluster can run on Linux, macOS, and Windows.
- Versions of 1C:Enterprise application (administering a server cluster), administration server, and server cluster do not have to match (considering administration server specifics).
- Control is possible both from the client application and server application sides.
- 1C:Enterprise client application where administrative operations are performed can process file infobases and be disconnected from the administered server cluster in terms of data.
The general procedure is as follows:
- Connection to an administration server is established.
- An administrator (if any) of the main server of the cluster is authenticated.
- The list of clusters available on selected main server is generated.
- An administrator (if any) of a specific cluster is authenticated.
- Administrative actions can be performed now.
You can find the most basic example of API usage below:
Agent = New ServerAdministration("localhost", 1545);
Agent.Authenticate();
Clusters = Agent.GetClusters();
For Each Cluster In Clusters Do
Cluster.Authenticate();
Infobases = Cluster.GetInfoBases();
For Each InfoBase In InfoBases Do
Message(InfoBase.Name + ", " + InfoBase.Description);
EndDo;
EndDo;See also:
- Server cluster administration server