High-energy front, takes a bit of patience, more pictures, see the note in wifi environment, traffic maxed not lose
Recently I learned about the configuration synchronization subscriptions SqlServer database, encountered a number of common problems, following the detailed configuration and process issues as a summary, hope to help a friend in need.
The experiments were carried out in local and cross-segment, the first local area network configuration, and then cross-segment configuration, on-demand viewing.
The following article content will be divided into two parts
table of Contents
First, by way of non-command-line configuration synchronization subscription
(1) experimental environment Description
(2) before the experiment preparation
(3) subscription settings
(4) Test synchronization subscription
Second, the Frequently Asked Questions Summary
Third, the summary
Body part
First, by way of non-command-line configuration synchronization subscription
(1) experimental environment Description
Experimental environment, both in the same local area network (inter-network and then explained in detail later) of the PC, there is a distribution server PC1, PC2 as subscriber
PC1
System: win10
Database version: SQL Server 2016
IP:192.168.0.62
Sqlserver Port: 1433
Computer Name: DESKTOP-Aaron1
Working Group: WORKGROUP
Username: SqlServer
PC2
System: win10
Database version: SQL Server 2016
IP:192.168.0.152
Sqlserver Port: 1433
Computer Name: DESKTOP-Aaron2
Working Group: WORKGROUP
Username: SqlServer
(2) before the experiment preparation
Check a few settings, which is key to the success of the experiment, PC1 and PC2 have the same configuration.
a. An sharing
Open Network and Sharing Center> - - Computer icon on the taskbar, right> Change advanced sharing settings
Open sharing in Advanced sharing inside
b. 1433 firewall to open port
Open the Control Panel, select System and Security
Open the Advanced Settings Firewall settings
Create an inbound rule
Click New Rule -> port
Port -> Fill open port number
Fill open port number -> Select Allow connection
All the following default on it
c. Configuration Manager to set TCP / IP enabled
Open the SQL Server 2016 Configuration Manager, Network Configuration -> Protocols -> TCP / IP open
Select the TCP / IP right "property" in the Enabled property in the corresponding set ip 192.168.0.152 is "yes", the default port number 1433
d.Sql Server Browser service open
If no other database servers within the LAN in SSMS tool, you can turn on this feature
e. two machines have the same account (user name and password to be consistent)
In the two machines I built an identical account name and password of an account
f. Add windows accounts database access
Open the windows above SSMS add new accounts SqlServer
g. Open Database allow remote connections
Open the database in SSMS allow remote connections
h. Test whether the network connection is successful
This is the most critical step, also subscribe to the following premise synchronous operation, cmd to open a command window (windows + R, type cmd carriage return).
First use the ping command to test the network connection if there are problems (PC1 and PC2 ping test should be whether the exchange)
Even if the ping operation succeeds, only shows the LAN memory in this machine, nor can synchronize, but also to test port is available.
Use the telnet command to test whether the port is available telnet 192.168.0.62 1433
This window is represented by the emergence of
(3) subscription settings
PC1 has created a new database Test1, which has a table Test1 Table_1, Table_1 inserted a few test data, the backup copy of the database Test1 to restore the machine PC2.
Configure PC1 as the distribution server
Open the copy of the database -> Local Publications, right-New Publication
The following steps in the screenshots, here's publication database selected is a test Test1, our experiment is to take the PC1 Test1 database synchronization to the database Test1 PC2.
Select the table you want to publish, later can also add new tables.
For convenience the test data, click on the "Change" button, set the synchronization frequency is 10 seconds.
Next. Select "Run under the following windows account", fill in the PC1 machine windows account (here to fill in the domain \ account), using the Publisher connection sa account. (Here, select "Run in sqlserver proxy account" tested also possible)
As a subscriber to configure PC2
Set on the distribution server subscription can also be performed on the subscriber, the result is the same, where we set up at the distributor
Right local subscription, the new subscription
Select PC1 machines that were released task server
Next, there are two options, this experiment is a push subscription in the distribution server is running, the first option
Next, click on the "Add Subscriber", select the server name is the name PC2 machine, using windows authentication, where the reasons we are able to connect the two machines have the same user name and password, but also to be configured in the above description For the same reason windows account (where you can also use the account to log database)
To subscribe to a database Test1 on PC2 machine
Next, set the subscription properties
Select "Run under the following windows account", fill in the PC1 machine windows account, because we distribute at the Publisher.
Set the default back on the line
(4) Test synchronization subscription
Current Test1 database table contents of PC1
We insert a few data
View database Test1 PC2 machine table data has not changed
Detailed contents can also view the synchronization status information, select the Subscriber right to view the synchronization status.
Click the "Monitor"
There are state agents
The status bar view can double-click on the right table of various parameters of the synchronous
Subscribe to this synchronization function test is completed.
Second, the Frequently Asked Questions Summary
Other SqlServer database within (1) can not search local area network
First, check to see if a network problem, whether to open the network discovery, specifically to see before the above experiment preparation.
(2) when the question subscription class can not access the file
The rights issue is access to the file, add the appropriate permissions can not access the file in the windows inside. Here encountered is unable to access the snapshot files.
(3) inter-network configuration publish-subscribe
As the company's two servers not on the same network segment, so the above configuration is unsuccessful, where the difference in it?
Scene reconstruction:
PC1: Publisher
IP:10.33.1.222
Mask: 255.255.254.0
PC2: Subscribers
IP:10.24.0.100
Mask: 255.255.248.0
First, determine whether the two machines communicate, what else is no good. Use the ping command to ping each other that, if no problem then use the telnet test port is available telnet 10.248.22.100 1433, after confirming no problem, no problem is found connected ah, and then directly use IP as the database login name:
The results reported wrong to use the database instance name login, login is not tested before on the use of the name, because the root of the problem is not on the same network segment, network discovery opens the correspondence could not find the name of the machine. That our own specify the name of the corresponding IP addresses thousand million. good ~
\ Find Windows \ under System32 \ drivers \ etc directory hosts file, configure the subscription server ip address and database instance name, so that the publisher can not be found Subscriber instances of the same segment: the publishing server C.
Third, the summary
This is the end of the configuration process encountered a lot of problems, most of the online tutorial is not detailed enough narrative, meet a lot of pits, or to be more hands-cause of the problem more than look, step by step to solve them, and ultimately to be harvested.
----------------
Disclaimer: This article is CSDN blogger "starry -" original article, follow the CC 4.0 by-sa copyright agreement, reproduced, please attach the original source and link this statement.
Original link: https: //blog.csdn.net/u012861467/article/details/76411216/