This article describes how to use the ServiceControl Management Utility to replace an Audit instance with zero downtime. For an overview of the process and details for other deployment scenarios, see Replacing an Audit Instance.
Add a new audit instance
First, a new audit instance must be created. If it is on the same machine, different ports must be specified. Deploying it on a separate machine is preferable, as the databases of each instance will not compete for the same resources.
- Open ServiceControl Management.
- Click New, then Add ServiceControl and Audit Instances.
- Uncheck the ServiceControl checkbox so that only an Audit instance will be installed.
- Configure the new Audit instance as desired, or to match the previous instance, except that new ports must be selected if deploying on the same machine.
- Click the Add button to create and start the new instance.
Add the instance to RemoteInstances
Then, the new Audit instance must be added to the Error instance's collection of remotes. This cannot be done in ServiceControl Management and must be done by editing the configuration file:
- Open ServiceControl Management.
- For the Error instance, click the Installation Path > Browse button to open the installation folder in Windows Explorer.
- Edit the ServiceControl.exe.config file.
- Edit the value of the
ServiceControl/
setting:RemoteInstances - The value is XML-encoded JSON containing an array of values, each having an
api_uri
value. - All JSON double-quotes (
"
) must be represented as"
. - Add the API URL of the new Audit instance to the value.
- Example with two
localhost
URIs on ports44444
and44446
:[{"api_uri":"http://localhost:44444/api/"},{"api_uri":"http://localhost:44446/api/"}]
- The value is XML-encoded JSON containing an array of values, each having an
- Save the file.
- In ServiceControl Management, stop and restart the Error instance for the changes to take effect.
Disable audit queue ingestion on the old instance
Configure the old audit instance so that it will no longer ingest new messages from the audit queue, making the instance effectively read-only:
- Open ServiceControl Management.
- For the old Audit instance, click the Installation Path > Browse button to open the installation folder in Windows Explorer.
- Edit the
ServiceControl.
file.Audit. exe. config - In the
appSettings
section, add a setting key forServiceControl/
with a value ofIngestAuditMessages false
. - In ServiceControl Management, stop and restart the Audit instance for the changes to take effect.
For versions 4.32.0 of ServiceControl and older use !disable
as the AuditQueue
name to disable the audit message ingestion.
Decommission the old audit instance
When the audit retention period has expired and there are no remaining processed messages in the database, you can decommission the old audit instance.
First, use the same instructions above to edit the Error instance's configuration file, but this time removing the old Audit instance URL from the ServiceControl/
setting.
Lastly, using ServiceControl Monitoring, stop and remove the old Audit instance.