Sql Server read and write separation

Summary: Don't blindly use read-write separation. Before considering read-write separation, you should first consider the horizontal cutting of caches such as (redius) and big data tables.

Based on 2-8, 20% of the operations are additions, deletions, and changes. 80% of the operations are investigations. In order to improve the efficiency of the database, you can establish the separation of sketches

Read-write separation is the operation to query the real-time library to synchronize the log of the main library from the library     

The log is not sql, but the record of operating the hard disk is less expensive to execute from the library again

The express version of sql server does not have the function of publishing services:  

 

Publishing service

1. Install sqlserer and create three libraries first

prerequisites

 

2. Right-click local release - "New release

This distribution server can choose other computers. I only have one computer to choose myself for now.

The next step

The snapshot folder is a folder that must be accessible to several databases.

Normally, each database is on a different computer in the same LAN

So don’t use the files on the C drive in this folder to prevent insufficient permissions 

So if several computers can access, set up a shared folder

 

Create a shared file: \\Pc201908021559\e

 

Set the address as shared folder--》\\Pc201908021559\e

Select the library to publish:

Then pop up the release type:

The following are the characteristics of various types: Internet projects are more suitable for the second type. The shortest lag time

Copy type

When to use...

Merge replication

  • There are a large number of subscribers.

  • The data is copied to the mobile user.

  • Frequently update the replicated data on the subscriber.

  • Data filtering is required so that the subscriber can receive data from different partitions.

For more information, see Overview of merge replication and How merge replication works .

Peer-to-peer transaction replication

  • Replication is used to improve scalability and usability.

  • The shortest lag time is required.

  • The data is not partitioned between subscribers.

  • Usually there is no conflict, but if there is, it will be detected.

For more information, see Peer-to-Peer Transactional Replication .

Transactional replication with update subscription

  • There are a small number of subscribers.

  • The copied data is usually read-only on the subscriber.

  • In most cases, the Subscriber, Distributor, and Publisher are all connected to each other (applicable to update subscription immediately).

For more information, see Updatable Subscriptions for Transactional Replication .

Click Next: In this step, our custom_master library does not have any content, so if an error is reported, let's add a table view. Stored procedure

Add table view stored procedure will not report this error

Then the next step until the snapshot proxy

 

Then: Click on Security Settings

 

custom_master is now finished publishing: right click on this publication to start subscription service

 

Subscription service

There are two modes of subscription:

  • Push
  • Pull

as follows:

Push subscription:

Follow-up has been the next step

Now open custom_second and find that there is already content:

Guess you like

Origin blog.csdn.net/qq_36445227/article/details/108889448