Method for realizing automatic deployment of SQL Server database mirror mode
Technical Field
The invention relates to the technical field of cloud computing, in particular to a method for realizing automatic deployment of a mirror image mode of an SQL Server database.
Background
In the cloud computing era, the service cloud gradually becomes a trend, namely, various services are provided by a cloud computing platform, and a user can obtain the services provided by the cloud platform for use only by lightly clicking an application button without concerning the construction of the services and the configuration of the operating environment.
As a widely used relational database, the SQL Server has a strong demand that a user can provide a one-key deployment SQL Server service for a cloud platform. Particularly, with the improvement of the client on the data security requirement, higher requirements are also provided for the deployment of the SQL Server mirror image mode, and at present, in the SQL Server mirror image mode, data exchange among a plurality of nodes is tedious, long in time consumption and low in efficiency, so that the service quality and the client experience are greatly reduced.
Disclosure of Invention
In order to solve the problems, the method for realizing the automatic deployment of the SQL Server database mirror image mode is provided, the problem that data exchange among a plurality of nodes is complicated is solved, the deployment time is shortened, the deployment efficiency is improved, and the service quality and the customer experience are improved.
One specific embodiment of the invention adopts the following technical scheme:
a method for realizing the automatic deployment of the mirror image mode of the SQL Server database utilizes the file sharing function of Windows to exchange data among all nodes, and realizes the one-key automatic deployment of the mirror image mode of the SQL Server database.
Further, the method comprises the following steps:
s1: creating a host and copying an automatic deployment program inwards;
s2: the control end sends a starting command to the host;
s3: a mirror mode main node creates a shared folder, and a mirror node is connected to the shared folder;
s4: and the mirror mode master node and the mirror mode node deploy own SQL Server service.
Further, in step S3, the mirror mode master node and the mirror node both have read-write permission of the shared folder.
Further, the specific implementation process of step S4 is as follows:
s41: the node divides the self deployment into a plurality of deployment phases;
s42: and the nodes sequentially select the started deployment stage until all the nodes finish the deployment process.
Further, the specific implementation process of step S4 is as follows:
s41: the node divides the self deployment into a plurality of deployment phases;
s42: a node selects a deployment stage of starting;
s43: the node detects whether the deployment requirement is met, if yes, the S43 is entered, and if not, the S42 is returned;
s44: the node generates a mark file of the deployment stage;
s45: steps S41-S44 are repeated until all nodes complete the deployment process.
Further, if in step S43, the node detects that the deployment requirement is not satisfied more than the set number of times, the deployment is considered to be failed, and the deployment process is interrupted.
Further, in step S4, if a node itself generates data required by other nodes, the data needs to be put into a shared folder for other nodes to use.
The beneficial effects of one embodiment of the invention are as follows:
1. by utilizing the shared folder, the problem of complex data communication among a plurality of nodes is solved, the deployment time is reduced, the deployment efficiency is improved, and the service quality and the customer experience are improved.
2. By setting the read-write permission of the shared folder, the requirements of all nodes can be met only by establishing one shared folder to store all data, so that the operation process is simplified, and the efficiency is improved.
3. Each node is used as a data source, and all data are stored in a shared folder, so that the integrity of the data can be ensured, and the whole deployment process can be carried out smoothly.
4. By generating the mark file as a mark for recording the completion of a certain deployment stage of a certain node, the time sequence problem among different deployment stages can be solved, whether the deployment requirement is met or not is judged at the first time, the deployment logicality is greatly improved, and the deployment efficiency is improved.
5. The deployment time limit is set, when a certain node does not meet the deployment requirement for many times, the deployment process can be interrupted in time, the occupation of resources is avoided, technicians can be reminded to find problems, and the whole deployment process can be fed back in time.
Drawings
FIG. 1 is a flow diagram of a method of one embodiment of the invention;
fig. 2 is a flow chart of a method of another embodiment of the present invention.
Detailed Description
The present invention will be described in detail below with reference to specific examples in order to enable those skilled in the art to better understand and practice the present invention.
Example 1
As shown in fig. 1, a specific embodiment provides a method for implementing an automatic deployment of an SQL Server database mirror mode, which includes the following steps:
s1: a host is created and the auto-deploy program is copied in. In actual operation, for the case of large-batch operation, a plurality of tools such as a cloud platform can be used to realize batch creation of host operation.
S2: the control end sends a starting command to the host. At this time, if the tool creating the host in S1 is the control end in S2, for example, the tool creating the host in S1 is the cloud platform, then the control end in S2 is the cloud platform.
S3: and the mirror mode master node creates a shared folder, the mirror node is connected to the shared folder, and both the mirror mode master node and the mirror node have the read-write permission of the shared folder.
S4: the mirror mode master node and the mirror node deploy the SQL Server service of the mirror mode master node and the mirror node, and the specific implementation process is as follows:
s41: the node divides the self deployment into a plurality of deployment phases.
S42: and the nodes sequentially select the started deployment stage until all the nodes finish the deployment process.
It should be noted that, in the whole deployment process of step S4, if a node itself generates data required by other nodes, such as certificates, database files, etc., the data needs to be put into a shared folder for other nodes to use.
Example 2
As shown in fig. 1, a specific embodiment provides a method for implementing an automatic deployment of an SQL Server database mirror mode, which includes the following steps:
s1: a host is created and the auto-deploy program is copied in. In actual operation, for the case of large-batch operation, a plurality of tools such as a cloud platform can be used to realize batch creation of host operation.
S2: the control end sends a starting command to the host. At this time, if the tool creating the host in S1 is the control end in S2, for example, the tool creating the host in S1 is the cloud platform, then the control end in S2 is the cloud platform.
S3: and the mirror mode master node creates a shared folder, the mirror node is connected to the shared folder, and both the mirror mode master node and the mirror node have the read-write permission of the shared folder.
S4: the mirror mode master node and the mirror node deploy the SQL Server service of the mirror mode master node and the mirror node, and the specific implementation process is as follows:
s41: the node divides the self deployment into a plurality of deployment phases.
S42: the node selects the deployment phase of the startup.
S43: and (4) detecting whether the deployment requirement is met by the node, if so, entering S43, and if not, returning to S42. And if the node detects that the deployment requirement is not met for more than the set number of times, such as 5 times, the deployment is considered to be failed, and the deployment process is directly interrupted.
S44: the node generates a marker file for the deployment phase.
S45: steps S41-S44 are repeated until all nodes complete the deployment process.
It should be noted that, in the whole deployment process of step S4, if a node itself generates data required by other nodes, such as certificates, database files, etc., the data needs to be put into a shared folder for other nodes to use.
For the implementation of step S43, the following example is provided:
if a certain deployment phase of a certain node (referred to as "node A" herein) needs to wait for a certain phase (referred to as "phase B" herein) of other nodes to be completed before starting, whether a flag file (referred to as "flag B" herein) which is created after the other folders finish executing the "phase B" exists is detected in the shared folder, and if so, the "node A" continues to execute the deployment process downwards; if not, waiting for a period of time, and detecting again; if the detection times exceed a certain number, the 'mark B' still cannot be found, the deployment is considered to be failed, and the deployment is interrupted.
While the invention has been described in detail in the specification and drawings and with reference to specific embodiments thereof, it will be understood by those skilled in the art that various changes may be made and equivalents may be substituted; all technical solutions and modifications thereof which do not depart from the spirit and scope of the present invention are intended to be covered by the scope of the present invention.