Summary of the invention
The downtime produced during for solving existing database fault is long, need the problems such as solution manually, this
Bright provide a kind of data base's changing method and system, the angle mutually switched from Double Data storehouse identical, real-time synchronization
Solve the problems referred to above, considerably reduce downtime, improve data base's switching efficiency, make application server quickly and automatically
Resume work.
For reaching above-mentioned technical purpose, the invention discloses a kind of data base's changing method, the method includes walking as follows
Suddenly,
Step 1, builds the Database Systems with Double Data storehouse;
Step 2, analyzes and show that data base A works;
Step 3, monitors data base A, it is judged that data base A is the most normal: if normal, then continue monitoring data base A;If it is different
Often, then step 4 is performed;
Step 4, switches to data base B by data base A.
The present invention innovatively have employed the Database Systems with Double Data storehouse, if one of them occurs abnormal or event
Barrier, then can automatically switch to another data base normally worked, and the method switch speed is fast, switching efficiency is high, reduce application
The downtime of server.
Further, in described step 4, data base B is identical with data base A and the two real time data synchronization updates.
Two the data base's real time datas used due to the present invention are identical, therefore can a database failure wherein
Time switch to another data base without barrier, solve the problems such as data are inconsistent that master-slave back-up exists.
Further, in step 2, analyzed by configuration file file-A and show that data base A works, configuration file
File-A points to data base A, and now application server sets up the communication with data base A by configuration file file-A.
The present invention is connected with normal data base by configuration file direct application servers, and this mode has response speed
Spend the advantages such as fast, easy realization, reduce the downtime of application server further.
Further, in step 4, during data base A switches to data base B, to operation personnel send alarm message and/
Or mail, application server is by the communication of configuration file file-B foundation with data base B, and configuration file file-B points to data
Storehouse B, then restarts application server and data base A.
Guided by configuration file, when detecting that data base breaks down, although the present invention need not artificial treatment, but
Note or mail notification can be sent in the very first time to operation personnel, make operation personnel obtain the work of current application server in time
Make state.
Further, during data base A switches to data base B, send alarm message and/or postal to operation personnel
Part, data base B obtains the virtual ip address of data base A, makes configuration file file-A point to data base B, and application server passes through
Configuration file file-A sets up the communication with data base B.
Present invention also offers the mode of another kind of direct application servers and database communication: i.e. pass through virtual ip address
Method, the method need not change configuration file, it is only necessary to make normal data base obtain current database virtual IP address ground
Location, then can make application server be connected with data base by former configuration file.
Further, the method comprises the steps,
Step 5, it is judged that data base B is the most normal: if normal, then continue monitoring data base B;If it is abnormal, to operation personnel
Send alarm message and/or mail, then restart data base A and data base B, then restart application server.
In extreme cases, if two data bases all there occurs exception, the most automatically by two data bases and should
With Server Restart, passing through which so that the changing method of the present invention is more perfect, the problem of solution is more comprehensive.
Further, in step 3, data base normally need to meet following condition simultaneously: data base can normally be logged in, normally
Connection, normal queries, normally revise.
The present invention judges that the normal condition of data base includes above-mentioned condition, but is not limited to above-mentioned condition, the present invention's
Under technology enlightenment, those skilled in the art can the most reasonably select or change and judge that whether normal data base is
Condition.
Further, in step 3, if data base A is normal, then continue monitoring data base A after two minutes;In described step 5,
If data base B is normal, then continue monitoring data base B after two minutes.
The monitoring frequency of the present invention is two minutes, after for the first time monitoring finds that the data base that is currently operating is normal,
Detect the most again once.The setting of this frequency has taken into account resource and the monitoring effect that monitoring work takies.
Further, by script operation, data base A is switched to data base B.
The present invention realizes switching by script operation mode, the enforcement simple, easy of this mode, fast response time,
Further reduce downtime, reduce resource occupation.
Further, described Database Systems are the Database Disaster Backup/Recover of refrigerator.
Present invention can apply to refrigerator, ensured refrigerator background data base system stability, thoroughly solve data for refrigerator storehouse
Fault or crash issue, make that refrigerator is more stable, work more reliably.
Another goal of the invention of the present invention is to provide a kind of data base's switched system, and this system includes data base A, number
According to storehouse B, application server and control server, described data base A and data base B is identical data base, is controlling server
Under effect, application server is connected with data base A or data base B.
Under the support of the data base A and data base B of identical, data synchronization updating, the data base that the present invention provides
Switched system can be automatically obtained switch operating, greatly reduces the downtime of application server, and, this systematic function can
Lean on, good stability, it is not necessary to can implement by third party software.
Further, application server is connected with data base A by configuration file file-A or by configuration file file-
B is connected with data base B, and configuration file file-A and configuration file file-B is stored in application server.
The present invention connects the data that can normally work by means of the configuration file direct application servers in application server
Storehouse, it is not necessary to can implement by third party software.
Further, controlling server is business system server.
The present invention can directly control above-mentioned detection, monitoring and switch operating by business system server, it is not necessary to by the
Software of the third party can be implemented, simple.
The invention have the benefit that the present invention can automatic data-detection storehouse abnormal, can when data base occurs exception
Instant intelligence switching, considerably reduces the downtime of application server, makes application server extensive in may be implemented in five minutes
Multiple normal work;And, occur abnormal conditions time, the present invention can automatically switch process, need not artificial treatment, save people
The workload of work;It addition, notified and prompting operation personnel by the form of note or mail in the abnormal very first time occurred.
Embodiment one:
Specifically, data base's changing method of the present invention comprises the steps,
Step 1, builds the Database Systems with Double Data storehouse, and in the present embodiment, Double Data storehouse includes data base A and number
According to storehouse B;Present invention is generally applicable on various intelligentized refrigerator, thus Database Systems can be data base's calamity of refrigerator
Standby system.
Step 2, has the script startup of control function, in the present embodiment, analyzes and show that data base A works, pass through
Configuration file file-A analyzes and show that data base A works, and configuration file file-A points to data base A, now application service
Device sets up the communication with data base A by configuration file file-A.Certainly, the data base worked is also likely to be data base B,
This step of the present invention is merely to have a data base to work in explanation Double Data storehouse, as it is shown in figure 1, if it is determined that current
The configuration file that application server connects is file-A, then data base A works, if it is determined that current application server connects
Configuration file be file-B, then data base B works.
Step 3, monitors data base A, it is judged that data base A is the most normal: if data base A is normal, then continue prison after two minutes
Control data base A;If abnormal, then perform step 4.
Certainly, in this step, if data base B works, then judge that data base B is the most normal.
Step 4, switches to data base B by script operation by data base A, and the data base B of the present invention is complete with data base A
Identical and the two real time data synchronization updates.During data base A switches to data base B, send alarm message to operation personnel
And/or mail, application server sets up the communication with data base B, configuration file file-B sensing by configuration file file-B
Data base B, then restarts application server, makes application server be connected on data base B, then restarts data base A, makes data base
A recovers normal, standby for the calamity when data base's B exception.
Certainly, as shown in flow process on the right side of Fig. 1, if data base B is abnormal in step 3, then data base B is cut by script operation
Shifting to data base A, application server sets up the communication with data base A by configuration file file-A, and configuration file file-A refers to
To data base A, then restart data base B, make data base B recover normal.
Step 5, after switching to data base B by data base A, it is judged that data base B is the most normal: if data base B is normal, then and two
Monitoring data base B is continued after minute;If abnormal, send alarm message and/or mail to operation personnel, then restart data base A and
Data base B, then restarts application server.
It should be noted that the present invention can judge that data base A or B is the most normal in the following way.Data base normally needs
Meet following condition simultaneously: data base can normally be logged in, normally connection, normal queries, normally revise.It addition, number of the present invention
It is to perform once for two minutes according to storehouse monitoring frequency.