Skip to content

Quick Start

David Wiseman edited this page Apr 23, 2024 · 7 revisions
  • Review the Prerequisites

  • Extract the application binary files.

    e.g. C:\sql-log-shipping-service

  • Configure the service using commandline options.

Examples:


UNC Path example:

LogShippingService.exe --Destination "Data Source=LOCALHOST;Integrated Security=True;Encrypt=True;Trust Server Certificate=True" --LogFilePath "\\BACKUPSERVER\Backups\SERVERNAME\{DatabaseName}\LOG"

Note: A trailing backslash \ character would be treated as an escape character for the ". A trailing forward slash is OK for Azure blob paths.

Azure blob example:

LogShippingService.exe --Destination "Data Source=LOCALHOST;Integrated Security=True;Encrypt=True;Trust Server Certificate=True" --LogFilePath "LOG/SERVERNAME/{DatabaseName}/" --SASToken "?sp=..." --ContainerUrl "https://your_storage_account.blob.core.windows.net/your_container_name"

S3 Example:

LogShippingService.exe --Destination "Data Source=LOCALHOST;Integrated Security=True;Encrypt=True;Trust Server Certificate=True" --LogFilePath "s3://<bucket>.s3.<region>.amazonaws.com/BackupFolder/{DatabaseName}/LOG" --FullFilePath "s3://<bucket>.s3.<region>.amazonaws.com/BackupFolder/{DatabaseName}/FULL" --DiffFilePath "s3://<bucket>.s3.<region>.amazonaws.com/BackupFolder/{DatabaseName}/DIFF" --AccessKey "your_access_key" --SecretKey "your_secret_key"

ℹ️ AccessKey & SecretKey can be omitted to use instance profile.


Use LogShippingService.exe --help to see all the available options and review the associated documentation on this wiki. You can omit any options you don't want to configure/update.

⚠️Options are CASE sensitive

The configuration options are stored in the appsettings.json file. You can also edit the json file directly to configure the service, but using the CLI is recommended.

  • Review the initialization section if you want this tool to restore your full/diff backups to initialize log shipping. This can also automatically add any new databases to your log shipping configuration.

  • Install as a service (optional)

    Note: If you execute LogShippingService.exe without any parameters it will run as a console application

    To install as a service, use sc create (Change the binpath as required.): Group Managed Service Account example:

    sc.exe create "LogShippingService" binpath="C:\sql-log-shipping-service\LogShippingService.exe" start=delayed-auto obj=DOMAIN\LogShippingGMSA$

    Regular Domain User example:

    sc.exe create "LogShippingService" binpath="C:\sql-log-shipping-service\LogShippingService.exe" start=delayed-auto obj=DOMAIN\LogShippingUser password=YourPasswordHere

    You can omit obj and password to run as LocalSystem, but it's recommended to use a domain account for Windows authentication.

  • Start the service

    net start LogShippingService

  • Review the log

    The Logs folder contains a log of what the service is doing.

Clone this wiki locally