CN115102886A - Task scheduling method and device for multiple acquisition clients - Google Patents

Task scheduling method and device for multiple acquisition clients Download PDF

Info

Publication number
CN115102886A
CN115102886A CN202210703702.0A CN202210703702A CN115102886A CN 115102886 A CN115102886 A CN 115102886A CN 202210703702 A CN202210703702 A CN 202210703702A CN 115102886 A CN115102886 A CN 115102886A
Authority
CN
China
Prior art keywords
acquisition
interface
heartbeat
election
task scheduling
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
Application number
CN202210703702.0A
Other languages
Chinese (zh)
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.)
Shanghai Cloudcare Information Technology Co ltd
Original Assignee
Shanghai Cloudcare Information 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 Shanghai Cloudcare Information Technology Co ltd filed Critical Shanghai Cloudcare Information Technology Co ltd
Priority to CN202210703702.0A priority Critical patent/CN115102886A/en
Publication of CN115102886A publication Critical patent/CN115102886A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/10Active monitoring, e.g. heartbeat, ping or trace-route

Landscapes

  • Health & Medical Sciences (AREA)
  • Cardiology (AREA)
  • General Health & Medical Sciences (AREA)
  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The invention provides a task scheduling method and a device for a plurality of acquisition clients, wherein the task scheduling method comprises the following steps: s1, an election interface and a heartbeat interface are arranged in a central election service center, a plurality of acquisition clients all call the election interface, and one acquisition client which is successfully called first obtains acquisition right; s2, the acquisition client which successfully obtains the acquisition right calls the heartbeat interface; and S3, judging whether the heartbeat interface returns to the step S1 or continues to collect data according to the calling state of the heartbeat interface. The method is used for solving the problem of consistency of data acquisition of the public objects and ensuring the unicity of the data acquired by the public objects.

Description

