4.3.3. On Windows
4.3.3.1. General information
This section explains how to start a second instance of 1C:Enterprise server on a computer.
TIP. It is recommended that you install the second instance of 1C:Enterprise server as an application, and not a Windows service. If necessary, you can register the server as a service later.
NOTE. You must be logged in as an administrator to register, unregister, start, or stop the cluster agent service (ragent). Privileges required for certain operations are checked and if they are not found, a request for elevation of privileges is created.
Please note that the installer does not allow changing server network ports, so a new server instance will not be able to function directly after installation.
The following examples assume that 1C:Enterprise server runs on an OS of the same bitness (a 32-bit server on a 32-bit OS, or a 64-bit server on a 64-bit OS). If you run a 32-bit 1C:Enterprise server on a 64-bit Windows, replace the C:\Program Files path with C:\Program Files (x86) in all examples in the following sections.
4.3.3.2. Auxiliary tools
The installer always changes the startup parameters of a single service of 1C:Enterprise server cluster.
1C:Enterprise does not have standard tools to register multiple instances of 1C:Enterprise server service. To register or unregister such instances, use the sc utility. When you register multiple instances of 1C:Enterprise server cluster operating in service mode, remember that all simultaneously running cluster instances must have different sets of network ports and different cluster directories.
4.3.3.2.1. Service registration batch file
The register-service.bat batch file (this name will be used in other sections of this documentation) that registers the server service might look as follows:
@echo off rem %1 – 1C:Enterprise full version rem%2 – first two digits of the port numbers. For ports 1540,1541,1560:1591, use 15. rem %3 – directory with cluster registry data set SrvUserName=<user name> set SrvUserPwd=<user password> set RangePort=%260:%291 set BasePort=%241 set CtrlPort=%240 set SrvcName="1C:Enterprise 8.3 Server Agent %CtrlPort% %1" set BinPath="\"C:\Program Files\1cv8\%1\bin\ragent.exe\" /srvc /agent /regport %BasePort% /port %CtrlPort% /range %RangePort% /d \"%~3\" /debug" set Description="1C:Enterprise 8.3 Server Agent" Parameters: %1, %CtrlPort%, %BasePort%, %RangePort%" if not exist "%~3" mkdir "%~3" sc stop %SrvcName% sc delete %SrvcName% sc create %SrvcName% binPath= %BinPath% start= auto obj= %SrvUserName% password= %SrvUserPwd% displayname= %Desctiption% depend= Dnscache/Tcpip/Tcpip6/lanmanworkstation/lanmanserver
Before you use this batch file, specify the data of a real user (name and password) on whose behalf the server cluster service will run (set SrvUserName= and set SrvUserPwd= strings). This batch file registers the specified version of 1C:Enterprise server. The service name is a string containing the following information:
- 1C:Enterprise 8.3 Server Agent
- Network port number of the main cluster manager
- Full version number of 1C:Enterprise
If you register a server whose version is 8.3.3.100 and main cluster manager port is 2540, the service name will look as follows: 1C:Enterprise 8.3 Server Agent 2540 8.3.3.100.
Example:
register-service 8.3.3.100 25 "c:\cluster_data\cluster 1" register-service 8.3.3.100 35 "c:\cluster_data\cluster 2"
In this example, the first string registers the server service with the following parameters:
- Service name: 1C:Enterprise 8.3 Server Agent 2540 8.3.3.100.
- Server ports:2540, 2541, 2560:2591.
- Directory with cluster registry data: C:\cluster_data\cluster 1.
- Service description:1C:Enterprise 8.3 server agent. Parameters: 8.3.3.100, 2540, 2541, 2560:2591.
The second string registers the server service with the following parameters:
- Service name: 1C:Enterprise 8.3 Server Agent 3540 8.3.3.100.
- Server ports: 3540, 3541, 3560:3591.
- Directory with cluster registry data: C:\cluster_data\cluster 2.
- Service description:1C:Enterprise 8.3 server agent. Parameters: 8.3.3.100, 3540, 3541, 3560:3591.
4.3.3.2.2. Service unregistration batch file
The unregister-service.bat batch file (this name will be used in other sections of this documentation) that unregisters the server service might look as follows:
@echo off rem %1 – 1C:Enterprise full version rem%2 – first two digits of the port numbers. For ports 1540,1541,1560:1591, use 15. set SrvcName="1C:Enterprise 8.3 Server Agent %240 %1" sc stop %SrvcName% sc delete %SrvcName%
Example:
unregister-service 8.3.3.100 25
This batch file stops and unregisters the service. The service name is generated according to the same rules as when registering a new (non-standard) 1C:Enterprise server service.
4.3.3.3. Running multiple servers with different 1C:Enterprise versions
4.3.3.3.1. As a service
To use server clusters of the same 1C:Enterprise version but configured for different parameters as a service on one computer, use the register-service.bat batch file.
Let's say we need to simultaneously execute server clusters of version 8.3.21.200. To do this, register the cluster services as follows:
register-service 8.3.21.200 15 "c:\cluster_data\cluster 1" register-service 8.3.21.200 25 "c:\cluster_data\cluster 2"
This example registers two server cluster services that use executable files of the same version (8.3.21.200) but use different parameters and different registered service names:
- 1st server cluster:
- Service name:1C:Enterprise 8.3 Server Agent 1540 8.3.21.200.
- Server ports: 1540, 1541, 1560:1591.
- Directory with cluster registry data: C:\cluster_data\cluster 1.
- Service description:1C:Enterprise 8.3 server agent. Parameters: 8.3.21.200, 1540, 1541, 1560:1591.
- 2nd server cluster:
- Service name:1C:Enterprise 8.3 Server Agent 1540 8.3.21.200.
- Server ports: 2540, 2541, 2560:2591.
- Directory with cluster registry data: C:\cluster_data\cluster 2.
- Service description:1C:Enterprise 8.3 server agent. Parameters: 8.3.21.200, 2540, 2541, 2560:2591.
4.3.3.3.2. As an application
To change network ports for 1C:Enterprise server started as an application:
- Shut down the running server instance by pressing Ctrl + C in the console window of the server.
- Go to the bin directory of the installed 1C:Enterprise 8.3 server. In this example, 1C:Enterprise 8.3.3.150 is used.
c: cd "c:\Program Files\1cv8\8.3.3.150\bin"
- Delete contents of the cluster registry directory. The directory location depends on how the installation of the 1C:Enterprise 8.3 server was performed.
rmdir /s /q "%USERPROFILE%\Local Settings\Application Data\1C\1cv8"
- Start 1C:Enterprise server with new network port values and other data.
ragent /port 3540 /regport 3541 /range 3560:3590 /d "d:\DbData\srvinfo"
In this example, the following port values are used:
- Number of server agent network port: 3540.
- Number of cluster manager network port: 3541.
- Port range for dynamic selection:3560:3590.
- Directory with cluster registry data: D:\DbData\srvinfo.
- To enable debugging mode for the registered service, add the /debug switch to the command line.
- At subsequent starts, use the startup command line the same way. For convenience, you can save it to a Windows batch file.
4.3.3.4. Running multiple servers with identical 1C:Enterprise versions
4.3.3.4.1. As a service
To use server clusters of several different 1C:Enterprise versions as a service on one computer, use the register-service.bat batch file.
Let's say we need to simultaneously execute server clusters of versions 8.3.20.100 and 8.3.21.200. To do this, register the cluster services as follows:
register-service 8.3.20.100 15 "c:\cluster_data\cluster 1" register-service 8.3.21.200 25 "c:\cluster_data\cluster 2"
In this example, the first string registers the server service with the following parameters:
- 1C:Enterprise version: 8.3.20.100.
- Service name:1C:Enterprise 8.3 Server Agent 1540 8.3.20.100.
- Server ports: 1540, 1541, 1560:1591.
- Directory with cluster registry data: C:\cluster_data\cluster 1.
- Service description:1C:Enterprise 8.3 server agent. Parameters: 8.3.20.100, 1540, 1541, 1560:1591.
The second string registers the server service with the following parameters:
- 1C:Enterprise version: 8.3.21.200.
- Service name:1C:Enterprise 8.3 Server Agent 2540 8.3.21.200.
- Server ports: 2540, 2541, 2560:2591.
- Directory with cluster registry data: C:\cluster_data\cluster 2.
- Service description:1C:Enterprise 8.3 server agent. Parameters: 8.3.21.200, 2540, 2541, 2560:2591.
4.3.3.4.2. As an application
You can start multiple server instances of the same version running as an application from the command line. In this case, not only network port numbers must be different in command-line parameters, but also cluster directory addresses.
start "Server 1" "C:\Program Files\1cv8\8.3.3.100\bin\ragent.exe" /port 2540 /regport 2541 /range 2560:2590 /d d:\ClusterData\Srv1 start "Server 2" "C:\Program Files\1cv8\8.3.3.100\bin\ragent.exe" /port 3540 /regport 3541 /range 3560:3590 /d d:\ClusterData\Srv2
In the example, two instances of 1C:Enterprise server are started with the following parameters:
- The first server has the Server 1 window header, serves network ports 25xx, and stores cluster data at D:\ClusterData\Srv1.
- The second server has the Server 2 window header, serves network ports 35xx, and stores cluster data at D:\ClusterData\Srv2.
4.3.3.5. Changing network ports used by a running 1C:Enterprise server instance
You cannot change network ports used by an already running instance of 1C:Enterprise server. If it is required, do the following:
- Create a new server instance with required network port values and other parameters.
- Register existing infobases on the new server.
- Transfer users to the new server.
- Stop and delete the old instance of 1C:Enterprise server (along with the cluster data).