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 |
For more information, see Overview of merge replication and How merge replication works . |
Peer-to-peer transaction replication |
For more information, see Peer-to-Peer Transactional Replication . |
Transactional replication with update subscription |
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: