Getting Started
Architecture
NServiceBus
Transports
Persistence
ServiceInsight
ServicePulse
ServiceControl
Monitoring
Samples

Replacing an Audit instance using Containers

Component: ServiceControl

This article describes how to replace an Audit instance with zero downtime when using containers. 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. Deploy a new Audit instance container with its own database container.

Add the instance to RemoteInstances

Next, modify the Error instance container by changing the REMOTEINSTANCES environment variable to include the new Audit instance's API URL. The value must be a JSON-encoded array containing objects that each have an api_uri value.

This example of a REMOTEINSTANCES value (as it would be used in a docker run command) shows two remote instances on the Docker internal network:

-e REMOTEINSTANCES='[{"api_uri":"http://audit-1:44444/api"},{"api_uri":"http://audit-2:44444/api"}]'

Disable audit queue ingestion on the old instance

Modify the old Audit instance container by specifying the INGESTAUDITMESSAGES environment variable with a value of false.

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:

  1. Adjust the REMOTEINSTANCES environment variable as described above except remove the old Audit instance URI from the collection.
  2. Remove the old Audit instance by stopping and removing the container, as well as the related database container.

Related Articles