CN106844163A - The method and device of a kind of database master-slave synchronisation condition monitoring - Google Patents
The method and device of a kind of database master-slave synchronisation condition monitoring Download PDFInfo
- Publication number
- CN106844163A CN106844163A CN201710157201.6A CN201710157201A CN106844163A CN 106844163 A CN106844163 A CN 106844163A CN 201710157201 A CN201710157201 A CN 201710157201A CN 106844163 A CN106844163 A CN 106844163A
- Authority
- CN
- China
- Prior art keywords
- database
- master
- slave synchronisation
- default
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/32—Monitoring with visual or acoustical indication of the functioning of the machine
- G06F11/324—Display of status information
- G06F11/327—Alarm or error message display
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Quality & Reliability (AREA)
- Databases & Information Systems (AREA)
- Computing Systems (AREA)
- Data Mining & Analysis (AREA)
- Information Transfer Between Computers (AREA)
Abstract
It is automatic to perform preset structure query statement by calling the first programming function the invention discloses a kind of method of database master-slave synchronisation condition monitoring, draw implementing result;According to above-mentioned implementing result, judge whether the master-slave synchronisation state of database is normal.Using program meanses, it is automatic to perform structuralized query instruction, master-slave synchronisation state to database is monitored, the master-slave synchronisation state of database is monitored compared to structuralized query instruction is manually performed, its automatic structuralized query that performs is instructed, so that the monitoring efficiency of the master-slave synchronisation state of database is higher, it is seen then that the application is conducive to improving the monitoring efficiency of database master-slave synchronisation state.Additionally, present invention also offers a kind of device of database master-slave synchronisation condition monitoring, having one-to-one advantage with the above method.
Description
Technical field
The present invention relates to database technical field, more particularly to a kind of method of database master-slave synchronisation condition monitoring with
And device.
Background technology
With the progress of web site traffic, number of users and data volume are also being constantly increasing, so as to cause data
The visit capacity in storehouse also linearly increases.
In order to tackle growing visit capacity, database master-slave synchronisation framework is widely used in large-scale website system.Example
Such as, MYSQL master-slave synchronisations framework, wherein MySam engines are responsible for the operations such as newly-increased, modification, deletion, and InnoDB engines are responsible for looking into
Ask.Database master-slave synchronisation framework can refer to set up two databases of principal and subordinate, and the information state between master-slave database is
Synchronous.
Database master-slave synchronisation state is to decide that performance of the database under high concurrent load is fine or not, thus database master
Also just it is particularly important from the monitoring of synchronous regime.The monitoring method of data master-slave synchronisation state of the prior art is usually
Artificial manually execution structured query sentence (Structured Query Language, SQL) sentence, such as show,
Slave and status the sentence such as G, then check Slave_IO_Running, the Slave_SQL_ in output result
Three parameter values such as Running and Seconds_Behind_Master, last artificial judgment database master-slave synchronisation state is
It is no normal.But, it is manually performed due to the monitoring of database master-slave synchronisation state, when being detected, it is necessary to O&M people
Member logs in every equipment and is checked one by one, and when number of devices reaches hundreds and thousands of, workload greatly, and then causes data
Storehouse master-slave synchronisation condition monitoring is less efficient.In sum, how to improve database master-slave synchronisation condition monitoring efficiency is ability
Domain problem demanding prompt solution.
The content of the invention
It is an object of the invention to provide the method and device of a kind of database master-slave synchronisation condition monitoring, it is therefore intended that solution
The certainly less efficient problem of database master-slave synchronisation condition monitoring in the prior art.
In order to solve the above technical problems, the present invention provides a kind of method of database master-slave synchronisation condition monitoring, the method
Including:
The first programming function is called, it is automatic to perform preset structure query statement, draw implementing result;
According to the implementing result, judge whether the master-slave synchronisation state of database is normal.
Alternatively, monitoring function is called described, it is automatic to perform preset structure query statement, before drawing implementing result
Also include:
The second programming function is called, the port status of the database are tested, judges whether to meet default condition of contact;
When the default condition of contact is met, then subsequent step is carried out;
When the default condition of contact is not met, the first alarm email is generated, and the alarm email is sent to the
One default addressee.
Alternatively, it is described when the default condition of contact is not met, the first alarm email is generated, and by the alarm postal
Part is sent to the first default addressee to be included:
Obtain the first abnormal information of the database;
According to first abnormal information and the first default email template, first alarm email is generated;
First alarm email is sent to the described first default addressee.
Alternatively, described according to the implementing result, judge to be gone back after whether the master-slave synchronisation state of database is normal
Including:
When the master-slave synchronisation state for judging the database is normal, stop performing monitoring programme;
When the master-slave synchronisation state for judging the database is for exception, the second abnormal letter of the database is obtained
Breath;
According to second abnormal information and the second default email template, the second alarm email is generated;
Second alarm email is sent to the second default addressee.
Alternatively, stop performing monitoring journey when the master-slave synchronisation state for judging the database is normal described
Also include after sequence:
After by predetermined period, the monitoring programme is performed, the master-slave synchronisation state to the database is supervised
Control.
Additionally, present invention also offers a kind of device of database master-slave synchronisation condition monitoring, the device includes:
Calling module, it is automatic to perform preset structure query statement for calling the first programming function, draw and perform knot
Really;
First judge module, for according to the implementing result, judging whether the master-slave synchronisation state of database is normal.
Alternatively, also include:
Second judge module, for calling the second programming function, tests the port status of the database, judges whether symbol
Close default condition of contact;
Module is set up, for when the default condition of contact is met, then carrying out subsequent step;
First alarm module, for when the default condition of contact is not met, generating the first alarm email, and will be described
Alarm email is sent to the first default addressee.
Alternatively, first alarm module includes:
First abnormal information acquiring unit, the first abnormal information for obtaining the database;
Generation unit, for according to first abnormal information and the first default email template, generating described first and accusing
Alert mail;
Transmitting element, for first alarm email to be sent to the described first default addressee.
Alternatively, also include:
Stopping modular, for when the master-slave synchronisation state for judging the database is normal, stopping performing monitoring journey
Sequence;
Acquisition module, for when the master-slave synchronisation state for judging the database is for exception, obtaining the database
The second abnormal information;
Generation module, for according to second abnormal information and the second default email template, generation second to alert postal
Part;
Sending module, for second alarm email to be sent to the second default addressee.
Alternatively, also include:
Timing performing module, for after by predetermined period, the monitoring programme being performed, to the master of the database
It is monitored from synchronous regime.
The method and device of a kind of database master-slave synchronisation condition monitoring provided by the present invention, by calling the first volume
Eikonal number, it is automatic to perform preset structure query statement, draw implementing result;According to above-mentioned implementing result, database is judged
Whether master-slave synchronisation state is normal.It is automatic to perform structuralized query instruction using program meanses, to the master-slave synchronisation shape of database
State is monitored, and the master-slave synchronisation state of database is monitored compared to structuralized query instruction is manually performed, and its is automatic
Perform structuralized query instruction so that the monitoring efficiency of the master-slave synchronisation state of database is higher, it is seen then that the application is conducive to carrying
The monitoring efficiency of database master-slave synchronisation state high.
Brief description of the drawings
For the clearer explanation embodiment of the present invention or the technical scheme of prior art, below will be to embodiment or existing
The accompanying drawing to be used needed for technology description is briefly described, it should be apparent that, drawings in the following description are only this hair
Some bright embodiments, for those of ordinary skill in the art, on the premise of not paying creative work, can be with root
Other accompanying drawings are obtained according to these accompanying drawings.
A kind of specific embodiment of the database master-slave synchronisation method for monitoring state that Fig. 1 is provided by the embodiment of the present invention
Schematic flow sheet;
The structured flowchart of the database master-slave synchronisation state monitoring device that Fig. 2 is provided by the embodiment of the present invention.
Specific embodiment
In order that those skilled in the art more fully understand the present invention program, with reference to the accompanying drawings and detailed description
The present invention is described in further detail.Obviously, described embodiment is only a part of embodiment of the invention, rather than
Whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art are not making creative work premise
Lower obtained every other embodiment, belongs to the scope of protection of the invention.
By database and the difference of the programming language for being used, the mode of database master-slave synchronisation condition monitoring is realized
Would also vary from, thus below will with data as MYSQL database, programming language for Python scene under be introduced
It is bright.It should be evident that when the type of database is different, or used script it is different when, specific implementation
With the unity of thinking of the embodiment of the present invention, i.e., also fall in the protection domain of the embodiment of the present invention.
Refer to Fig. 1, a kind of tool of the database master-slave synchronisation method for monitoring state that Fig. 1 is provided by the embodiment of the present invention
The schematic flow sheet of body implementation method, the method is comprised the following steps:
Step 101:The first programming function is called, it is automatic to perform preset structure query statement, draw implementing result.
It should be noted that above-mentioned first programming function can refer to the is Slave functions of Python, it can be with
Database performs corresponding structuralized query instruction automatically, is monitored with the master-slave synchronisation state to data, i.e., using the letter
Number, can be with the master-slave synchronisation state in monitoring data storehouse.
Above-mentioned preset structure query statement can refer to SQL statement, for example, can for show, slave and
Status the SQL statement such as G.It can draw corresponding parameter value, according to the parameter according to the master-slave synchronisation state of database
Value, it can be determined that whether the master-slave synchronisation state for going out database is normal.
Above-mentioned implementing result can refer to perform SQL statement after, the parameter value for drawing, for example, when perform be show,
Slave and status tri- SQL statements of G when, output result be Slave_IO_Running, Slave_SQL_Running with
And tri- parameter values of Seconds_Behind_Master, these three parameter values are implementing result.
Specifically, the monitoring script write based on Python is run, monitoring script can be called to the first programming letter
Number is is Slave functions, performs SQL statement, draws corresponding parameter value.
It is understood that the information exchange of master-slave database is based on port, therefore the port between master-slave database
It is whether unimpeded, the master-slave synchronisation state of database is affected, therefore monitoring script can be arranged on MDL, using monitoring
Whether script carrys out the state of test port, i.e., by judging can be connected between master-slave database, such that it is able to draw data
Master-slave synchronisation state.
In some embodiments of the invention, the first programming function is called above-mentioned, it is automatic to perform preset structureization inquiry
Instruction, can also include before drawing implementing result:The second programming function is called, the port status of the database are tested, sentenced
It is disconnected whether to meet default condition of contact;When the default condition of contact is met, then subsequent step is carried out;It is described pre- when not meeting
If during condition of contact, generating the first alarm email, and the alarm email is sent to the first default addressee.
It should be noted that above-mentioned second programming function can refer to telnet functions in Python, it can be with
Whether whether the address and port of testing service device are unimpeded, i.e., can be connected between the master-slave database based on Python.
Above-mentioned default condition of contact can refer to monitoring script and from the port between database be in unimpeded state, this
When, is Slave functions can be called to carry out the master-slave synchronisation state in monitoring data storehouse.
When above-mentioned default condition of contact is not met, i.e., between master-slave database when cannot connect, then may determine that
The master-slave synchronisation state of database occurs abnormal.Now, in order to notify operation maintenance personnel in time, so as to operation maintenance personnel can be known work as
Preceding master-slave synchronisation state occurs abnormal, can automatically generate alarm email, and the alarm email is sent to set in advance
Addressee.
Above-mentioned first default addressee can be any setting, its keeper that can specifically show as database,
Can be other personnel set in advance, no longer limit herein.It should be evident that setting addressee specifically can be by setting postal
Part receives address to realize.And more specifically, alarm email can be realized by the ring functions in Python.
Further, in order that the addressee of alarm email is learning database master-slave synchronisation state appearance exception
Afterwards, the reason for appearance is abnormal and position can be in time learnt, to make counter-measure in time, can be enclosed in alarm email
Abnormal information, shows the reason for exception occur and position.
Therefore in some embodiments of the invention, above-mentioned when the default condition of contact is not met, generation first is alerted
Mail, and the process that the alarm email is sent to the first default addressee is specifically as follows:Obtain the of the database
One abnormal information;According to first abnormal information and the first default email template, first alarm email is generated;By institute
The first alarm email is stated to send to the described first default addressee.
It should be noted that above-mentioned first abnormal information can include the port status of current database, for example whether
It is unimpeded etc., and which platform server server residing for current database is.Certainly, above-mentioned first abnormal information can also include
Other types of information, is not limited thereto.
Above-mentioned first default email template can refer to the email template for pre-setting, for example, can be by email template
Title be set to database master-slave synchronisation abnormal state prompting, and by the curriculum offering of email template include address term, go out
Server address where now abnormal the reason for and the abnormal database of appearance etc..Certainly, the template of alarm email can appoint
Meaning setting, it is not limited thereto.And the transmission of alarm email can also be realized by ring functions mentioned above.
As can be seen that whether can be connected by the port tested between master-slave database, so as to tentatively judge database
Master-slave synchronisation state whether there is exception so that the monitoring of master-slave synchronisation state it is relatively convenient quick.And judging data
The master-slave synchronisation state in storehouse occurs after exception, sends alarm email, can processing data storehouse in time master-slave synchronisation state it is different
Reason condition, it is ensured that the master-slave synchronisation of database.
Step 102:According to the implementing result, judge whether the master-slave synchronisation state of database is normal.
It should be noted that judge the master-slave synchronisation state of database according to the parameter value that execution SQL statement draws being
It is no to occur abnormal being technology well-known to those skilled in the art, will not be repeated here.
It is understood that whether normal the master-slave synchronisation state according to database is, corresponding counter-measure can be carried out.
In some embodiments of the invention, it is above-mentioned according to the implementing result, judge the master-slave synchronisation state of database
Whether normal process can be specially:When the master-slave synchronisation state for judging the database is normal, stopping performs prison
Control program;When the master-slave synchronisation state for judging the database is for exception, the second abnormal information of the database is obtained;
According to second abnormal information and the second default email template, the second alarm email is generated;By second alarm email
Send to the second default addressee.
It should be noted that above-mentioned monitoring programme can refer to the monitoring script being mentioned above, it can refer to be based on
What Python was write.
The reason for above-mentioned second abnormal information can refer to the master-slave synchronisation state appearance exception of characterization database, and go out
Now abnormal database is in the information of which platform server.Certainly, above-mentioned second abnormal information can also include other types
Database information.
Above-mentioned second default email template can be equal to the mentioned above first default email template, and specific introduction can be with
See above corresponding contents;It is of course also possible to it is different from the first default email template, can be any setting, do not make herein
Limit.
Above-mentioned second default addressee can be equal to the mentioned above first default addressee, and specific introduction may refer to
Corresponding contents above;Certainly, the second default addressee can also be different from the first default addressee, are not limited thereto.
It is understood that when the master-slave synchronisation state for judging database is normal, can stop performing monitoring journey
Sequence, it is also possible to continue cycling through execution monitoring programme, with to the unremitting monitoring of database realizing.
But, monitoring script is run without interruption, substantial amounts of resource can be taken.For balanced monitoring efficiency and the profit of resource
With rate, the master-slave synchronisation state in monitoring script, i.e. timing monitoring data storehouse can be regularly performed.
It is in some embodiments of the invention, above-mentioned when the master-slave synchronisation state for judging the database is normal,
Stop to include after performing monitoring programme:After by predetermined period, the monitoring programme is performed, to the data
The master-slave synchronisation state in storehouse is monitored.
It should be noted that above-mentioned predetermined period can be any setting, for example, predetermined period can be set as into 10
Minute, now, often by 10 minutes, then the automatic monitoring programme that performs is monitoring script.
Specifically, it is possible to use Linux/Unix crontab realize timing monitor task, i.e., add in crontab
Timed task, so every predetermined period, crontab can call monitoring programme i.e. monitoring script, to the master-slave synchronisation shape of data
State is monitored.
Illustrate that each step implements process to preferably introduce, below in conjunction with implementing code briefly
Illustrate that specific Python code is realized.
Firstly the need of writing SMTP mail configuration files, and create Python functions _ _ init__, _ _
configParseMySQL__、__configParseSMTP__、__read_defaults_file__、telnet、is
Slave, get_last_error, notify, close, ring function.
Then write Python code to implement each step, for example, using telnet function testing services device ground
Whether location and port are unimpeded, judge that whether the normal process of master-slave synchronisation state of data can be with specific as follows:
Whether testing service device address and port are unimpeded
:param host:Server address
:param port:Service-Port
:param timeout:Test time-out time
:return:Boolean
"""
try:
Tel=telnetlib.Telnet (host, port, timeout)
tel.close()
return True
except:
return False
def connect(self):
"""
Create database link
"""
try:
Config=self.__configParseMySQL__ ()
if self.telnet(config["host"],config["port"]):
Self.__instance__=mysql.connector.connect (* * config)
return True
else:
raise Exception("unable connect")
except:
Self.__error__.append (" cannot connection server main frame:{host}:{port}".format(host
=config [
" host "], port=config [" port "]))
return False
defisSlave(self):
"""
Whether database synchronization is normal
:return:None is not opened synchronously, False sync breaks, and True is synchronous normal
"""
Cur=self.__instance__.cursor (dictionary=True)
cur.execute("SHOW SLAVE STATUS")
Result=cur.fetchone ()
cur.close()
if result:
If result [" Slave_SQL_Running "]==" Yes " and result [" Slave_IO_Running "]
==" Yes ":
return True
else:
If result [" Slave_SQL_Running "]==" No ":
self.__error__.append(result["Last_SQL_Error"])
else:
self.__error__.append(result["Last_IO_Error"])
return False
defget_last_error(self):
"""
Obtain first error message
:return:String
"""
if self.__error__:
return self.__error__.pop(0)
def notify(self,title,message):
"""
And the specific code realization for sending alarm email can be with as follows:
:param title:The title of message
:param message:The content of message
:return:
"""
Msg=[title, message]
Pool=[]
Notify=notify_email (self.__configParseSMTP__ ())
pool.append(notify)
for item in pool:
item.ring(msg)
def close(self):
"""
Close database link
"""
if self.__instance__:
self.__instance__.close()
class notify_email(object):
def__init__(self,config):
Self.config=config
Def ring (self, message=[]):
Subject=message.pop (0)
MessageBody=" " .join (message)
MailList=self.config [" to "] .split (";")
Datetime=time.strftime (" %Y-%m-%d%H:%M:%S ")
for to in mailList:
Body=" " "
<p>Keeper<strong>{admin}</strong>, hello:</p>
<P style=" text-indent:2em;">Receive this envelope mail and illustrate that exception occurs in your database synchronization,
Would you please be processed in time.</p>
<p>Abnormal information:<br/>{body}</p>
<P style=" text-align:right;">{date}</p>
" " " .format (admin=to, body=messageBody, date=datetime)
Msg=MIMEText (body, " html ", " utf-8 ")
Msg [" From "]=self.config [" from "]
Msg [" To "]=to
Msg [" Subject "]=subject
Smtp=smtplib.SMTP ()
smtp.connect(self.config["smtp_host"])
if self.config.has_key("smtp_user"):
smtp.login(self.config["smtp_user"],self.config["smtp_password"])
smtp.sendmail(self.config["from"],to,msg.as_string())
smtp.quit()
It is understood that the implementation process of above-mentioned specific Python code is a kind of implementation method, it is specific real
Existing means can also have other, be not limited thereto.
The method of the database master-slave synchronisation condition monitoring that the embodiment of the present invention is provided, by calling the first programming letter
Number, it is automatic to perform preset structure query statement, draw implementing result;According to above-mentioned implementing result, the principal and subordinate of database is judged
Whether synchronous regime is normal.Automatic to perform structuralized query instruction using program meanses, the master-slave synchronisation state to database is entered
Row monitoring, is monitored, its automatic execution compared to structuralized query instruction is manually performed to the master-slave synchronisation state of database
Structuralized query is instructed so that the monitoring efficiency of the master-slave synchronisation state of database is higher, it is seen then that the method is conducive to improving number
According to the monitoring efficiency of storehouse master-slave synchronisation state.
Database master-slave synchronisation state monitoring device provided in an embodiment of the present invention is introduced below, it is described below
Database master-slave synchronisation state monitoring device can mutually corresponding ginseng with database described above master-slave synchronisation method for monitoring state
According to.
The structured flowchart of the database master-slave synchronisation state monitoring device that Fig. 2 is provided by the embodiment of the present invention, reference picture 2
The device of database master-slave synchronisation condition monitoring can include:
Calling module 201, it is automatic to perform preset structure query statement for calling the first programming function, draw execution
As a result;
First judge module 202, for according to the implementing result, whether just to judge the master-slave synchronisation state of database
Often.
Alternatively, also include:
Second judge module, for calling the second programming function, tests the port status of the database, judges whether symbol
Close default condition of contact;
Module is set up, for when the default condition of contact is met, then carrying out subsequent step;
First alarm module, for when the default condition of contact is not met, generating the first alarm email, and will be described
Alarm email is sent to the first default addressee.
Alternatively, first alarm module includes:
First abnormal information acquiring unit, the first abnormal information for obtaining the database;
Generation unit, for according to first abnormal information and the first default email template, generating described first and accusing
Alert mail;
Transmitting element, for first alarm email to be sent to the described first default addressee.
Alternatively, also include:
Stopping modular, for when the master-slave synchronisation state for judging the database is normal, stopping performing monitoring journey
Sequence;
Acquisition module, for when the master-slave synchronisation state for judging the database is for exception, obtaining the database
The second abnormal information;
Generation module, for according to second abnormal information and the second default email template, generation second to alert postal
Part;
Sending module, for second alarm email to be sent to the second default addressee.
Alternatively, also include:
Timing performing module, for after by predetermined period, the monitoring programme being performed, to the master of the database
It is monitored from synchronous regime.
The device of the database master-slave synchronisation condition monitoring that the embodiment of the present invention is provided, by calling the first programming letter
Number, it is automatic to perform preset structure query statement, draw implementing result;According to above-mentioned implementing result, the principal and subordinate of database is judged
Whether synchronous regime is normal.Automatic to perform structuralized query instruction using program meanses, the master-slave synchronisation state to database is entered
Row monitoring, is monitored, its automatic execution compared to structuralized query instruction is manually performed to the master-slave synchronisation state of database
Structuralized query is instructed so that the monitoring efficiency of the master-slave synchronisation state of database is higher, it is seen then that the device is conducive to improving number
According to the monitoring efficiency of storehouse master-slave synchronisation state.
Each embodiment is described by the way of progressive in this specification, and what each embodiment was stressed is and other
The difference of embodiment, between each embodiment same or similar part mutually referring to.For being filled disclosed in embodiment
For putting, because it is corresponded to the method disclosed in Example, so description is fairly simple, related part is referring to method part
Illustrate.
Professional further appreciates that, with reference to the unit of each example of the embodiments described herein description
And algorithm steps, can be realized with electronic hardware, computer software or the combination of the two, in order to clearly demonstrate hardware and
The interchangeability of software, generally describes the composition and step of each example according to function in the above description.These
Function is performed with hardware or software mode actually, depending on the application-specific and design constraint of technical scheme.Specialty
Technical staff can realize described function to each specific application using distinct methods, but this realization should not
Think beyond the scope of this invention.
The step of method or algorithm for being described with reference to the embodiments described herein, directly can be held with hardware, processor
Capable software module, or the two combination is implemented.Software module can be placed in random access memory (RAM), internal memory, read-only deposit
Reservoir (ROM), electrically programmable ROM, electrically erasable ROM, register, hard disk, moveable magnetic disc, CD-ROM or technology
In field in known any other form of storage medium.
The method and device to database master-slave synchronisation condition monitoring provided by the present invention have carried out detailed Jie above
Continue.Specific case used herein is set forth to principle of the invention and implementation method, and the explanation of above example is only
It is to be used to help understand the method for the present invention and its core concept.It should be pointed out that for those skilled in the art
For, under the premise without departing from the principles of the invention, some improvement and modification can also be carried out to the present invention, these improve and repair
Decorations are also fallen into the protection domain of the claims in the present invention.
Claims (10)
1. a kind of method of database master-slave synchronisation condition monitoring, it is characterised in that including:
The first programming function is called, it is automatic to perform preset structure query statement, draw implementing result;
According to the implementing result, judge whether the master-slave synchronisation state of database is normal.
2. the method for claim 1, it is characterised in that call monitoring function described, it is automatic to perform preset structure
Query statement, also includes before drawing implementing result:
The second programming function is called, the port status of the database are tested, judges whether to meet default condition of contact;
When the default condition of contact is met, then subsequent step is carried out;
When the default condition of contact is not met, the first alarm email is generated, and the alarm email is sent to first pre-
If addressee.
3. method as claimed in claim 2, it is characterised in that described when the default condition of contact is not met, generation the
One alarm email, and the alarm email is sent to the first default addressee include:
Obtain the first abnormal information of the database;
According to first abnormal information and the first default email template, first alarm email is generated;
First alarm email is sent to the described first default addressee.
4. the method as described in any one of claims 1 to 3, it is characterised in that described according to the implementing result, judge number
Also include afterwards according to whether the master-slave synchronisation state in storehouse is normal:
When the master-slave synchronisation state for judging the database is normal, stop performing monitoring programme;
When the master-slave synchronisation state for judging the database is for exception, the second abnormal information of the database is obtained;
According to second abnormal information and the second default email template, the second alarm email is generated;
Second alarm email is sent to the second default addressee.
5. method as claimed in claim 4, it is characterised in that described when the master-slave synchronisation state that judge the database
For it is normal when, stop perform monitoring programme after also include:
After by predetermined period, the monitoring programme is performed, the master-slave synchronisation state to the database is monitored.
6. a kind of device of database master-slave synchronisation condition monitoring, it is characterised in that including:
Calling module, it is automatic to perform preset structure query statement for calling the first programming function, draw implementing result;
First judge module, for according to the implementing result, judging whether the master-slave synchronisation state of database is normal.
7. device as claimed in claim 6, it is characterised in that also include:
Second judge module, for calling the second programming function, tests the port status of the database, judges whether to meet pre-
If condition of contact;
Module is set up, for when the default condition of contact is met, then carrying out subsequent step;
First alarm module, for when the default condition of contact is not met, generates the first alarm email, and by the alarm
Mail is sent to the first default addressee.
8. device as claimed in claim 7, it is characterised in that first alarm module includes:
First abnormal information acquiring unit, the first abnormal information for obtaining the database;
Generation unit, for according to first abnormal information and the first default email template, generating the first alarm postal
Part;
Transmitting element, for first alarm email to be sent to the described first default addressee.
9. the device as described in any one of claim 6 to 8, it is characterised in that also include:
Stopping modular, for when the master-slave synchronisation state for judging the database is normal, stopping performing monitoring programme;
Acquisition module, for when judge the master-slave synchronisation state of the database for it is abnormal when, obtain the of the database
Two abnormal informations;
Generation module, for according to second abnormal information and the second default email template, generating the second alarm email;
Sending module, for second alarm email to be sent to the second default addressee.
10. device as claimed in claim 9, it is characterised in that also include:
Timing performing module, for after by predetermined period, performing the monitoring programme, the principal and subordinate to the database is same
Step state is monitored.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710157201.6A CN106844163A (en) | 2017-03-16 | 2017-03-16 | The method and device of a kind of database master-slave synchronisation condition monitoring |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710157201.6A CN106844163A (en) | 2017-03-16 | 2017-03-16 | The method and device of a kind of database master-slave synchronisation condition monitoring |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106844163A true CN106844163A (en) | 2017-06-13 |
Family
ID=59144641
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710157201.6A Pending CN106844163A (en) | 2017-03-16 | 2017-03-16 | The method and device of a kind of database master-slave synchronisation condition monitoring |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106844163A (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109508356A (en) * | 2018-11-14 | 2019-03-22 | 平安科技(深圳)有限公司 | Data exception method for early warning, device, computer equipment and storage medium |
WO2019232948A1 (en) * | 2018-06-05 | 2019-12-12 | 平安科技(深圳)有限公司 | Method and system for monitoring automatic sending of email, computer device, and storage medium |
CN110855526A (en) * | 2019-11-20 | 2020-02-28 | 北京百分点信息科技有限公司 | Method and device for detecting data source connection, storage medium and electronic equipment |
CN111008123A (en) * | 2019-10-23 | 2020-04-14 | 贝壳技术有限公司 | Database testing method and device, storage medium and electronic equipment |
CN111459905A (en) * | 2020-02-28 | 2020-07-28 | 上海维信荟智金融科技有限公司 | Method and system for realizing MySQ L database monitoring script |
CN111694894A (en) * | 2020-04-26 | 2020-09-22 | 中国建设银行股份有限公司 | Method, server, device and storage medium for monitoring data synchronization |
CN113609230A (en) * | 2021-09-16 | 2021-11-05 | 平安国际智慧城市科技股份有限公司 | Data synchronization abnormity warning method and device, computer equipment and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102231161A (en) * | 2011-06-30 | 2011-11-02 | 北京新媒传信科技有限公司 | Method for synchronously verifying and monitoring databases |
US20140167955A1 (en) * | 2012-12-18 | 2014-06-19 | Cellco Partnership (D/B/A Verizon Wireless) | Emergency responder accountability alarm |
CN104252500A (en) * | 2013-06-29 | 2014-12-31 | 北京新媒传信科技有限公司 | Method and device for carrying out fault repairing on database management platform |
CN106156318A (en) * | 2016-07-05 | 2016-11-23 | 武汉斗鱼网络科技有限公司 | A kind of system and method realizing multinode data base's High Availabitity |
-
2017
- 2017-03-16 CN CN201710157201.6A patent/CN106844163A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102231161A (en) * | 2011-06-30 | 2011-11-02 | 北京新媒传信科技有限公司 | Method for synchronously verifying and monitoring databases |
US20140167955A1 (en) * | 2012-12-18 | 2014-06-19 | Cellco Partnership (D/B/A Verizon Wireless) | Emergency responder accountability alarm |
CN104252500A (en) * | 2013-06-29 | 2014-12-31 | 北京新媒传信科技有限公司 | Method and device for carrying out fault repairing on database management platform |
CN106156318A (en) * | 2016-07-05 | 2016-11-23 | 武汉斗鱼网络科技有限公司 | A kind of system and method realizing multinode data base's High Availabitity |
Non-Patent Citations (2)
Title |
---|
北风刮的不认真了: "mysql主从配置和监测同步状态", 《HTTPS://MY.OSCHINA.NET/NORTHERSONG/BLOG/425255》 * |
抚琴煮酒: "自动监控主从MySQL同步的SHELL脚本", 《HTTPS://BLOG.51CTO.COM/YUHONGCHUN/666019》 * |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2019232948A1 (en) * | 2018-06-05 | 2019-12-12 | 平安科技(深圳)有限公司 | Method and system for monitoring automatic sending of email, computer device, and storage medium |
CN109508356A (en) * | 2018-11-14 | 2019-03-22 | 平安科技(深圳)有限公司 | Data exception method for early warning, device, computer equipment and storage medium |
CN109508356B (en) * | 2018-11-14 | 2024-05-03 | 平安科技(深圳)有限公司 | Data abnormality early warning method, device, computer equipment and storage medium |
CN111008123A (en) * | 2019-10-23 | 2020-04-14 | 贝壳技术有限公司 | Database testing method and device, storage medium and electronic equipment |
CN111008123B (en) * | 2019-10-23 | 2023-10-24 | 贝壳技术有限公司 | Database testing method and device, storage medium and electronic equipment |
CN110855526A (en) * | 2019-11-20 | 2020-02-28 | 北京百分点信息科技有限公司 | Method and device for detecting data source connection, storage medium and electronic equipment |
CN111459905A (en) * | 2020-02-28 | 2020-07-28 | 上海维信荟智金融科技有限公司 | Method and system for realizing MySQ L database monitoring script |
CN111694894A (en) * | 2020-04-26 | 2020-09-22 | 中国建设银行股份有限公司 | Method, server, device and storage medium for monitoring data synchronization |
CN113609230A (en) * | 2021-09-16 | 2021-11-05 | 平安国际智慧城市科技股份有限公司 | Data synchronization abnormity warning method and device, computer equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106844163A (en) | The method and device of a kind of database master-slave synchronisation condition monitoring | |
CN108108297B (en) | Method and device for automatic testing | |
CN107291565B (en) | Operation and maintenance visual automatic operation platform and implementation method | |
CN109495308B (en) | Automatic operation and maintenance system based on management information system | |
CN106095677B (en) | The RESTful Webservice automatic interface testing methods realized based on Robot Framework | |
CN105159964B (en) | A kind of log monitoring method and system | |
US8595831B2 (en) | Method and system for cyber security management of industrial control systems | |
US6493755B1 (en) | Automatic notification rule definition for a network management system | |
CN111092786B (en) | Network equipment safety authentication service reliability enhancing system | |
CN103295155B (en) | Security core service system method for supervising | |
CN103067230A (en) | Method for achieving hyper text transport protocol (http) service monitoring through embedding monitoring code | |
CN108377255A (en) | Information processing unit, information processing method and recording medium | |
CN107819611B (en) | Client test method based on IEC61850 multi-server simulation | |
CN102833120B (en) | The abnormal method and system of NM server are processed in a kind of rapid automatized test | |
WO2022151815A1 (en) | Method and apparatus for determining security state of terminal device | |
CN107800783A (en) | The method and device of remote monitoring server | |
CN109254922A (en) | A kind of automated testing method and device of server B MC Redfish function | |
CN107168844B (en) | Performance monitoring method and device | |
CN108376111A (en) | Information processing unit, information processing method and recording medium | |
CN112787895A (en) | Network inspection method, device and equipment | |
US20150370675A1 (en) | Methods, systems, and computer readable media for utilizing abstracted user-defined data to conduct network protocol testing | |
CN115016960B (en) | Configurable RPA robot full-flow information notification processing method and system | |
CN106897189A (en) | A kind of daily record monitoring system based on data real time propelling movement | |
CN104618474B (en) | Facility information store method and device | |
CN106357466A (en) | Monitoring method for internet products and monitoring system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20170613 |