Task scheduling method and device for multiple acquisition clients
Technical Field
The invention belongs to the technical field of computers, and particularly belongs to a task scheduling method and device for a plurality of acquisition clients.
Background
In a complex cluster, various data acquisition characteristics are different, so that the behavior of an acquisition program has certain uncertainty, some data can only be acquired by one acquisition device, because the data is a public resource at the cluster level, and when the cluster is dynamically expanded, if an acquisition client is fixedly allowed to acquire the public resource, the acquisition of a public object is lost or disordered after the acquisition client fails or dynamically expands the capacity.
In view of the above, the present invention is particularly proposed.
Disclosure of Invention
In view of this, the invention discloses a task scheduling method and device for multiple collection clients, which are used for solving the problem that collection of cluster common object data is stable and ensuring that collected data has unicity.
Specifically, the invention is realized by the following technical scheme:
in a first aspect, the present invention discloses a task scheduling method for multiple acquisition clients, which specifically includes the following steps:
s1, an election interface and a heartbeat interface are arranged in a central election service center, a plurality of acquisition clients all call the election interface, and one acquisition client which is successfully called first obtains acquisition right;
s2, the acquisition client successfully acquiring the acquisition right calls the heartbeat interface;
and S3, judging whether the heartbeat interface returns to the step S1 or continues to collect data according to the calling state of the heartbeat interface.
Further, in the step S1, other acquisition clients that have not been successfully called are in a standby state until acquisition rights are successfully acquired to resume acquisition.
Further, the plurality of collecting clients in the standby state call an election interface periodically to participate in election.
Specifically, in the return command of the election interface, if the election of the acquisition client in the standby state fails, the acquisition client that is currently successfully elected is informed of which acquisition client is, and if the election is successfully elected, the election right falls to the current acquisition client, and meanwhile, the acquisition client enters the acquisition state.
Further, in the step S2, the time when the acquisition client obtains the acquisition right invokes the heartbeat interface is called periodically.
Specifically, whether the acquisition client currently acquiring the acquisition right continues to acquire the acquisition right can be known by calling the heartbeat interface.
Further, in the step S3, the determining method includes:
if the acquisition client fails to call the heartbeat interface, the acquisition right of the acquisition client is rejected, and the step S1 is returned to reselect;
and if the acquisition client side successfully calls the heartbeat interface, continuing to acquire data.
Further, data collection is suspended after the collection right of the collection client is rejected.
Specifically, the acquisition client enters a standby state after data acquisition is suspended.
In a second aspect, the present invention discloses a task scheduling device for multiple acquisition clients, comprising:
an election module: the method comprises the steps that an election interface and a heartbeat interface are arranged in a central election service center, a plurality of acquisition client sides call the election interface, and one acquisition client side which is successfully called firstly obtains acquisition right;
a heartbeat interface calling module: one acquisition client which successfully obtains the acquisition right calls the heartbeat interface;
the heartbeat interface calls the state module: and judging whether the heartbeat interface elects again or continues to collect data according to the calling state of the heartbeat interface.
In a third aspect, the invention discloses a computer readable storage medium having stored thereon a computer program which, when being executed by a processor, carries out the steps of the task scheduling method according to the first aspect.
In a fourth aspect, the present invention discloses a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the task scheduling method according to the first aspect when executing the program.
Compared with the prior art, the invention has the beneficial effects that: when the public object is collected, the election interface is arranged, so that the situation that only one collecting client calling the election interface successfully collects data normally at any time point can be ensured, other collecting clients failing to select data are in a standby state, whether the collecting client successfully acquiring the collecting right collects data normally or not is judged through the heartbeat interface, and after the collecting client successfully acquiring the collecting right fails to call the heartbeat interface, other collecting clients in the standby state select data again, the public object is collected continuously, and the continuity of the collected data is ensured.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a schematic flowchart of a task scheduling method for a plurality of acquisition clients according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a task scheduling method according to an embodiment of the present invention;
fig. 3 is a schematic diagram of an apparatus for scheduling tasks of multiple acquisition clients according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings and the detailed description, but those skilled in the art will understand that the following described embodiments are some, not all, of the embodiments of the present invention, and are only used for illustrating the present invention, and should not be construed as limiting the scope of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In order to more clearly explain the technical solution of the present invention, the following description is made in the form of specific embodiments.
Examples
Referring to fig. 1, the invention discloses a task scheduling method for a plurality of acquisition clients, comprising the following steps:
s1, setting an election interface and a heartbeat interface in a central election service center, calling the election interface by a plurality of acquisition clients, and calling the acquisition client which succeeds first to obtain an acquisition right;
s2, the acquisition client which successfully obtains the acquisition right calls the heartbeat interface;
and S3, judging whether the heartbeat interface call back to the step S1 or continues to collect data according to the calling state of the heartbeat interface.
Referring to fig. 2, the embodiment of the present invention is specifically realized by the following steps:
in the cluster, a plurality of acquisition clients exist, each acquisition client is configured identically, and in order to realize the monopoly of acquisition of public resources, a central scheduling is performed on the plurality of acquisition clients of the cluster, so that the unicity of data acquisition is realized.
Specifically, when the collection clients are deployed in the cluster, the election function is started on the configuration of each collection client, an election range is designated, and the common resources of the cluster are collected, preferably, for a plurality of clusters, the election range of each cluster may be different, so that a plurality of collection clients can be elected to collect different common resources.
Specifically, an election interface and a heartbeat interface are arranged on a central server, when a plurality of acquisition clients in a cluster are started, the election interface is called, and one acquisition client which is successfully called first can elect to obtain an acquisition right, specifically, referring to fig. 2, after the acquisition clients a/B are started, the election interface is called, assuming that the acquisition client a successfully obtains the acquisition right, and then the acquisition client a starts to regularly call the heartbeat interface on the central server, as shown by a solid line 2 in the figure; the acquisition client B and other acquisition clients which are not successfully called are in a standby state, and the election interface is continuously called, as shown by a dotted line; judging whether to continue data acquisition according to the state of the acquisition client A calling the heartbeat interface, if the acquisition client A successfully calls the heartbeat interface, the acquisition client A can continue to acquire data of the public object, as shown by a solid line 3 in the figure; if the acquisition client A fails to call the heartbeat interface, the central server rejects the acquisition right of the acquisition client A and reselects to realize the continuity of the acquisition of the public object data.
In addition, the present invention further provides a task scheduling apparatus for multiple collection clients, as shown in fig. 3, specifically including:
an election module: the method comprises the steps that an election interface and a heartbeat interface are arranged in a central election service center, a plurality of acquisition client sides call the election interface, and one acquisition client side which is successfully called firstly obtains acquisition right;
the heartbeat interface calls the module: one acquisition client which successfully obtains the acquisition right calls the heartbeat interface;
the heartbeat interface calls the state module: and judging whether the heartbeat interface elects again or continues to collect data according to the calling state of the heartbeat interface.
The system mainly comprises the three modules, and the aim of simultaneously mounting the same file system and realizing parallel operation can be well realized through the construction of the system.
In specific implementation, the above modules may be implemented as independent entities, or may be combined arbitrarily to be implemented as the same or several entities, and specific implementation of the above units may refer to the foregoing method embodiments, which are not described herein again.
Fig. 4 is a schematic structural diagram of a computer device disclosed in the present invention. Referring to fig. 4, the computer device 400 includes at least a memory 402 and a processor 401; the memory 402 is connected to the processor through a communication bus 403 for storing computer instructions executable by the processor 401, and the processor 301 is configured to read the computer instructions from the memory 402 to implement the steps of the task scheduling method according to the above embodiment.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (9)

