Edit

Share via


Configure replication with nondefault ports (SQL Server Linux)

Applies to: SQL Server on Linux

You can configure replication with SQL Server on Linux instances listening on any port configured with the network.tcpport mssql-conf setting. The port needs to be appended to the server name during configuration if the following conditions are true:

  • Replication set-up involves an instance of SQL Server on Linux
  • Any instance (Windows or Linux) is listening on a nondefault port.

The server name of an instance can be found by running @@SERVERNAME on the instance. Don't use the IP address instead of the server name. Using the IP address for the publisher, distributor, or subscriber might result in an error.

Note

Creating SQL Server replication on Linux with nondefault port will only work with SQL Server 2019 and above.

Examples

Server1 listens on port 1500 on Linux. To configure Server1 for distribution, run sp_adddistributor with @distributor. For example:

EXECUTE sp_adddistributor @distributor = 'Server1,1500';

Server1 listens on port 1500 on Linux. To configure a publisher for the distributor, run sp_adddistpublisher with @publisher. For example:

EXEC sp_adddistpublisher @publisher = 'Server1,1500' ,  ,

Server2 listens on port 6549 on Linux. To configure Server2 as a subscriber, run sp_addsubscription with @subscriber. For example:

EXEC sp_addsubscription @subscriber = 'Server2,6549' ,  ,

Server3 listens on port 6549 on Windows with server name of Server3 and instance name of MSSQL2017. To configure Server3 as a subscriber, run the sp_addsubscription with @subscriber. For example:

EXEC sp_addsubscription @subscriber = 'Server3/MSSQL2017,6549',  ,

Known issues

Linked server port not updated when recreating subscription

When you delete and recreate a subscription with a nondefault port on the Subscriber, the system reuses the existing linked server but fails to update the port configuration. This can cause replication to fail when attempting to connect to the Subscriber.

For more information about this known issue, including symptoms, cause, and workaround, see Delete a push subscription.