Updated on 2024-04-11 GMT+08:00

Creating a Publication

What Is Publication and Subscription?

RDS for SQL Server provides publications and subscriptions. This function uses the replication technology to split data reads and writes as well as synchronize data between cloud databases and between cloud databases and on-premises databases.

Scenarios

To synchronize data from your instance to another one, you can use your instance as the publisher instance, configure a distributor for it, create a publication, and then add a subscriber for the created publication.

Figure 1 Topology

Constraints

  • Only one distributor can be configured for an instance. All publications of the instance use this distributor. Deleting a distributor will also delete the publications using this distributor.
  • RDS for SQL Server Web Edition instances cannot be used as distributors or publisher instances, but can be used as subscribers.
  • When you create a publication, the database name and publication name must be different from those of existing publications.
  • RDS for SQL Server supports only transactional publications.
  • If you add a subscription server other than RDS, the account used for logging to the server must have the sysadmin permission.
  • If you add an RDS subscription server, you can select a maximum of 10 destination databases at a time.
  • The floating IP address and port number of an instance with a publication or subscription created cannot be changed.
  • Chinese characters are not allowed in table names or field names on the publisher or subscriber.
  • If the primary node of the distributor fails, the publication and subscription link cannot be restored through primary/standby switchover.

Configuring a Distributor

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and a project.
  3. Click in the upper left corner of the page and choose Databases > Relational Database Service.
  4. On the Instances page, click the DB instance name.
  5. In the navigation pane, choose Publications & Subscriptions.
  6. On the Publications page, click Configure Distributor.
  7. In the displayed dialog box, select the current instance or another instance as the distributor, select I have read and understood this information, and click OK.

    Figure 2 Configuring a distributor

  8. View the configured distributor.

    Figure 3 Viewing a distributor

Creating a Publication

  1. On the Instances page, click the DB instance name.
  2. In the navigation pane, choose Publications & Subscriptions.
  3. On the Publications page, click Create Publication.
  4. On the displayed page, configure parameters and click OK.

    • Enter a publication name, select a publication database, and specify publication objects.
    • To set a filter for publishing tables/fields, click Set Filter.
    • To set project properties for publishing tables/fields, click Set Project Properties.
    • If you select Create Now for Full Snapshot, a full snapshot is triggered on the distributor immediately after the publication is created. If Create Now is not selected, a full snapshot is created when a new subscription is added. Data cannot be synchronized to the subscriber until the snapshot agent is initialized.
    • You can customize an incremental snapshot schedule by day, week, or month to generate incremental snapshots on the distributor.
    Figure 4 Creating a publication
    Figure 5 Setting project attributes

  5. View the created publication.

    Figure 6 Viewing a publication
    • To add a subscription for the publication, follow the instructions in Adding a Subscriber.
    • To view Latency for Data Changes and Transactions, click Monitor.
    • To modify tables or fields to be published and the incremental snapshot schedule, choose More > Modify Publication.
    • To delete the publication, choose More > Delete.

Adding a Subscriber

  1. On the Instances page, click the DB instance name.
  2. In the navigation pane, choose Publications & Subscriptions.
  3. On the Publications page, locate the created publication and click Add Subscription in the Operation column.
  4. Click Add Subscriber.
  5. On the displayed page, configure parameters and click OK.

    For details about the publisher and subscriber types supported by RDS for SQL Server, see Compatibility Between Publishers and Subscribers.

    If you select RDS for Server:

    • Select one or more RDS for SQL Server subscriber instances and destination databases, and click to synchronize the selected databases to the right box.

      Ensure that the publisher instance and subscriber instance can communicate with each other in the same VPC or through a peering connection between VPCs. If they are in different security groups, configure security group rules to allow access.

    • Select Push subscription for Subscription Type.
    • Select a synchronization schedule for data subscription. You can customize a schedule by day, week, or month.
    Figure 7 Adding an RDS subscriber

    If you select Others for Server:

    • Enter the subscriber name, subscriber IP address, port number, login username, and password, and specify destination databases.
    • Select Push subscription for Subscription Type.
    • Select a synchronization schedule for data subscription. You can customize a schedule by day, week, or month.
    Figure 8 Adding other subscribers

  6. Locate the created publication, click the number in the Subscribed Databases column to view the subscription details.

    Figure 9 Subscription details