CN111104290A - Database instance inspection method and device and computer storage medium - Google Patents

Database instance inspection method and device and computer storage medium Download PDF

Info

Publication number
CN111104290A
CN111104290A CN201911370335.1A CN201911370335A CN111104290A CN 111104290 A CN111104290 A CN 111104290A CN 201911370335 A CN201911370335 A CN 201911370335A CN 111104290 A CN111104290 A CN 111104290A
Authority
CN
China
Prior art keywords
sentinel
processes
database
instances
total number
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.)
Granted
Application number
CN201911370335.1A
Other languages
Chinese (zh)
Other versions
CN111104290B (en
Inventor
程铖
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Unicloud Nanjing Digital Technology Co Ltd
Original Assignee
Unicloud Nanjing Digital Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Unicloud Nanjing Digital Technology Co Ltd filed Critical Unicloud Nanjing Digital Technology Co Ltd
Priority to CN201911370335.1A priority Critical patent/CN111104290B/en
Publication of CN111104290A publication Critical patent/CN111104290A/en
Application granted granted Critical
Publication of CN111104290B publication Critical patent/CN111104290B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Mathematical Physics (AREA)
  • Quality & Reliability (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Debugging And Monitoring (AREA)

Abstract

Provided are a method and a device for patrolling database instances. Wherein the method comprises: when the sentinel processes are started, acquiring the total number of the sentinel processes in the starting state and the corresponding starting sequence of the sentinel processes; grouping database instances, wherein each group includes M instances, M being a positive integer; and (3) the sentinel processes inspect N adjacent groups of examples according to the starting sequence of the sentinel processes, wherein at least one group of the inspection examples of the two adjacent sentinel processes is the same, and N is a positive integer greater than 1. The scheme of the invention realizes that a plurality of sentinels simultaneously carry out the routing inspection task, and improves the routing inspection efficiency; and each database instance can be ensured to be inspected, and the database instance is prevented from being missed.

Description

Database instance inspection method and device and computer storage medium
Technical Field
The invention belongs to the field of computers, and particularly relates to a method and a device for routing inspection of a database instance and a computer readable storage medium.
Background
At present, MySQL database examples are provided on various big cloud service platforms, so that the problems that how to automatically monitor the running state of the MySQL database examples and how to distribute the inspection range of a plurality of sentinel processes are needed to be solved.
The prior technical schemes comprise the following steps: one method is to start only one sentinel process or start a plurality of sentinel processes, but only one sentinel process is used for polling, and all polling tasks are completed by the sentinel. One is to start a plurality of sentinel processes and distribute a database instance to be inspected to each sentinel process according to a hash algorithm.
The first scheme cannot guarantee the high availability of the system, and the inspection cycle is long; if a plurality of sentinels are started, only one sentinel works, and other sentinels run idle, so that system resources are wasted.
The second scheme above has the problem that when a sentinel carries out an abnormality, the corresponding database instance is not patrolled. In addition, the number of the database instances is dynamically changed, and the database instances to be inspected are distributed according to the hash algorithm, so that some database instances can be missed, and several rounds of inspection can be missed.
Disclosure of Invention
In view of the above-mentioned deficiencies of the prior art, one of the objectives of the present invention is to solve the problem of missed inspection of database instances, and at the same time, to improve the efficiency of sentinel progress inspection.
The embodiment of the invention discloses a method for inspecting a database instance, which comprises the following steps: when the sentinel processes are started, acquiring the total number of the sentinel processes in the starting state and the corresponding starting sequence of the sentinel processes; grouping database instances, wherein each group includes M instances, M being a positive integer; and (3) the sentinel processes inspect N adjacent groups of examples according to the starting sequence of the sentinel processes, wherein at least one group of the inspection examples of the two adjacent sentinel processes is the same, and N is a positive integer greater than 1.
In one possible embodiment, said N is 2.
In one possible embodiment, the last sentinel process patrols the last set of database instances and the first set of database instances.
In one possible embodiment, the M is the quotient of the total number of database instances and the total number of sentinel processes.
The embodiment of the invention also discloses a patrol inspection device of the database instance, which comprises: the obtaining module is used for obtaining the total number of the sentinel processes in the starting state and the corresponding starting sequence of the sentinel processes after the sentinel processes are started; a grouping module for grouping database instances, wherein each group includes M instances, M being a positive integer; and the inspection module is used for inspecting the adjacent N groups of examples by the sentinel processes according to the starting sequence of the sentinel processes, wherein at least one group of the adjacent two sentinel process inspection examples is the same, and N is a positive integer greater than 1.
In one possible embodiment, said N is 2.
In one possible embodiment, the patrol module is further configured to patrol the last group of database instances and the first group of database instances for the last sentinel process.
In one possible embodiment, the M is the quotient of the total number of database instances and the total number of sentinel processes.
The invention also discloses a computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, and when the computer program is executed by a processor, the computer program realizes the inspection method of any one database instance.
The invention has the beneficial effects that: the scheme of the invention realizes that a plurality of sentinels simultaneously carry out the routing inspection task, and improves the routing inspection efficiency; and each database instance can be ensured to be inspected, and the database instance is prevented from being missed.
Drawings
FIG. 1 is a flow chart of a method according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of an apparatus according to an embodiment of the present invention.
Detailed Description
In order to facilitate understanding of those skilled in the art, the present invention will be further described with reference to the following examples and drawings, which are not intended to limit the present invention.
The embodiment of the invention discloses a method for inspecting a database instance, which comprises the following steps:
s101, after the sentinel processes are started, obtaining the total number of the sentinel processes in the starting state and the corresponding starting sequence of the sentinel processes.
Specifically, the sentinel processes are sequentially started to patrol the database instances in the patrol range. And after the sentinel carries out A starting, acquiring the total number of all the sentinel processes in the starting state and the starting sequence of the sentinel processes. The starting sequence of the sentinels can be identified through system time, and can also be identified according to the starting sequence in a digital sequence and other modes.
S102, grouping the database instances, wherein each group comprises M instances, and M is a positive integer.
The database instances to be inspected are grouped according to a certain rule, and the grouped database instances can be called instance groups. Specifically, the total number of database instances to be inspected needs to be acquired first, and then grouping is performed, where each group includes M database instances. In one embodiment, M may be the quotient of the total number of database instances and the total number of sentinel processes, and M is a positive integer, for example, the total number of database instances is 10, the total number of sentinel processes is 3, and M is 3, wherein the last group of instances is less than 3, and may or may not be complemented by the first two instances of the first group.
In one embodiment, the data path is a MySQL database.
S103, the sentinel processes patrol the adjacent N groups of examples according to the starting sequence, wherein at least one group of the examples patrolled by the two adjacent sentinel processes is the same, and N is a positive integer greater than 1.
Specifically, the currently started sentinel process can acquire the corresponding patrol range in the following manner: one sentinel process can patrol multiple instance groups, and the preferred N can be 2; in one embodiment, the sentinel processes sequentially patrol two adjacent groups of instances in their starting order, and at least one group of instances is identical to the group of instances that the previous sentinel process patrols. For example, a sentinel process with order 1 examines group 1 and group 2, a sentinel process with order 2 examines group 2 and group 3, and so on, and the last sentinel process examines the last group of instances and group 1 of instances.
The multiple sentinels are used for polling the instance group according to the starting sequence, so that the problem that a single sentinel cannot effectively utilize system resources is solved; the problem that a single sentinel stops abnormally and the database instance cannot be inspected is solved; the problem that database instances are likely to be omitted when a plurality of sentinels are distributed to patrol the database instances by using a hash algorithm is solved.
The embodiment of the invention also discloses an inspection device 10 of the database example, as shown in fig. 2, which comprises an acquisition module 101, a processing module and a processing module, wherein the acquisition module 101 is used for acquiring the total number of the sentinel processes in the starting state and the corresponding starting sequence of the sentinel processes after the sentinel processes are started; a grouping module 102 for grouping database instances, wherein each group includes M instances, M being a positive integer; and the inspection module 103 is used for inspecting the adjacent N groups of examples by the sentinel processes according to the starting sequence of the sentinel processes, wherein at least one group of the adjacent two sentinel process inspection examples is the same, and N is a positive integer greater than 1.
Preferably, N may be 2.
In one embodiment, the patrol module 103 is also used for the last sentinel process to patrol the last and first sets of database instances.
In one embodiment, the M is the quotient of the total number of database instances and the total number of sentinel processes.
For the specific implementation of the apparatus 10, reference may be made to the method embodiment, which is not described in detail.
The embodiment of the invention also discloses electronic equipment, which comprises a processor and a memory, wherein the memory stores a computer program, and the computer program is used for realizing the inspection method of the database example in the embodiment; the processor is configured to execute the computer program.
In one embodiment, the electronic device may be a computer device such as a client, a server, or the like.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described embodiments are merely illustrative, and for example, a division of a unit is merely a division of a logic function, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed.
While the invention has been described in terms of its preferred embodiments, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention.

Claims (10)

1. A method for polling a database instance is characterized by comprising the following steps: when the sentinel processes are started, acquiring the total number of the sentinel processes in the starting state and the corresponding starting sequence of the sentinel processes; grouping database instances, wherein each group includes M instances, M being a positive integer; and (3) the sentinel processes inspect N adjacent groups of examples according to the starting sequence of the sentinel processes, wherein at least one group of the inspection examples of the two adjacent sentinel processes is the same, and N is a positive integer greater than 1.
2. The method of claim 1, wherein N is 2.
3. The method of claim 2, wherein the last sentinel process patrols the last set of database instances and the first set of database instances.
4. The method of claim 1, wherein M is the quotient of the total number of database instances and the total number of sentinel processes.
5. An inspection device of a database instance, comprising: the obtaining module is used for obtaining the total number of the sentinel processes in the starting state and the corresponding starting sequence of the sentinel processes after the sentinel processes are started; a grouping module for grouping database instances, wherein each group includes M instances, M being a positive integer; and the inspection module is used for inspecting the adjacent N groups of examples by the sentinel processes according to the starting sequence of the sentinel processes, wherein at least one group of the adjacent two sentinel process inspection examples is the same, and N is a positive integer greater than 1.
6. The apparatus of claim 1, wherein N is 2.
7. The apparatus of claim 2, wherein the inspection module is further configured to inspect the last set of database instances and the first set of database instances for a last sentinel process.
8. The apparatus of claim 1, wherein M is a quotient of a total number of database instances and a total number of the sentinel processes.
9. A computer storage medium having stored thereon a computer program which, when executed by a processor, implements a method of routing inspection of a database instance as claimed in any one of claims 1 to 4.
10. An electronic device comprising a processor and a memory, wherein the memory is used for storing a computer program corresponding to the method according to any one of claims 1-4, and the processor is used for executing the computer program.
CN201911370335.1A 2019-12-26 2019-12-26 Database instance inspection method and device and computer storage medium Active CN111104290B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911370335.1A CN111104290B (en) 2019-12-26 2019-12-26 Database instance inspection method and device and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911370335.1A CN111104290B (en) 2019-12-26 2019-12-26 Database instance inspection method and device and computer storage medium

Publications (2)

Publication Number Publication Date
CN111104290A true CN111104290A (en) 2020-05-05
CN111104290B CN111104290B (en) 2022-11-25

Family

ID=70424629

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911370335.1A Active CN111104290B (en) 2019-12-26 2019-12-26 Database instance inspection method and device and computer storage medium

Country Status (1)

Country Link
CN (1) CN111104290B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112988502A (en) * 2020-12-28 2021-06-18 紫光云技术有限公司 Method for cooperatively inspecting Kafka middleware examples by multiple sentinels

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107016087A (en) * 2017-04-05 2017-08-04 杭州铭师堂教育科技发展有限公司 Hierarchical database high-availability system based on sentry's model
CN107343034A (en) * 2017-06-26 2017-11-10 杭州铭师堂教育科技发展有限公司 Redis high-availability systems and method based on QConf
US20180121304A1 (en) * 2016-10-27 2018-05-03 Machine Zone, Inc. System and method for managing a cluster of cache servers (trask)
CN108040507A (en) * 2015-06-10 2018-05-15 迈可菲有限责任公司 Sentry's equipment in Internet of Things field

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108040507A (en) * 2015-06-10 2018-05-15 迈可菲有限责任公司 Sentry's equipment in Internet of Things field
US20180121304A1 (en) * 2016-10-27 2018-05-03 Machine Zone, Inc. System and method for managing a cluster of cache servers (trask)
CN110140119A (en) * 2016-10-27 2019-08-16 Mz知识产权控股有限责任公司 System and method for managing cache server cluster
CN107016087A (en) * 2017-04-05 2017-08-04 杭州铭师堂教育科技发展有限公司 Hierarchical database high-availability system based on sentry's model
CN107343034A (en) * 2017-06-26 2017-11-10 杭州铭师堂教育科技发展有限公司 Redis high-availability systems and method based on QConf

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112988502A (en) * 2020-12-28 2021-06-18 紫光云技术有限公司 Method for cooperatively inspecting Kafka middleware examples by multiple sentinels

Also Published As

Publication number Publication date
CN111104290B (en) 2022-11-25

Similar Documents

Publication Publication Date Title
CN109213600B (en) GPU resource scheduling method and device based on AI cloud
CN105117289B (en) Method for allocating tasks, apparatus and system based on cloud test platform
CN104123184B (en) A kind of method and system for being used to distribute resource for the task in building process
US8959228B2 (en) Optimization of resource utilization in a collection of devices
CN105279017B (en) Method for allocating tasks, apparatus and system based on cloud test platform
CN109298924B (en) Timing task management method, computer readable storage medium and terminal device
US20120284384A1 (en) Computer processing method and system for network data
US9210219B2 (en) Systems and methods for consistent hashing using multiple hash rings
CN105677462A (en) Distributed task system based on internet of things and business processing method
CN107196781B (en) Security configuration checking task allocation method and device
CN105512038A (en) Database based automation parallel test platform execution method
CN111045811A (en) Task allocation method and device, electronic equipment and storage medium
CN105095299A (en) Picture capturing method and system
CN108363786A (en) Load method, apparatus, computer equipment and the storage medium of data
CN111104290B (en) Database instance inspection method and device and computer storage medium
US10326824B2 (en) Method and system for iterative pipeline
CN104317947A (en) Mass data-based real-time structural data comparison system
CN115328741A (en) Exception handling method, device, equipment and storage medium
CN111831503A (en) Monitoring method based on monitoring agent and monitoring agent device
CN111949389B (en) Slurm-based information acquisition method and device, server and computer-readable storage medium
CN109597697A (en) A kind of resource brings processing method and processing device together
CN107092556B (en) Test method, device and equipment
CN108664322A (en) Data processing method and system
US10268727B2 (en) Batching tuples
CN107193749B (en) Test method, device and equipment

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
GR01 Patent grant
GR01 Patent grant