1. A task scheduling method for a plurality of acquisition clients is characterized by comprising the following steps:
s1, setting an election interface and a heartbeat interface in a central election service center, calling the election interface by a plurality of acquisition clients, and calling the acquisition client which succeeds first to obtain an acquisition right;
s2, the acquisition client which successfully obtains the acquisition right calls the heartbeat interface;
and S3, judging whether the heartbeat interface returns to the step S1 or continues to collect data according to the calling state of the heartbeat interface.
2. The method according to claim 1, wherein in the step S1, other collection clients that have not successfully called are in a standby state until collection rights are successfully obtained to resume collection.
3. The task scheduling method of claim 2 wherein the plurality of collecting clients in the armed state periodically invoke an election interface to participate in elections.
4. The task scheduling method according to claim 1, wherein in the step S2, the time when the acquisition client obtaining the acquisition right calls the heartbeat interface is a regular call.
5. The task scheduling method according to claim 1, wherein in the step S3, the judging method comprises:
if the acquisition client side fails to call the heartbeat interface, the acquisition right of the acquisition client side is rejected, and the step S1 is returned to reselect;
and if the acquisition client side successfully calls the heartbeat interface, continuing to acquire data.
6. The task scheduling method according to claim 5, wherein data collection is suspended after the collection right of the collection client is rejected.
7. An apparatus for task scheduling according to any of claims 1-6, comprising:
an election module: the method comprises the steps that an election interface and a heartbeat interface are arranged in a central election service center, a plurality of acquisition client sides call the election interface, and one acquisition client side which is successfully called firstly obtains acquisition right;
the heartbeat interface calls the module: one acquisition client which successfully obtains the acquisition right calls the heartbeat interface;
the heartbeat interface calls a state module: according to the calling state of the heartbeat interface, whether the heartbeat interface returns to the step of S1 or continues to collect data is judged.
8. A computer-readable storage medium, on which a computer program is stored, which, when being executed, carries out the steps of the task scheduling method according to any one of claims 1 to 6.
9. A computer arrangement comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor, when executing the program, carries out the steps of the task scheduling method according to any of claims 1-6.
CN202210703702.0A 2022-06-21 2022-06-21 Task scheduling method and device for multiple acquisition clients Pending CN115102886A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210703702.0A CN115102886A (en) 2022-06-21 2022-06-21 Task scheduling method and device for multiple acquisition clients

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210703702.0A CN115102886A (en) 2022-06-21 2022-06-21 Task scheduling method and device for multiple acquisition clients

Publications (1)

Publication Number Publication Date
CN115102886A true CN115102886A (en) 2022-09-23

Family

ID=83293418

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210703702.0A Pending CN115102886A (en) 2022-06-21 2022-06-21 Task scheduling method and device for multiple acquisition clients

Country Status (1)

Country Link
CN (1) CN115102886A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104065741A (en) * 2014-07-04 2014-09-24 用友软件股份有限公司 Data collection system and method
CN106301853A (en) * 2015-06-05 2017-01-04 华为技术有限公司 The fault detection method of group system interior joint and device
CN109669820A (en) * 2018-12-24 2019-04-23 广州君海网络科技有限公司 Task monitoring and managing method and device based on Kettle
CN113282041A (en) * 2021-05-26 2021-08-20 广东电网有限责任公司 Parameter checking method, system, equipment and medium for cluster measurement and control device
CN114064414A (en) * 2021-11-25 2022-02-18 北京志凌海纳科技有限公司 High-availability cluster state monitoring method and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104065741A (en) * 2014-07-04 2014-09-24 用友软件股份有限公司 Data collection system and method
CN106301853A (en) * 2015-06-05 2017-01-04 华为技术有限公司 The fault detection method of group system interior joint and device
CN109669820A (en) * 2018-12-24 2019-04-23 广州君海网络科技有限公司 Task monitoring and managing method and device based on Kettle
CN113282041A (en) * 2021-05-26 2021-08-20 广东电网有限责任公司 Parameter checking method, system, equipment and medium for cluster measurement and control device
CN114064414A (en) * 2021-11-25 2022-02-18 北京志凌海纳科技有限公司 High-availability cluster state monitoring method and system

Similar Documents

Publication Publication Date Title
CN107453929B (en) Cluster system self-construction method and device and cluster system
CN108810100B (en) Method, device and equipment for electing master node
CN105468450B (en) Method for scheduling task and system
CN108881512B (en) CTDB virtual IP balance distribution method, device, equipment and medium
CN108712457B (en) Method and device for adjusting dynamic load of back-end server based on Nginx reverse proxy
CN109173270B (en) Game service system and implementation method
CN109802986B (en) Equipment management method, system, device and server
CN108322358B (en) Method and device for sending, processing and consuming multi-live distributed messages in different places
CN110351311B (en) Load balancing method
CN111163173B (en) Cluster configuration method and device, server and readable storage medium
CN112104727B (en) Method and system for deploying simplified high-availability Zookeeper cluster
CN105871983A (en) Method and device for selecting servers
EP3813335A1 (en) Service processing method and system based on alliance chain network
CN112612769A (en) File processing method, device and storage medium
CN111694518A (en) Method, device and equipment for automatically migrating data after cluster expansion or contraction
CN114844809A (en) Multi-factor arbitration method and device based on network heartbeat and kernel disk heartbeat
CN115102886A (en) Task scheduling method and device for multiple acquisition clients
CN113765690A (en) Cluster switching method, system, device, terminal, server and storage medium
JP2009086741A (en) Distributed processing control method in heterogeneous node existing distributed environment and its system and its program
CN115134835B (en) Internet of things networking system and gateway selection method
CN110650135B (en) Node processing method, related equipment and computer readable storage medium
CN114039836A (en) Fault processing method and device for Exporter collector
CN114339711A (en) Internet access system and method based on distributed architecture
CN113625946A (en) Method, system and computer equipment for implementing arbitration of storage cluster
CN114760361B (en) Service request distribution method, system, equipment and storage medium

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