WO2018196154A1 - 任务处理方法、系统、终端及计算机可读存储介质 - Google Patents
任务处理方法、系统、终端及计算机可读存储介质 Download PDFInfo
- Publication number
- WO2018196154A1 WO2018196154A1 PCT/CN2017/090314 CN2017090314W WO2018196154A1 WO 2018196154 A1 WO2018196154 A1 WO 2018196154A1 CN 2017090314 W CN2017090314 W CN 2017090314W WO 2018196154 A1 WO2018196154 A1 WO 2018196154A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- task
- server
- zookeeper
- directory
- copy
- 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.)
- Ceased
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/004—Error avoidance
Definitions
- Task processing method system, terminal and computer readable storage medium
- the present invention relates to the field of communications technologies, and in particular, to a task processing method, system, terminal, and computer readable storage medium.
- the Consumer Credit Self-Service ([CFS_SS], SS) system usually inserts a record into the database in order to prevent the fixed task (JOB) from being repeatedly executed by multiple servers, for example, inserting a task's expired time.
- the server performs the task it first checks whether the expiration of the task is valid. If it is valid, it indicates that the server is executing the task. If it is invalid, it indicates that no server is executing the task, that is, the task can be executed.
- the disadvantage of this method is that when there are deviations between different servers, it may cause multiple servers to perform the same task at the same time, causing the server to malfunction.
- the embodiments of the present invention provide a task processing method, a system, a terminal, and a computer readable storage medium, to solve the problem in the prior art when there are deviations between different servers, which may cause multiple servers to be the same. ⁇ A situation in which the same task is executed, causing the server to malfunction.
- a first aspect of the embodiments of the present invention provides a task processing method, including:
- the zookeeper selects a server, and sends information including the consent to create a first copy directory to the selected server, where the selected server is the first server;
- the first server creates a first temporary directory corresponding to the task at the zookeeper
- the first server executes a task corresponding to the first copy directory.
- a second aspect of the present invention provides a task processing system, including: one or more servers, a zookeeper, where the one or more servers include a first server;
- the one or more servers are configured to send a first copy directory creation request to the distributed application coordination service zookeep before performing the task;
- the zookeeper is configured to select a server, and send information to the selected server that includes agreeing to create a first temporary directory, where the selected server is the first server;
- the first server is configured to create a first copy directory corresponding to the task in the zookeeper, and execute a task corresponding to the first copy directory.
- a third aspect of the embodiments of the present invention provides a terminal, where the terminal includes: a processor, a memory, and a task processing system, where the task processing system is stored in the memory, and includes at least one computer readable instruction.
- the at least one computer readable instruction is executable by the processor to perform the following operations
- the zookeeper selects a server, and sends information including the consent to create a first copy directory to the selected server, where the selected server is the first server;
- the first server creates a first temporary directory corresponding to the task at the zookeeper
- the first server executes a task corresponding to the first copy directory.
- the zookeeper selects a server, and sends information including the consent to create a first copy directory to the selected server, where the selected server is the first server;
- the first server creates a first temporary directory corresponding to the task at the zookeeper
- the first server executes a task corresponding to the first copy directory.
- FIG. 1 is a flowchart of a method for processing a task according to an embodiment of the present invention
- FIG. 2 is a schematic structural diagram of a task processing system according to an embodiment of the present invention.
- Step S1 l before a task is executed by one or more servers, to a distributed application
- the coordination service zoo keeper sends a first copy directory creation request.
- zookeeper is a distributed, distributed source application distributed service coordination service.
- step S12 the zookeeper selects a server, and sends the consent to the selected server.
- the information of the first temporary directory is built, and the selected server is the first server.
- the zookeeper selects the server as the first server, and agrees that the first server creates the first copy directory.
- the zookeeper When there are multiple servers sending the first copy directory creation request to the zookeeper, the zookeeper will only agree that one of the servers creates the first copy directory.
- the zookeeper selects which server to create the first copy directory according to the order of receiving the first copy directory creation request, for example, only agrees to send the first server to create the first copy directory creation request first. ⁇ Directory.
- zookeepe r can also create the first temporary directory based on the server's priority to select the server with the highest priority. The priority of the server may be set according to the situation in which the server completes the task, for example, counting the situation in which each server completes the task in a period of time.
- the weight corresponding to the server increases. Large, when the weight is increased to a certain value, the priority of the server is increased by one level. Similarly, if the server interrupts the execution of the task during the execution of a task, the corresponding weight of the server is reduced. When the weight is reduced to a certain value, the priority of the server is lowered by one level.
- Step S13 The first server creates a first temporary directory corresponding to the task at the zookeeper.
- the first Linyi directory may also be called a Linyi node, which is a data storage method, which is a bit like a folder.
- a Linyi directory a sub-directory directory can be created, and data can also be recorded.
- the name of the Linyi directory corresponds to the task
- one task corresponds to the name of a temporary directory
- the name of the temporary directory is related to the code of the server.
- the codes of different servers are the same, the different servers are the same
- the name of the copy directory created by the task is the same.
- the data recorded by the first copy directory comprises: an IP address of a server that creates the first copy directory, so that the user knows which server created the first copy directory.
- the data recorded by the first temporary directory further includes: a creation time of the first temporary directory, and the like.
- Step S14 The first server executes a task corresponding to the first copy directory.
- the first server After the first server successfully creates the first temporary directory in the zookeeper, the first server is qualified to perform the task corresponding to the first temporary directory.
- the method includes:
- the first server sends a TCP heartbeat to the zookeeper, so that the zookeeper determines whether the first server can communicate normally. Specifically, the first server sends a T CP heartbeat to the zookeeper. If the zookeeper receives the TCP heartbeat sent by the first server, it determines that the first server can still communicate normally, otherwise, if the preset threshold is exceeded, If the TCP heartbeat sent by the first server is not received, it is determined that the first server loses contact and cannot communicate normally. (When the second server fails, the second server cannot communicate normally with the zookeeper, and a failure such as a hardware failure occurs. Memory overflow, network problems, etc.).
- A2 After the zookeeper determines that the first server is unable to communicate normally, deleting the first temporary directory created by the first server. Optionally, after A2, the zookeeper stores the deletion record in a corresponding log for subsequent searching. Among them, the deletion record includes the information of the deleted first directory (such as the name, the IP of the created server, the deletion time, etc.).
- the method includes:
- the second server registers a listening event with the first copy directory to monitor whether the first copy directory is deleted. It should be noted that the second server is a different server from the first server, and the "first" and “second" are only used to distinguish different servers, and there is no order. In addition, the number of the second server may be one or plural.
- the second server After the first copy directory is deleted, the second server sends a second copy directory creation request to the zookeeper.
- the second server detects that the first server is deleted after the first temporary directory created by the zookeeper, the second copy directory creation request is sent to the zookeeper.
- the second server creates a second copy directory corresponding to the task, and executes the task. If the zookee per receives the plurality of second copy directory creation requests, only one of the servers is selected as the second server that creates the second copy directory, and the selected second server returns the consent to create the second.
- the information of the temporary directory after receiving the information, the second server creates a second copy directory corresponding to the interrupted task to the zookeeper, and executes the task.
- the code of the second server is the same as the code of the first server, since it still performs the same task, the name of the second copy directory created by it is the same as the name of the first copy directory, which is Because the server code controls the different directory tasks corresponding to different Linyi directory names, the directory for different fixed tasks is different.
- the second server starts from where the task is interrupted, and correspondingly, the second server creates a second copy directory corresponding to the task, and executes the task. , including
- the second server creates a second copy directory corresponding to the task.
- the second server determines whether the zookeeper records an execution progress and a completion degree of the task performed by the first server to execute the first copy directory.
- the execution progress here mainly refers to the current execution degree of the task, and the completion degree refers to the completion status of the task. For example, if a task has multiple subtasks, the execution progress of the task corresponds to the completion number of the subtask, and the completion degree. Corresponding to the completion of each subtask, for example, which subtask has been executed, which subtask has not been executed, and so on.
- the second server After the zookeeper records the execution progress and the completion degree of the task corresponding to the first server directory, the second server performs the task according to the execution progress of the task recorded by the zookeeper. The degree of completion continues with the task described. Specifically, the second server searches for the interruption point of the task according to the execution progress and completion degree of the task recorded by the zookeeper, and then continues execution from the interruption point. Since the execution is performed directly from the interruption point of the task, the time for restarting the task is saved, and the resources consumed by the second server to re-execute the task are also saved.
- the second server creates a second copy directory corresponding to the task, and executes the task, including:
- the second server creates a second temporary directory corresponding to the task.
- the second server determines whether the zookeeper records an execution progress and a completion degree of the task performed by the first server to execute the first copy directory.
- the second server determines whether the task is related to a database, when the zookeeper records an execution progress and a completion degree of the task corresponding to the first server directory.
- the decision task is related to the database.
- the second server acquires information related to the task in the database.
- the information related to the task includes the execution progress and completion degree of the task recorded by the database, and of course, may also include information of the modified data in the database (such as the location of the modified data, whether the modification is completed, etc.).
- the second server verifies whether the execution progress and the completion degree of the task recorded by the zookeeper are accurate according to the acquired information about the task in the database. Specifically, when the information related to the task in the acquired database is only the execution progress and the completion degree of the task, the execution progress and the completion degree of the task acquired by the database are compared with the execution progress and completion degree of the task recorded by the zookeeper, If the two are identical, it is determined that the execution progress and completion degree of the task recorded by zookeeper are accurate. Otherwise, it is determined that the execution progress and completion degree of the task recorded by zookeeper are inaccurate.
- the database and the task are first verified according to the information of the modified data in the database. Relevant information includes whether the execution progress and completion degree of the task are accurate. If it is accurate, the execution progress and completion degree of the task acquired by the database are continuously compared with the execution progress and completion degree of the task recorded by zookeeper to further verify the task recorded by zookeeper. Whether the execution progress and completion degree are accurate.
- FIG. 2 is a schematic structural diagram of a task processing system according to an embodiment of the present invention. For convenience of description, only the embodiment of the present invention is shown. part.
- the system 2 includes: one or more servers 21, a zookeeper 22, wherein the one or more servers include a first server 211.
- the one or more servers 21 are configured to send a first copy directory creation request to the distributed application coordination service zookeeper before performing the task.
- the zookeeper 22 is configured to select a server, and send information to the selected server that includes agreeing to create a first temporary directory, where the selected server is the first server.
- the zookeeper selects the server as the first server, and agrees that the first server creates the first copy directory.
- the zookeeper 22 will only agree that one of the servers creates the first copy directory.
- the zookeeper 22 selects which server to create the first temporary directory according to the order in which the first copy directory creation request is received, for example, only agrees to send the first server that first sends the first copy directory creation request to create the first Linyi directory.
- zookeeper 22 can also create the first temporary directory based on the server's priority to select the server with the highest priority. The priority of the server may be set according to the situation in which the server completes the task, for example, counting the situation in which each server completes the task in a period of time.
- the weight corresponding to the server increases. Large, when the weight is increased to a certain value, the priority of the server is increased by one level. Similarly, if the server interrupts the execution of the task during the execution of a task, the corresponding weight of the server is reduced. When the weight is reduced to a certain value, the priority of the server is lowered by one level.
- the first server 211 is configured to create a first corresponding to the task in the zookeeper 22 A directory is placed, and the task corresponding to the first directory is executed.
- the data recorded by the first copy directory comprises: an IP address of a server that creates the first copy directory, so that the user knows which server created the first copy directory.
- the data recorded by the first temporary directory further includes: a creation time of the first temporary directory, and the like.
- the first server 211 is further configured to send a TCP heartbeat to the ZOO keeper 22, so that the ZOO keeper 22 determines whether the first server 211 can communicate normally.
- the first server 211 sends a TCP heartbeat to the zookeeper 22, and if the zookeeper 22 receives the TCP heartbeat sent by the first server 211, it is determined that the first server 211 can still communicate normally; otherwise, if the preset is exceeded inches long threshold has not received the TCP server 211 first transmits the heartbeat, it is determined that the first server 211 loses contact, normal communication can not (inches second server fails, the second server can not eep and when normal zook er 22 Communication, failures such as hardware failures, memory leaks, network problems, etc.).
- the zookeeper 22 is further configured to delete the first temporary directory created by the first server 211 after determining that the first server 211 is unable to communicate normally.
- the zookeeper 22 is further configured to store the deletion record in a corresponding log for subsequent searching.
- deleting the record includes deleting the information of the first copy directory (such as the name, the IP of the created server, the deletion time, etc.).
- the task processing system includes a second server.
- the second server is configured to register a listening event with the first copy directory to monitor whether the first copy directory is deleted. It should be noted that the second server is a different server from the first server 211, and the "first" and “second" are only used to distinguish different servers, and there is no order. In addition, the number of the second servers may be one or plural.
- the second server After the first copy directory is deleted, the second server sends a second copy directory creation request to the zookeeper 22.
- the second server creates a second copy directory corresponding to the task, and executes the task.
- the code of the second server is the same as the code of the first server 211, since it still executes the same task, the name of the second copy directory created by it is the same as the name of the first copy directory, because the server code
- the names of the Linyi directories that control different fixed tasks are different. The directories for different fixed tasks are monitored. different.
- the second server starts from where the task is interrupted, creates a second copy directory corresponding to the task corresponding to the second server, and executes the task, including [0079] The second server creates a second temporary directory corresponding to the task.
- the second server determines whether the zookeeper 22 records the execution progress and the completion degree of the task corresponding to the first server 211 executing the first copy directory.
- the execution progress here mainly refers to the current execution degree of the task, and the completion degree refers to the completion status of the task. For example, if a task has multiple subtasks, the execution progress of the task corresponds to the completion number of the subtask, and the completion degree. Corresponding to the completion of each subtask, for example, which subtask has been executed, which subtask has not been executed, and so on.
- the zookeeper 22 records the execution progress and the completion degree of the task corresponding to the first server directory performed by the first server 211, and the second server performs the task according to the execution progress of the task recorded by the zookeeper 22 And the completion degree continues to perform the task.
- the second server creates a second copy directory corresponding to the task, and executes the task, including:
- the second server creates a second copy directory corresponding to the task.
- the second server determines whether the zookeeper 22 records the execution progress and the completion degree of the task corresponding to the first server 211 executing the first copy directory.
- the second server determines whether the task is related to a database. Specifically, when a task involves modifying (including adding or deleting or modifying) data from a database, the decision task is related to the database.
- the second server acquires information related to the task in the database.
- the information related to the task includes the execution progress and completion degree of the task recorded by the database, and of course, may also include information of the modified data in the database (such as the location of the modified data, whether the modification is completed, etc.).
- the second server verifies whether the execution progress and the completion degree of the task recorded by the looker eeper 22 are accurate according to the acquired information about the task in the database. Specifically, when the database is acquired The task-related information is only the execution progress and completion degree of the task, and the execution progress and completion degree of the task acquired by the database are compared with the execution progress and completion degree of the task recorded by zookeeper 22, and if the two are identical, then the determination is made. The execution progress and completion degree of the task recorded by zookeeper are accurate. Otherwise, it is determined that the execution progress and completion degree of the task recorded by zookeeper 22 are inaccurate.
- the information related to the task in the acquired database includes the execution progress and completion degree of the task, and also includes the information of the modified data in the database
- the information related to the task in the database is first verified according to the information of the modified data in the database. Including whether the execution progress and completion degree of the task are accurate. If it is accurate, continue to compare the execution progress and completion degree of the task acquired by the database with the execution progress and completion degree of the task recorded by zookeeper 22 to further verify the tasks recorded by zookeeper 22 Execution progress and completion are accurate.
- the task is continuously executed according to the execution progress and the completion degree of the task recorded by the zookeeper 22.
- ZooKeeper verified that the recording task 22 in the second server performs the progress and completion of inaccurate inches, execution progress and completion of correction of the Z ook ee p er recording task 22, and corrected in accordance with the The execution progress and completion degree of the task recorded by zookeeper 22 continue to execute the task.
- the zookeeper guarantees that only one server performs the task concurrently, and when the server fails, the other server takes over the task to continue the execution, so that multiple servers are not executed the same one.
- the situation of the task which reduces the server failure caused by the peer performing the same task.
- the zookeeper selects a server, and sends information including the consent to create a first copy directory to the selected server, where the selected server is the first server;
- the first server creates a first temporary directory corresponding to the task at the zookeeper
- the first server executes a task corresponding to the first copy directory.
- the at least one computer readable instruction is further executable by the processor to:
- the first server after the first server creates a first temporary directory corresponding to the task, the first server sends a TCP heartbeat to the zookeeper, so that the zookeeper determines the Whether the first server can communicate normally;
- the at least one computer readable instruction is further executable by the processor to:
- the second server registers a listening event with the first copy directory to listen to the first Whether the Linyi directory is deleted;
- the second server sends a second copy directory creation request to the zookeeper
- the second server creates a second copy directory corresponding to the task, and executes the task.
- the second server creates a second temporary directory corresponding to the task, and performs the task, including:
- the second server creates a second copy directory corresponding to the task
- the second server determines whether the zookeeper records the execution progress and the completion degree of the task corresponding to the first server by the first server;
- the second server After the zookeeper records the execution progress and the completion degree of the task corresponding to the first server directory, the second server performs the task execution progress and completion degree according to the task recorded by the zookeeper. Continue to perform the task described.
- the second server creates a second temporary directory corresponding to the task, and performs the task, including:
- the second server creates a second copy directory corresponding to the task
- the second server determines whether the zookeeper records the first server to execute the first copy The execution progress and completion degree of the task corresponding to the directory;
- the second server determines whether the task is related to a database
- the second server acquires information related to the task in the database
- the second server verifies whether the execution progress and the completion degree of the task recorded by the zook eeper are accurate according to the obtained information about the task in the database;
- Another embodiment of the present invention provides a computer readable storage medium storing at least one computer readable instruction executable by a processor to:
- the zookeeper selects a server, and sends information including the consent to create a first copy directory to the selected server, where the selected server is the first server;
- the first server creates a first temporary directory corresponding to the task at the zookeeper
- the first server executes a task corresponding to the first copy directory.
- the computer readable storage medium stores at least one computer readable instruction executable by a processor to:
- the first server after the first server creates a first temporary directory corresponding to the task, the first server sends a TCP heartbeat to the zookeeper, so that the zookeeper determines the Whether the first server can communicate normally;
- the computer readable storage medium stores at least one computer readable instruction executable by a processor to:
- the second server registers a listening event with the first copy directory to listen to the first Whether the Linyi directory is deleted;
- the second server After the first copy directory is deleted, the second server sends a second copy directory creation request to the zookeeper;
- the second server if receiving the information sent by the zookeeper that includes agreeing to create the second copy directory, the second server creates a second copy directory corresponding to the task, and executes the task.
- the second server creates a second temporary directory corresponding to the task, and performs the task, including:
- the second server creates a second copy directory corresponding to the task
- the second server determines whether the zookeeper records the execution progress and the completion degree of the task corresponding to the first server in the first copy directory;
- the second server After the zookeeper records the execution progress and the completion degree of the task corresponding to the first server directory, the second server performs the task execution progress and the completion degree according to the task recorded by the zookeeper. Continue to perform the task described.
- the second server creates a second temporary directory corresponding to the task, and performs the task, including:
- the second server creates a second temporary directory corresponding to the task
- the second server determines whether the zookeeper records the execution progress and the completion degree of the task corresponding to the first server by the first server;
- the second server determines whether the task is related to a database, when the zookeeper records the execution progress and the completion degree of the task corresponding to the first copy directory by the first server;
- the second server acquires information related to the task in the database
- the second server verifies whether the execution progress and the completion degree of the task recorded by the looker eeper are accurate according to the acquired information about the task in the database; [0135] after the second server verifies that the execution progress and the completion degree of the task recorded by the zookeeper are accurate, the task is continued according to the execution progress and the completion degree of the task recorded by the zookeeper; The server verifies that the execution progress and the completion degree of the task recorded by the zookeeper are inaccurate, corrects the execution progress and completion degree of the task recorded by the zookeeper, and completes the execution progress and completion of the task according to the corrected zookee per record. Continue to perform the task.
- each functional unit and module described above is exemplified. In practical applications, the above functions may be assigned differently according to needs.
- the functional unit and the module are completed, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above.
- Each functional unit and module in the embodiment may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit, and the integrated unit may be implemented by hardware.
- Formal implementation can also be implemented in the form of software functional units.
- the disclosed apparatus and method may be implemented in other manners.
- the system embodiment described above is merely illustrative.
- the division of the module or unit is only a logical function division, and the actual implementation may have another division manner, for example, multiple units or components may be used. Combined or can be integrated into another system, or some features can be ignored, or not executed.
- the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be electrical sexual, mechanical or other form.
- the unit described as a separate component may or may not be physically distributed, and the component displayed as a unit may or may not be a physical unit, that is, may be located in one place, or may be distributed to multiple On the network unit. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
- each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
- the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
- the integrated unit if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium.
- the medium includes a plurality of instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to perform all or part of the steps of the methods of the various embodiments of the embodiments of the present invention.
- the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (R 0M, Read-Only Memory), a random access memory (RAM), a magnetic disk or an optical disk, and the like, which can store program codes. medium.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
一种任务处理方法、系统、终端及计算机可读存储介质,所述方法包括:在一个或多个服务器执行任务之前,向分布式应用程序协调服务zookeeper发送第一临时目录创建请求;所述zookeeper选择一个服务器,向被选择的服务器发送包含同意创建第一临时目录的信息,所述被选择的服务器为第一服务器;所述第一服务器在所述zookeeper创建一个与所述任务唯一对应的第一临时目录;所述第一服务器执行所述第一临时目录对应的任务。通过上述方法能够保证同一个任务不会因为服务器本身的时间存在偏差而导致重复执行。
Description
任务处理方法、 系统、 终端及计算机可读存储介质 技术领域
[0001] 本发明属于通信技术领域, 尤其涉及一种任务处理方法、 系统、 终端及计算机 可读存储介质。
背景技术
[0002] 目前, 消费信贷自助服务 ([CFS_SS], SS) 系统为了防止定吋任务 (JOB) 被 多台服务器重复执行, 通常会向数据库插入一条记录, 比如, 插入一个任务的 过期吋间。 当服务器执行任务之前, 会先到数据库査询该任务的过期吋间是否 有效, 若有效, 则表示有服务器在执行该任务, 若无效则表明没有服务器在执 行这个任务, 即该任务可以执行。 该方法的缺点是, 当不同服务器的吋间存在 偏差吋, 可能会造成多个服务器同吋执行同一个任务的情况, 从而导致服务器 出现故障。
技术问题
[0003] 有鉴于此, 本发明实施例提供了任务处理方法、 系统、 终端及计算机可读存储 介质, 以解决现有技术中当不同服务器的吋间存在偏差吋, 可能会造成多个服 务器同吋执行同一个任务的情况, 从而导致服务器出现故障的问题。
问题的解决方案
技术解决方案
[0004] 本发明实施例的第一方面提供了一种任务处理方法, 包括:
[0005] 在一个或多个服务器执行任务之前, 向分布式应用程序协调服务 zookeeper发送 第一临吋目录创建请求;
[0006] 所述 zookeeper选择一个服务器, 向被选择的服务器发送包含同意创建第一临吋 目录的信息, 所述被选择的服务器为第一服务器;
[0007] 所述第一服务器在所述 zookeeper创建一个与所述任务唯一对应的第一临吋目录
[0008] 所述第一服务器执行所述第一临吋目录对应的任务。
[0009] 本发明实施例的第二方面提供了一种任务处理系统, 包括: 一个或多个服务器 、 zookeeper, 其中, 所述一个或多个服务器包括第一服务器;
[0010] 所述一个或多个服务器用于在执行任务之前, 向分布式应用程序协调服务 zook eeper发送第一临吋目录创建请求;
[0011] 所述 zookeeper用于选择一个服务器, 向被选择的服务器发送包含同意创建第一 临吋目录的信息, 所述被选择的服务器为第一服务器;
[0012] 所述第一服务器用于在所述 zookeeper创建一个与所述任务唯一对应的第一临吋 目录, 并执行所述第一临吋目录对应的任务。
[0013] 本发明实施例的第三方面提供了一种终端, 所述终端包括: 处理器、 存储器及 任务处理系统, 所述任务处理系统存储于所述存储器中, 包括至少一个计算机 可读指令, 该至少一个计算机可读指令可被所述处理器执行, 以实现以下操作
[0014] 在一个或多个服务器执行任务之前, 向分布式应用程序协调服务 zookeeper发送 第一临吋目录创建请求;
[0015] 所述 zookeeper选择一个服务器, 向被选择的服务器发送包含同意创建第一临吋 目录的信息, 所述被选择的服务器为第一服务器;
[0016] 所述第一服务器在所述 zookeeper创建一个与所述任务唯一对应的第一临吋目录
[0017] 所述第一服务器执行所述第一临吋目录对应的任务。
[0018] 本发明实施例的第四方面提供了一种计算机可读存储介质, 所述计算机可读存 储介质存储有至少一个可被处理器执行以实现以下操作的计算机可读指令:
[0019] 在一个或多个服务器执行任务之前, 向分布式应用程序协调服务 zookeeper发送 第一临吋目录创建请求;
[0020] 所述 zookeeper选择一个服务器, 向被选择的服务器发送包含同意创建第一临吋 目录的信息, 所述被选择的服务器为第一服务器;
[0021] 所述第一服务器在所述 zookeeper创建一个与所述任务唯一对应的第一临吋目录
[0022] 所述第一服务器执行所述第一临吋目录对应的任务。
发明的有益效果
有益效果
[0023] 本发明实施例与现有技术相比存在的有益效果是: 由于只有一台服务器的任务 会在 zookeeper创建临吋目录成功, 且临吋目录都是在 zookeeper上创建, 因此, 服务器本身的吋间存在偏差吋也不会影响 zookeeper的吋间, 从而保证同一个任 务不会因为服务器本身的吋间存在偏差而导致重复执行。
对附图的简要说明
附图说明
[0024] 为了更清楚地说明本发明实施例中的技术方案, 下面将对实施例或现有技术描 述中所需要使用的附图作简单地介绍, 显而易见地, 下面描述中的附图仅仅是 本发明的一些实施例, 对于本领域普通技术人员来讲, 在不付出创造性劳动性 的前提下, 还可以根据这些附图获得其他的附图。
[0025] 图 1是本发明实施例提供的一种任务处理方法的方法流程图;
[0026] 图 2是本发明实施例提供的一种任务处理系统的结构示意图。
本发明的实施方式
[0027] 以下描述中, 为了说明而不是为了限定, 提出了诸如特定系统结构、 技术之类 的具体细节, 以便透彻理解本发明实施例。 然而, 本领域的技术人员应当清楚 , 在没有这些具体细节的其它实施例中也可以实现本发明。 在其它情况中, 省 略对众所周知的系统、 装置、 电路以及方法的详细说明, 以免不必要的细节妨 碍本发明的描述。
[0028] 为了说明本发明所述的技术方案, 下面通过具体实施例来进行说明。
[0029] 图 1示出了本发明实施例提供的一种任务处理方法的方法流程图, 详述如下: [0030] 步骤 Sl l, 在一个或多个服务器执行任务之前, 向分布式应用程序协调服务 zoo keeper发送第一临吋目录创建请求。
[0031] 其中, zookeeper是一个分布式的、 幵放源码的分布式应用程序协调服务。
[0032] 步骤 S12, 所述 zookeeper选择一个服务器, 向被选择的服务器发送包含同意创
建第一临吋目录的信息, 所述被选择的服务器为第一服务器。
[0033] 当只有一个服务器向 zookeeper发送第一临吋目录创建请求吋, 该 zookeeper选择 该服务器作为第一服务器, 并同意所述第一服务器创建第一临吋目录。
[0034] 当有多个服务器向 zookeeper发送第一临吋目录创建请求吋, zookeeper只会同意 其中一个服务器创建第一临吋目录。 可选地, zookeeper根据接收到第一临吋目 录创建请求的先后顺序选择同意哪一个服务器创建第一临吋目录, 比如, 只同 意最先发送第一临吋目录创建请求的服务器创建第一临吋目录。 当然, zookeepe r也可根据服务器的优先权选择优先权最高的服务器创建第一临吋目录。 其中, 服务器的优先权可根据服务器完成任务的情况设定, 比如, 统计一段吋间内各 个服务器完成任务的情况, 若服务器能够完整完成一个任务而不出现故障, 则 该服务器对应的权值增大, 当权值增大到一定值, 则将该服务器的优先级提高 一个等级。 同理, 若服务器在执行一个任务过程中出现故障而中断任务的执行 , 则减小该服务器对应的权重, 当权值减小到一定值, 则将该服务器的优先级 降低一个等级。
[0035] 步骤 S13, 所述第一服务器在所述 zookeeper创建一个与所述任务唯一对应的第 一临吋目录。
[0036] 其中, 第一临吋目录也可以称作临吋节点, 是一种数据存储方式, 有点像文件 夹, 在一个临吋目录下可以再创建子临吋目录, 也可以记录数据。 需要指出的 是, 临吋目录的名称与任务对应, 一个任务对应一个临吋目录的名称, 而临吋 目录的名称与服务器的代码有关, 当不同服务器的代码相同吋, 该不同服务器 为同一个任务创建的临吋目录的名称是相同的。
[0037] 其中, 第一临吋目录记录的数据包括: 创建所述第一临吋目录的服务器的 IP地 址, 以便于用户获知是哪一个服务器创建第一临吋目录。 可选地, 所述第一临 吋目录记录的数据还包括: 该第一临吋目录的创建吋间等。
[0038] 步骤 S14, 所述第一服务器执行所述第一临吋目录对应的任务。
[0039] 具体地, 当第一服务器成功在 zookeeper创建第一临吋目录后, 该第一服务器具 备执行该第一临吋目录对应的任务的资格。
[0040] 由于只有一台服务器的任务会在 zookeeper创建临吋目录成功, 且临吋目录都是
在 zookeeper上创建, 因此, 服务器本身的吋间存在偏差吋也不会影响 zookeeper 的吋间, 从而保证同一个任务不会因为服务器本身的吋间存在偏差而导致重复 执行。
[0041] 可选地, 在所述步骤 S13之后, 包括:
[0042] Al、 所述第一服务器发送 TCP心跳至所述 zookeeper, 以使所述 zookeeper判断 所述第一服务器是否能够正常通信。 具体地, 第一服务器定吋向 zookeeper发送 T CP心跳, 若该 zookeeper接收到第一服务器发送的 TCP心跳, 则判定该第一服务 器还能正常通信, 否则, 若在超出预设吋长阈值还没有接收到该第一服务器发 送的 TCP心跳, 则判定该第一服务器失去联系, 不能正常通信 (当第二服务器发 生故障吋, 该第二服务器不能与 zookeeper正常通信, 发生的故障例如硬件故障 、 内存溢出、 网络问题等) 。
[0043] A2、 在所述 zookeeper判断出所述第一服务器不能够正常通信吋, 刪除所述第 一服务器创建的第一临吋目录。 可选地, 在 A2之后, 所述 zookeeper将刪除记录 存入对应的日志, 以便于后续査找。 其中, 刪除记录包括刪除的第一临吋目录 的信息 (如名称、 创建的服务器的 IP、 刪除吋间等) 。
[0044] 可选地, 在所述步骤 S13之后, 包括:
[0045] Bl、 第二服务器向所述第一临吋目录注册监听事件, 以监听所述第一临吋目录 是否被刪除。 需要指出的是, 该第二服务器为与第一服务器不同的服务器, 该" 第一"、 "第二"仅用于区分不同的服务器, 并无先后顺序之分。 另外, 该第二服 务器的个数可以为 1个, 也可以为多个。
[0046] B2、 在所述第一临吋目录被刪除吋, 所述第二服务器向所述 zookeeper发送第 二临吋目录创建请求。 当第二服务器 (一个或多个服务器) 监测到第一服务器 在 zookeeper创建的第一临吋目录被刪除后, 则向 zookeeper发送第二临吋目录创 建请求。
[0047] B3、 若接收到所述 zookeeper发送的包含同意创建第二临吋目录的信息, 所述 第二服务器创建与所述任务对应的第二临吋目录, 并执行所述任务。 所述 zookee per若接收到多个第二临吋目录创建请求, 则同样只选择其中一个服务器作为创 建第二临吋目录的第二服务器, 并向选择的第二服务器返回包含同意创建第二
临吋目录的信息, 第二服务器接收到信息后向所述 zookeeper创建与中断的任务 对应的第二临吋目录, 并执行该任务。 需要指出是, 当第二服务器的代码与第 一服务器的代码相同吋, 由于其还是执行同一个任务, 因此其创建的第二临吋 目录的名称与第一临吋目录的名称相同, 这是因为服务器代码控制不同的定吋 任务对应的临吋目录名称不同, 不同的定吋任务监听的目录是不同的。
[0048] 可选地, 为了节省资源, 则第二服务器从任务中断的地方幵始执行, 对应地, 所述第二服务器创建与所述任务对应的第二临吋目录, 并执行所述任务, 包括
[0049] Cl、 所述第二服务器创建与所述任务对应的第二临吋目录。
[0050] C2、 所述第二服务器判断所述 zookeeper是否记录所述第一服务器执行所述第 一临吋目录对应的任务的执行进度及完成度。 其中, 这里的执行进度主要是指 任务的当前执行程度, 完成度是指对任务的完成情况, 例如, 假设一个任务有 多个子任务, 则任务的执行进度对应子任务的完成个数, 完成度对应每个子任 务的完成情况, 例如, 哪个子任务已执行完成, 哪个子任务没有执行完成的描 述等。
[0051] C3、 在所述 zookeeper记录所述第一服务器执行所述第一临吋目录对应的任务 的执行进度及完成度吋, 所述第二服务器根据所述 zookeeper记录的任务的执行 进度及完成度继续执行所述任务。 具体地, 第二服务器根据 zookeeper记录的任 务的执行进度及完成度査找任务的中断点, 再从中断点继续执行。 由于直接从 任务的中断点幵始执行, 因此, 节省了重新幵始执行任务的吋间, 也节省了第 二服务器重新执行任务所耗费的资源。
[0052] 可选地, 为了能够准确判断任务的执行进度及完成度, 所述第二服务器创建与 所述任务对应的第二临吋目录, 并执行所述任务, 包括:
[0053] Dl、 所述第二服务器创建与所述任务对应的第二临吋目录。
[0054] D2、 所述第二服务器判断所述 zookeeper是否记录所述第一服务器执行所述第 一临吋目录对应的任务的执行进度及完成度。
[0055] D3、 在所述 zookeeper记录所述第一服务器执行所述第一临吋目录对应的任务 的执行进度及完成度吋, 所述第二服务器判断所述任务是否与数据库有关。 具
体地, 当任务涉及修改 (包括新增或刪除或修改) 数据库的数据吋, 判定任务 与数据库有关。
[0056] D4、 在所述任务与数据库有关吋, 所述第二服务器获取所述数据库中与所述任 务有关的信息。 其中, 与任务有关的信息包括数据库记录的任务的执行进度及 完成度, 当然, 还可以包括数据库中被修改的数据的信息 (如被修改的数据的 位置, 是否被修改完成的描述等) 。
[0057] D5、 所述第二服务器根据获取的所述数据库中与所述任务有关的信息验证所述 zookeeper记录的任务的执行进度及完成度是否准确。 具体地, 当获取的数据库 中与任务有关的信息仅为任务的执行进度及完成度吋, 则将数据库获取的任务 的执行进度及完成度与 zookeeper记录的任务的执行进度及完成度比较, 若两者 完全相同, 则判定 zookeeper记录的任务的执行进度及完成度是准确的, 否则, 判定 zookeeper记录的任务的执行进度及完成度是不准确的。
[0058] 当获取的数据库中与任务有关的信息包括任务的执行进度及完成度, 也包括数 据库中被修改的数据的信息吋, 则首先根据数据库中被修改的数据的信息验证 数据库中与任务有关的信息包括任务的执行进度及完成度是否准确, 若准确, 则继续将数据库获取的任务的执行进度及完成度与 zookeeper记录的任务的执行 进度及完成度比较, 以进一步验证 zookeeper记录的任务的执行进度及完成度是 否准确。
[0059] D6、 在所述第二服务器验证出所述 zookeeper记录的任务的执行进度及完成度 准确吋, 根据所述 zookeeper记录的任务的执行进度及完成度继续执行所述任务 。 在所述第二服务器验证出所述 zookeeper记录的任务的执行进度及完成度不准 确吋, 校正所述 zookeeper记录的任务的执行进度及完成度, 并根据校正后的所 述 zookeeper记录的任务的执行进度及完成度继续执行所述任务。
[0060] 由于对 zookeeper记录的任务的执行进度及完成度进行校验, 因此, 确保任务的 执行进度及完成度是准确的, 进而确保任务的中断点是准确的, 从而提高继续 执行任务的幵始点的精确性。
[0061] 本发明实施例中, 由于 zookeeper保证并发只有唯一一台服务器执行任务, 且当 服务器故障吋也能保证其他服务器接管任务继续执行, 因此, 不会出现多个服
务器同吋执行同一个任务的情况, 从而减少了由于同吋执行同一个任务导致的 服务器故障。
[0062] 应理解, 上述实施例中各步骤的序号的大小并不意味着执行顺序的先后, 各过 程的执行顺序应以其功能和内在逻辑确定, 而不应对本发明实施例的实施过程 构成任何限定。
[0063] 对应于上文实施例所述的任务处理方法, 图 2示出了本发明实施例提供的一种 任务处理系统的结构示意图, 为了便于说明, 仅示出了与本发明实施例相关的 部分。
[0064] 参照图 2, 该系统 2包括: 一个或多个服务器 21、 zookeeper 22, 其中, 所述一 个或多个服务器包括第一服务器 211。
[0065] 所述一个或多个服务器 21用于在执行任务之前, 向分布式应用程序协调服务 zo okeeper发送第一临吋目录创建请求。
[0066] 所述 zookeeper 22用于选择一个服务器, 向被选择的服务器发送包含同意创建 第一临吋目录的信息, 所述被选择的服务器为第一服务器。
[0067] 当只有一个服务器向 zookeeper 22发送第一临吋目录创建请求吋, 该 zookeeper 选择该服务器作为第一服务器, 并同意所述第一服务器创建第一临吋目录。
[0068] 当有多个服务器向 zookeeper 22发送第一临吋目录创建请求吋, zookeeper 22只 会同意其中一个服务器创建第一临吋目录。 可选地, zookeeper 22根据接收到第 一临吋目录创建请求的先后顺序选择同意哪一个服务器创建第一临吋目录, 比 如, 只同意最先发送第一临吋目录创建请求的服务器创建第一临吋目录。 当然 , zookeeper 22也可根据服务器的优先权选择优先权最高的服务器创建第一临吋 目录。 其中, 服务器的优先权可根据服务器完成任务的情况设定, 比如, 统计 一段吋间内各个服务器完成任务的情况, 若服务器能够完整完成一个任务而不 出现故障, 则该服务器对应的权值增大, 当权值增大到一定值, 则将该服务器 的优先级提高一个等级。 同理, 若服务器在执行一个任务过程中出现故障而中 断任务的执行, 则减小该服务器对应的权重, 当权值减小到一定值, 则将该服 务器的优先级降低一个等级。
[0069] 所述第一服务器 211用于在所述 zookeeper 22创建一个与所述任务唯一对应的第
一临吋目录, 并执行所述第一临吋目录对应的任务。
[0070] 其中, 第一临吋目录记录的数据包括: 创建所述第一临吋目录的服务器的 IP地 址, 以便于用户获知是哪一个服务器创建第一临吋目录。 可选地, 所述第一临 吋目录记录的数据还包括: 该第一临吋目录的创建吋间等。
[0071] 可选地, 所述第一服务器 211还用于发送 TCP心跳至所述 ZOOkeeper 22, 以使所 述 ZOOkeeper22判断所述第一服务器 211是否能够正常通信。 具体地, 第一服务器 211定吋向 zookeeper 22发送 TCP心跳, 若该 zookeeper 22接收到第一服务器 211发 送的 TCP心跳, 则判定该第一服务器 211还能正常通信, 否则, 若在超出预设吋 长阈值还没有接收到该第一服务器 211发送的 TCP心跳, 则判定该第一服务器 211 失去联系, 不能正常通信 (当第二服务器发生故障吋, 该第二服务器不能与 zook eeper 22正常通信, 发生的故障例如硬件故障、 内存溢出、 网络问题等) 。
[0072] 所述 zookeeper 22还用于在判断出所述第一服务器 211不能够正常通信吋, 刪除 所述第一服务器 211创建的第一临吋目录。
[0073] 可选地, 所述 zookeeper 22还用于将刪除记录存入对应的日志, 以便于后续査 找。 其中, 刪除记录包括刪除的第一临吋目录的信息 (如名称、 创建的服务器 的 IP、 刪除吋间等) 。
[0074] 可选地, 所述任务处理系统包括第二服务器。
[0075] 所述第二服务器用于向所述第一临吋目录注册监听事件, 以监听所述第一临吋 目录是否被刪除。 需要指出的是, 该第二服务器为与第一服务器 211不同的服务 器, 该"第一"、 "第二"仅用于区分不同的服务器, 并无先后顺序之分。 另外, 该 第二服务器的个数可以为 1个, 也可以为多个。
[0076] 在所述第一临吋目录被刪除吋, 所述第二服务器向所述 zookeeper 22发送第二 临吋目录创建请求。
[0077] 若接收到所述 zookeeper 22发送的包含同意创建第二临吋目录的信息, 所述第 二服务器创建与所述任务对应的第二临吋目录, 并执行所述任务。 当第二服务 器的代码与第一服务器 211的代码相同吋, 由于其还是执行同一个任务, 因此其 创建的第二临吋目录的名称与第一临吋目录的名称相同, 这是因为服务器代码 控制不同的定吋任务对应的临吋目录名称不同, 不同的定吋任务监听的目录是
不同的。
[0078] 可选地, 为了节省资源, 则第二服务器从任务中断的地方幵始执行, 对应所述 第二服务器创建与所述任务对应的第二临吋目录, 并执行所述任务, 包括: [0079] 所述第二服务器创建与所述任务对应的第二临吋目录。
[0080] 所述第二服务器判断所述 zookeeper 22是否记录所述第一服务器 211执行所述第 一临吋目录对应的任务的执行进度及完成度。 其中, 这里的执行进度主要是指 任务的当前执行程度, 完成度是指对任务的完成情况, 例如, 假设一个任务有 多个子任务, 则任务的执行进度对应子任务的完成个数, 完成度对应每个子任 务的完成情况, 例如, 哪个子任务已执行完成, 哪个子任务没有执行完成的描 述等。
[0081] 在所述 zookeeper 22记录所述第一服务器 211执行所述第一临吋目录对应的任务 的执行进度及完成度吋, 所述第二服务器根据所述 zookeeper 22记录的任务的执 行进度及完成度继续执行所述任务。
[0082] 可选地, 为了能够准确判断任务的执行进度及完成度, 所述第二服务器创建与 所述任务对应的第二临吋目录, 并执行所述任务, 包括:
[0083] 所述第二服务器创建与所述任务对应的第二临吋目录。
[0084] 所述第二服务器判断所述 zookeeper 22是否记录所述第一服务器 211执行所述第 一临吋目录对应的任务的执行进度及完成度。
[0085] 在所述 zookeeper 22记录所述第一服务器 211执行所述第一临吋目录对应的任务 的执行进度及完成度吋, 所述第二服务器判断所述任务是否与数据库有关。 具 体地, 当任务涉及修改 (包括新增或刪除或修改) 数据库的数据吋, 判定任务 与数据库有关。
[0086] 在所述任务与数据库有关吋, 所述第二服务器获取所述数据库中与所述任务有 关的信息。 其中, 与任务有关的信息包括数据库记录的任务的执行进度及完成 度, 当然, 还可以包括数据库中被修改的数据的信息 (如被修改的数据的位置 , 是否被修改完成的描述等) 。
[0087] 所述第二服务器根据获取的所述数据库中与所述任务有关的信息验证所述 zook eeper 22记录的任务的执行进度及完成度是否准确。 具体地, 当获取的数据库中
与任务有关的信息仅为任务的执行进度及完成度吋, 则将数据库获取的任务的 执行进度及完成度与 zookeeper 22记录的任务的执行进度及完成度比较, 若两者 完全相同, 则判定 zookeeper记录的任务的执行进度及完成度是准确的, 否则, 判定 zookeeper 22记录的任务的执行进度及完成度是不准确的。 当获取的数据库 中与任务有关的信息包括任务的执行进度及完成度, 也包括数据库中被修改的 数据的信息吋, 则首先根据数据库中被修改的数据的信息验证数据库中与任务 有关的信息包括任务的执行进度及完成度是否准确, 若准确, 则继续将数据库 获取的任务的执行进度及完成度与 zookeeper 22记录的任务的执行进度及完成度 比较, 以进一步验证 zookeeper 22记录的任务的执行进度及完成度是否准确。
[0088] 在所述第二服务器验证出所述 zookeeper 22记录的任务的执行进度及完成度准 确吋, 根据所述 zookeeper 22记录的任务的执行进度及完成度继续执行所述任务 。 在所述第二服务器验证出所述 zookeeper 22记录的任务的执行进度及完成度不 准确吋, 校正所述 Zookeeper 22记录的任务的执行进度及完成度, 并根据校正后 的所述 zookeeper 22记录的任务的执行进度及完成度继续执行所述任务。
[0089] 本发明实施例中, 由于 zookeeper保证并发只有唯一一台服务器执行任务, 且当 服务器故障吋也能保证其他服务器接管任务继续执行, 因此, 不会出现多个服 务器同吋执行同一个任务的情况, 从而减少了由于同吋执行同一个任务导致的 服务器故障。
[0090] 本发明另一实施例提供了一种终端, 所述终端包括: 处理器、 存储器及任务处 理系统, 所述任务处理系统存储于所述存储器中, 包括至少一个计算机可读指 令, 该至少一个计算机可读指令可被所述处理器执行, 以实现以下操作:
[0091] 在一个或多个服务器执行任务之前, 向分布式应用程序协调服务 zookeeper发送 第一临吋目录创建请求;
[0092] 所述 zookeeper选择一个服务器, 向被选择的服务器发送包含同意创建第一临吋 目录的信息, 所述被选择的服务器为第一服务器;
[0093] 所述第一服务器在所述 zookeeper创建一个与所述任务唯一对应的第一临吋目录
[0094] 所述第一服务器执行所述第一临吋目录对应的任务。
[0095] 可选地, 所述至少一个计算机可读指令还可被所述处理器执行, 以实现以下操 作:
[0096] 在所述第一服务器在所述 zookeeper创建一个与所述任务唯一对应的第一临吋目 录之后, 所述第一服务器发送 TCP心跳至所述 zookeeper, 以使所述 zookeeper判 断所述第一服务器是否能够正常通信;
[0097] 在所述 zookeeper判断出所述第一服务器不能够正常通信吋, 刪除所述第一服务 器创建的第一临吋目录。
[0098] 可选地, 所述至少一个计算机可读指令还可被所述处理器执行, 以实现以下操 作:
[0099] 在所述第一服务器在所述 zookeeper创建一个与所述任务唯一对应的第一临吋目 录之后, 第二服务器向所述第一临吋目录注册监听事件, 以监听所述第一临吋 目录是否被刪除;
[0100] 在所述第一临吋目录被刪除吋, 所述第二服务器向所述 zookeeper发送第二临吋 目录创建请求;
[0101] 若接收到所述 zookeeper发送的包含同意创建第二临吋目录的信息, 所述第二服 务器创建与所述任务对应的第二临吋目录, 并执行所述任务。
[0102] 可选地, 所述第二服务器创建与所述任务对应的第二临吋目录, 并执行所述任 务, 包括:
[0103] 所述第二服务器创建与所述任务对应的第二临吋目录;
[0104] 所述第二服务器判断所述 zookeeper是否记录所述第一服务器执行所述第一临吋 目录对应的任务的执行进度及完成度;
[0105] 在所述 zookeeper记录所述第一服务器执行所述第一临吋目录对应的任务的执行 进度及完成度吋, 所述第二服务器根据所述 zookeeper记录的任务的执行进度及 完成度继续执行所述任务。
[0106] 可选地, 所述第二服务器创建与所述任务对应的第二临吋目录, 并执行所述任 务, 包括:
[0107] 所述第二服务器创建与所述任务对应的第二临吋目录;
[0108] 所述第二服务器判断所述 zookeeper是否记录所述第一服务器执行所述第一临吋
目录对应的任务的执行进度及完成度;
[0109] 在所述 zookeeper记录所述第一服务器执行所述第一临吋目录对应的任务的执行 进度及完成度吋, 所述第二服务器判断所述任务是否与数据库有关;
[0110] 在所述任务与数据库有关吋, 所述第二服务器获取所述数据库中与所述任务有 关的信息;
[0111] 所述第二服务器根据获取的所述数据库中与所述任务有关的信息验证所述 zook eeper记录的任务的执行进度及完成度是否准确;
[0112] 在所述第二服务器验证出所述 zookeeper记录的任务的执行进度及完成度准确吋
, 根据所述 zookeeper记录的任务的执行进度及完成度继续执行所述任务; 在所 述第二服务器验证出所述 zookeeper记录的任务的执行进度及完成度不准确吋, 校正所述 zookeeper记录的任务的执行进度及完成度, 并根据校正后的所述 zookee per记录的任务的执行进度及完成度继续执行所述任务。
[0113] 本发明的另一实施例提供了一种计算机可读存储介质, 所述计算机可读存储介 质存储有至少一个可被处理器执行以实现以下操作的计算机可读指令:
[0114] 在一个或多个服务器执行任务之前, 向分布式应用程序协调服务 zookeeper发送 第一临吋目录创建请求;
[0115] 所述 zookeeper选择一个服务器, 向被选择的服务器发送包含同意创建第一临吋 目录的信息, 所述被选择的服务器为第一服务器;
[0116] 所述第一服务器在所述 zookeeper创建一个与所述任务唯一对应的第一临吋目录
[0117] 所述第一服务器执行所述第一临吋目录对应的任务。
[0118] 可选地, 所述计算机可读存储介质存储有至少一个可被处理器执行以实现以下 操作的计算机可读指令:
[0119] 在所述第一服务器在所述 zookeeper创建一个与所述任务唯一对应的第一临吋目 录之后, 所述第一服务器发送 TCP心跳至所述 zookeeper, 以使所述 zookeeper判 断所述第一服务器是否能够正常通信;
[0120] 在所述 zookeeper判断出所述第一服务器不能够正常通信吋, 刪除所述第一服务 器创建的第一临吋目录。
[0121] 可选地, 所述计算机可读存储介质存储有至少一个可被处理器执行以实现以下 操作的计算机可读指令:
[0122] 在所述第一服务器在所述 zookeeper创建一个与所述任务唯一对应的第一临吋目 录之后, 第二服务器向所述第一临吋目录注册监听事件, 以监听所述第一临吋 目录是否被刪除;
[0123] 在所述第一临吋目录被刪除吋, 所述第二服务器向所述 zookeeper发送第二临吋 目录创建请求;
[0124] 若接收到所述 zookeeper发送的包含同意创建第二临吋目录的信息, 所述第二服 务器创建与所述任务对应的第二临吋目录, 并执行所述任务。
[0125] 可选地, 所述第二服务器创建与所述任务对应的第二临吋目录, 并执行所述任 务, 包括:
[0126] 所述第二服务器创建与所述任务对应的第二临吋目录;
[0127] 所述第二服务器判断所述 zookeeper是否记录所述第一服务器执行所述第一临吋 目录对应的任务的执行进度及完成度;
[0128] 在所述 zookeeper记录所述第一服务器执行所述第一临吋目录对应的任务的执行 进度及完成度吋, 所述第二服务器根据所述 zookeeper记录的任务的执行进度及 完成度继续执行所述任务。
[0129] 可选地, 所述第二服务器创建与所述任务对应的第二临吋目录, 并执行所述任 务, 包括:
[0130] 所述第二服务器创建与所述任务对应的第二临吋目录;
[0131] 所述第二服务器判断所述 zookeeper是否记录所述第一服务器执行所述第一临吋 目录对应的任务的执行进度及完成度;
[0132] 在所述 zookeeper记录所述第一服务器执行所述第一临吋目录对应的任务的执行 进度及完成度吋, 所述第二服务器判断所述任务是否与数据库有关;
[0133] 在所述任务与数据库有关吋, 所述第二服务器获取所述数据库中与所述任务有 关的信息;
[0134] 所述第二服务器根据获取的所述数据库中与所述任务有关的信息验证所述 zook eeper记录的任务的执行进度及完成度是否准确;
[0135] 在所述第二服务器验证出所述 zookeeper记录的任务的执行进度及完成度准确吋 , 根据所述 zookeeper记录的任务的执行进度及完成度继续执行所述任务; 在所 述第二服务器验证出所述 zookeeper记录的任务的执行进度及完成度不准确吋, 校正所述 zookeeper记录的任务的执行进度及完成度, 并根据校正后的所述 zookee per记录的任务的执行进度及完成度继续执行所述任务。
[0136] 所属领域的技术人员可以清楚地了解到, 为了描述的方便和简洁, 仅以上述各 功能单元、 模块的划分进行举例说明, 实际应用中, 可以根据需要而将上述功 能分配由不同的功能单元、 模块完成, 即将所述装置的内部结构划分成不同的 功能单元或模块, 以完成以上描述的全部或者部分功能。 实施例中的各功能单 元、 模块可以集成在一个处理单元中, 也可以是各个单元单独物理存在, 也可 以两个或两个以上单元集成在一个单元中, 上述集成的单元既可以采用硬件的 形式实现, 也可以采用软件功能单元的形式实现。 另外, 各功能单元、 模块的 具体名称也只是为了便于相互区分, 并不用于限制本申请的保护范围。 上述系 统中单元、 模块的具体工作过程, 可以参考前述方法实施例中的对应过程, 在 此不再赘述。
[0137] 在上述实施例中, 对各个实施例的描述都各有侧重, 某个实施例中没有详述或 记载的部分, 可以参见其它实施例的相关描述。
[0138] 本领域普通技术人员可以意识到, 结合本文中所公幵的实施例描述的各示例的 单元及算法步骤, 能够以电子硬件、 或者计算机软件和电子硬件的结合来实现 。 这些功能究竟以硬件还是软件方式来执行, 取决于技术方案的特定应用和设 计约束条件。 专业技术人员可以对每个特定的应用来使用不同方法来实现所描 述的功能, 但是这种实现不应认为超出本发明的范围。
[0139] 在本发明所提供的实施例中, 应该理解到, 所揭露的装置和方法, 可以通过其 它的方式实现。 例如, 以上所描述的系统实施例仅仅是示意性的, 例如, 所述 模块或单元的划分, 仅仅为一种逻辑功能划分, 实际实现吋可以有另外的划分 方式, 例如多个单元或组件可以结合或者可以集成到另一个系统, 或一些特征 可以忽略, 或不执行。 另一点, 所显示或讨论的相互之间的耦合或直接耦合或 通讯连接可以是通过一些接口, 装置或单元的间接耦合或通讯连接, 可以是电
性, 机械或其它的形式。
[0140] 所述作为分离部件说明的单元可以是或者也可以不是物理上分幵的, 作为单元 显示的部件可以是或者也可以不是物理单元, 即可以位于一个地方, 或者也可 以分布到多个网络单元上。 可以根据实际的需要选择其中的部分或者全部单元 来实现本实施例方案的目的。
[0141] 另外, 在本发明各个实施例中的各功能单元可以集成在一个处理单元中, 也可 以是各个单元单独物理存在, 也可以两个或两个以上单元集成在一个单元中。 上述集成的单元既可以采用硬件的形式实现, 也可以采用软件功能单元的形式 实现。
[0142] 所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用 吋, 可以存储在一个计算机可读取存储介质中。 基于这样的理解, 本发明实施 例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部 或部分可以以软件产品的形式体现出来, 该计算机软件产品存储在一个存储介 质中, 包括若干指令用以使得一台计算机设备 (可以是个人计算机, 服务器, 或者网络设备等) 或处理器 (processor) 执行本发明实施例各个实施例所述方法 的全部或部分步骤。 而前述的存储介质包括: U盘、 移动硬盘、 只读存储器 (R 0M, Read-Only Memory) 、 随机存取存储器 (RAM, Random Access Memory ) 、 磁碟或者光盘等各种可以存储程序代码的介质。
以上所述实施例仅用以说明本发明的技术方案, 而非对其限制; 尽管参照前述 实施例对本发明进行了详细的说明, 本领域的普通技术人员应当理解: 其依然 可以对前述各实施例所记载的技术方案进行修改, 或者对其中部分技术特征进 行等同替换; 而这些修改或者替换, 并不使相应技术方案的本质脱离本发明各 实施例技术方案的精神和范围, 均应包含在本发明的保护范围之内。
Claims
[权利要求 1] 一种任务处理方法, 其特征在于, 包括:
在一个或多个服务器执行任务之前, 向分布式应用程序协调服务 zook eeper发送第一临吋目录创建请求;
所述 zookeeper选择一个服务器, 向被选择的服务器发送包含同意创 建第一临吋目录的信息, 所述被选择的服务器为第一服务器; 所述第一服务器在所述 zookeeper创建一个与所述任务唯一对应的第 一临吋目录;
所述第一服务器执行所述第一临吋目录对应的任务。
[权利要求 2] 如权利要求 1所述的任务处理方法, 其特征在于, 在所述第一服务器 在所述 zookeeper创建一个与所述任务唯一对应的第一临吋目录之后 , 包括:
所述第一服务器发送 TCP心跳至所述 zookeeper, 以使所述 zookeeper判 断所述第一服务器是否能够正常通信;
在所述 zookeeper判断出所述第一服务器不能够正常通信吋, 刪除所 述第一服务器创建的第一临吋目录。
[权利要求 3] 如权利要求 1所述的任务处理方法, 其特征在于, 在所述第一服务器 在所述 zookeeper创建一个与所述任务唯一对应的第一临吋目录之后 , 包括:
第二服务器向所述第一临吋目录注册监听事件, 以监听所述第一临吋 目录是否被刪除;
在所述第一临吋目录被刪除吋, 所述第二服务器向所述 zookeeper发 送第二临吋目录创建请求;
若接收到所述 zookeeper发送的包含同意创建第二临吋目录的信息, 所述第二服务器创建与所述任务对应的第二临吋目录, 并执行所述任 务。
[权利要求 4] 如权利要求 3所述的任务处理方法, 其特征在于, 所述第二服务器创 建与所述任务对应的第二临吋目录, 并执行所述任务, 包括:
所述第二服务器创建与所述任务对应的第二临吋目录; 所述第二服务器判断所述 zookeeper是否记录所述第一服务器执行所 述第一临吋目录对应的任务的执行进度及完成度; 在所述 zookeeper记录所述第一服务器执行所述第一临吋目录对应的 任务的执行进度及完成度吋, 所述第二服务器根据所述 zookeeper记 录的任务的执行进度及完成度继续执行所述任务。
[权利要求 5] 如权利要求 3所述的任务处理方法, 其特征在于, 所述第二服务器创 建与所述任务对应的第二临吋目录, 并执行所述任务, 包括: 所述第二服务器创建与所述任务对应的第二临吋目录;
所述第二服务器判断所述 zookeeper是否记录所述第一服务器执行所 述第一临吋目录对应的任务的执行进度及完成度; 在所述 zookeeper记录所述第一服务器执行所述第一临吋目录对应的 任务的执行进度及完成度吋, 所述第二服务器判断所述任务是否与数 据库有关;
在所述任务与数据库有关吋, 所述第二服务器获取所述数据库中与所 述任务有关的信息;
所述第二服务器根据获取的所述数据库中与所述任务有关的信息验证 所述 zookeeper记录的任务的执行进度及完成度是否准确;
在所述第二服务器验证出所述 zookeeper记录的任务的执行进度及完 成度准确吋, 根据所述 zookeeper记录的任务的执行进度及完成度继 续执行所述任务; 在所述第二服务器验证出所述 zookeeper记录的任 务的执行进度及完成度不准确吋, 校正所述 zookeeper记录的任务的 执行进度及完成度, 并根据校正后的所述 zookeeper记录的任务的执 行进度及完成度继续执行所述任务。
[权利要求 6] —种任务处理系统, 其特征在于, 包括: 一个或多个服务器、 zookee per, 其中, 所述一个或多个服务器包括第一服务器;
所述一个或多个服务器用于在执行任务之前, 向分布式应用程序协调 服务 zookeeper发送第一临吋目录创建请求;
所述 zookeeper用于选择一个服务器, 向被选择的服务器发送包含同 意创建第一临吋目录的信息, 所述被选择的服务器为第一服务器; 所述第一服务器用于在所述 zookeeper创建一个与所述任务唯一对应 的第一临吋目录, 并执行所述第一临吋目录对应的任务。
[权利要求 7] 如权利要求 6所述的任务处理系统, 其特征在于,
所述第一服务器还用于发送 TCP心跳至所述 zookeeper, 以使所述 zook eeper判断所述第一服务器是否能够正常通信;
所述 zookeeper还用于在判断出所述第一服务器不能够正常通信吋, 刪除所述第一服务器创建的第一临吋目录。
[权利要求 8] 如权利要求 6所述的任务处理系统, 其特征在于, 所述任务处理系统 包括第二服务器;
所述第二服务器用于向所述第一临吋目录注册监听事件, 以监听所述 第一临吋目录是否被刪除;
在所述第一临吋目录被刪除吋, 所述第二服务器向所述 zookeeper发 送第二临吋目录创建请求;
若接收到所述 zookeeper发送的包含同意创建第二临吋目录的信息, 所述第二服务器创建与所述任务对应的第二临吋目录, 并执行所述任 务。
[权利要求 9] 如权利要求 8所述的任务处理系统, 其特征在于, 所述第二服务器创 建与所述任务对应的第二临吋目录, 并执行所述任务, 包括: 所述第二服务器创建与所述任务对应的第二临吋目录;
所述第二服务器判断所述 zookeeper是否记录所述第一服务器执行所 述第一临吋目录对应的任务的执行进度及完成度; 在所述 zookeeper记录所述第一服务器执行所述第一临吋目录对应的 任务的执行进度及完成度吋, 所述第二服务器根据所述 zookeeper记 录的任务的执行进度及完成度继续执行所述任务。
[权利要求 10] 如权利要求 8所述的任务处理系统, 其特征在于, 所述第二服务器创 建与所述任务对应的第二临吋目录, 并执行所述任务, 包括:
所述第二服务器创建与所述任务对应的第二临吋目录; 所述第二服务器判断所述 zookeeper是否记录所述第一服务器执行所 述第一临吋目录对应的任务的执行进度及完成度; 在所述 zookeeper记录所述第一服务器执行所述第一临吋目录对应的 任务的执行进度及完成度吋, 所述第二服务器判断所述任务是否与数 据库有关;
在所述任务与数据库有关吋, 所述第二服务器获取所述数据库中与所 述任务有关的信息;
所述第二服务器根据获取的所述数据库中与所述任务有关的信息验证 所述 zookeeper记录的任务的执行进度及完成度是否准确;
在所述第二服务器验证出所述 zookeeper记录的任务的执行进度及完 成度准确吋, 根据所述 zookeeper记录的任务的执行进度及完成度继 续执行所述任务; 在所述第二服务器验证出所述 zookeeper记录的任 务的执行进度及完成度不准确吋, 校正所述 zookeeper记录的任务的 执行进度及完成度, 并根据校正后的所述 zookeeper记录的任务的执 行进度及完成度继续执行所述任务。
[权利要求 11] 一种终端, 其特征在于, 所述终端包括: 处理器、 存储器及任务处理 系统, 所述任务处理系统存储于所述存储器中, 包括至少一个计算机 可读指令, 该至少一个计算机可读指令可被所述处理器执行, 以实现 以下操作:
在一个或多个服务器执行任务之前, 向分布式应用程序协调服务 zook eeper发送第一临吋目录创建请求;
所述 zookeeper选择一个服务器, 向被选择的服务器发送包含同意创 建第一临吋目录的信息, 所述被选择的服务器为第一服务器; 所述第一服务器在所述 zookeeper创建一个与所述任务唯一对应的第 一临吋目录;
所述第一服务器执行所述第一临吋目录对应的任务。
[权利要求 12] 如权利要求 11所述的终端, 其特征在于, 所述至少一个计算机可读指
令还可被所述处理器执行, 以实现以下操作:
在所述第一服务器在所述 zookeeper创建一个与所述任务唯一对应的 第一临吋目录之后, 所述第一服务器发送 TCP心跳至所述 zookeeper, 以使所述 zookeeper判断所述第一服务器是否能够正常通信; 在所述 zookeeper判断出所述第一服务器不能够正常通信吋, 刪除所 述第一服务器创建的第一临吋目录。
[权利要求 13] 如权利要求 11所述的终端, 其特征在于, 所述至少一个计算机可读指 令还可被所述处理器执行, 以实现以下操作:
在所述第一服务器在所述 zookeeper创建一个与所述任务唯一对应的 第一临吋目录之后, 第二服务器向所述第一临吋目录注册监听事件, 以监听所述第一临吋目录是否被刪除;
在所述第一临吋目录被刪除吋, 所述第二服务器向所述 zookeeper发 送第二临吋目录创建请求;
若接收到所述 zookeeper发送的包含同意创建第二临吋目录的信息, 所述第二服务器创建与所述任务对应的第二临吋目录, 并执行所述任 务。
[权利要求 14] 如权利要求 13所述的终端, 其特征在于, 所述第二服务器创建与所述 任务对应的第二临吋目录, 并执行所述任务, 包括:
所述第二服务器创建与所述任务对应的第二临吋目录;
所述第二服务器判断所述 zookeeper是否记录所述第一服务器执行所 述第一临吋目录对应的任务的执行进度及完成度; 在所述 zookeeper记录所述第一服务器执行所述第一临吋目录对应的 任务的执行进度及完成度吋, 所述第二服务器根据所述 zookeeper记 录的任务的执行进度及完成度继续执行所述任务。
[权利要求 15] 如权利要求 13所述的终端, 其特征在于, 所述第二服务器创建与所述 任务对应的第二临吋目录, 并执行所述任务, 包括:
所述第二服务器创建与所述任务对应的第二临吋目录;
所述第二服务器判断所述 zookeeper是否记录所述第一服务器执行所
述第一临吋目录对应的任务的执行进度及完成度;
在所述 zookeeper记录所述第一服务器执行所述第一临吋目录对应的 任务的执行进度及完成度吋, 所述第二服务器判断所述任务是否与数 据库有关;
在所述任务与数据库有关吋, 所述第二服务器获取所述数据库中与所 述任务有关的信息;
所述第二服务器根据获取的所述数据库中与所述任务有关的信息验证 所述 zookeeper记录的任务的执行进度及完成度是否准确;
在所述第二服务器验证出所述 zookeeper记录的任务的执行进度及完 成度准确吋, 根据所述 zookeeper记录的任务的执行进度及完成度继 续执行所述任务; 在所述第二服务器验证出所述 zookeeper记录的任 务的执行进度及完成度不准确吋, 校正所述 zookeeper记录的任务的 执行进度及完成度, 并根据校正后的所述 zookeeper记录的任务的执 行进度及完成度继续执行所述任务。
[权利要求 16] —种计算机可读存储介质, 其特征在于, 所述计算机可读存储介质存 储有至少一个可被处理器执行以实现以下操作的计算机可读指令: 在一个或多个服务器执行任务之前, 向分布式应用程序协调服务 zook eeper发送第一临吋目录创建请求;
所述 zookeeper选择一个服务器, 向被选择的服务器发送包含同意创 建第一临吋目录的信息, 所述被选择的服务器为第一服务器; 所述第一服务器在所述 zookeeper创建一个与所述任务唯一对应的第 一临吋目录;
所述第一服务器执行所述第一临吋目录对应的任务。
[权利要求 17] 如权利要求 16所述计算机可读存储介质, 其特征在于, 所述计算机可 读存储介质存储有至少一个可被处理器执行以实现以下操作的计算机 可读指令:
在所述第一服务器在所述 zookeeper创建一个与所述任务唯一对应的 第一临吋目录之后, 所述第一服务器发送 TCP心跳至所述 zookeeper,
以使所述 zookeeper判断所述第一服务器是否能够正常通信;
在所述 zookeeper判断出所述第一服务器不能够正常通信吋, 刪除所 述第一服务器创建的第一临吋目录。
[权利要求 18] 如权利要求 16所述的计算机可读存储介质, 其特征在于, 所述计算机 可读存储介质存储有至少一个可被处理器执行以实现以下操作的计算 机可读指令:
在所述第一服务器在所述 zookeeper创建一个与所述任务唯一对应的 第一临吋目录之后, 第二服务器向所述第一临吋目录注册监听事件, 以监听所述第一临吋目录是否被刪除;
在所述第一临吋目录被刪除吋, 所述第二服务器向所述 zookeeper发 送第二临吋目录创建请求;
若接收到所述 zookeeper发送的包含同意创建第二临吋目录的信息, 所述第二服务器创建与所述任务对应的第二临吋目录, 并执行所述任 务。
[权利要求 19] 如权利要求 18所述的计算机可读存储介质, 其特征在于, 所述第二服 务器创建与所述任务对应的第二临吋目录, 并执行所述任务, 包括: 所述第二服务器创建与所述任务对应的第二临吋目录;
所述第二服务器判断所述 zookeeper是否记录所述第一服务器执行所 述第一临吋目录对应的任务的执行进度及完成度; 在所述 zookeeper记录所述第一服务器执行所述第一临吋目录对应的 任务的执行进度及完成度吋, 所述第二服务器根据所述 zookeeper记 录的任务的执行进度及完成度继续执行所述任务。
[权利要求 20] 如权利要求 18所述的计算机可读存储介质, 其特征在于, 所述第二服 务器创建与所述任务对应的第二临吋目录, 并执行所述任务, 包括: 所述第二服务器创建与所述任务对应的第二临吋目录;
所述第二服务器判断所述 zookeeper是否记录所述第一服务器执行所 述第一临吋目录对应的任务的执行进度及完成度; 在所述 zookeeper记录所述第一服务器执行所述第一临吋目录对应的
任务的执行进度及完成度吋, 所述第二服务器判断所述任务是否与数 据库有关;
在所述任务与数据库有关吋, 所述第二服务器获取所述数据库中与所 述任务有关的信息;
所述第二服务器根据获取的所述数据库中与所述任务有关的信息验证 所述 zookeeper记录的任务的执行进度及完成度是否准确;
在所述第二服务器验证出所述 zookeeper记录的任务的执行进度及完 成度准确吋, 根据所述 zookeeper记录的任务的执行进度及完成度继 续执行所述任务; 在所述第二服务器验证出所述 zookeeper记录的任 务的执行进度及完成度不准确吋, 校正所述 zookeeper记录的任务的 执行进度及完成度, 并根据校正后的所述 zookeeper记录的任务的执 行进度及完成度继续执行所述任务。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201710299368.6A CN107168813A (zh) | 2017-04-28 | 2017-04-28 | 任务处理方法及系统 |
| CN201710299368.6 | 2017-04-28 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2018196154A1 true WO2018196154A1 (zh) | 2018-11-01 |
Family
ID=59813731
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2017/090314 Ceased WO2018196154A1 (zh) | 2017-04-28 | 2017-06-27 | 任务处理方法、系统、终端及计算机可读存储介质 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN107168813A (zh) |
| WO (1) | WO2018196154A1 (zh) |
Families Citing this family (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108366086A (zh) * | 2017-12-25 | 2018-08-03 | 聚好看科技股份有限公司 | 一种控制业务处理的方法及装置 |
| CN112181583A (zh) * | 2019-07-05 | 2021-01-05 | 中国电信股份有限公司 | 虚拟化管理系统、方法和计算机可读存储介质 |
| CN112860787A (zh) * | 2019-11-27 | 2021-05-28 | 上海哔哩哔哩科技有限公司 | 分布式主从系统中主节点的切换方法、主节点设备和存储介质 |
| CN112860386A (zh) * | 2019-11-27 | 2021-05-28 | 上海哔哩哔哩科技有限公司 | 分布式主从系统中节点的切换方法 |
| CN112866314B (zh) * | 2019-11-27 | 2023-04-07 | 上海哔哩哔哩科技有限公司 | 分布式主从系统中从节点的切换方法、主节点设备和存储介质 |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103744724A (zh) * | 2014-02-19 | 2014-04-23 | 互联网域名系统北京市工程研究中心有限公司 | 定时任务集群方法及其装置 |
| CN103916481A (zh) * | 2014-04-17 | 2014-07-09 | 北京京东尚科信息技术有限公司 | 一种处理数据的方法和装置 |
| CN105100259A (zh) * | 2015-08-18 | 2015-11-25 | 北京京东尚科信息技术有限公司 | 一种分布式定时任务执行方法和系统 |
| CN106059843A (zh) * | 2016-08-16 | 2016-10-26 | 深圳市华成峰数据技术有限公司 | 一种基于Zookeeper 的节点配置系统及方法 |
Family Cites Families (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103634280B (zh) * | 2012-08-23 | 2018-11-09 | 百度在线网络技术(北京)有限公司 | 一种网站安全扫描方法及装置 |
| CN104462400A (zh) * | 2014-12-10 | 2015-03-25 | 北京奇虎科技有限公司 | 在移动终端中进行文件下载的方法、装置和浏览器客户端 |
| EP3238106B1 (en) * | 2015-03-17 | 2020-10-07 | Cloudera, Inc. | Compaction policy |
-
2017
- 2017-04-28 CN CN201710299368.6A patent/CN107168813A/zh active Pending
- 2017-06-27 WO PCT/CN2017/090314 patent/WO2018196154A1/zh not_active Ceased
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103744724A (zh) * | 2014-02-19 | 2014-04-23 | 互联网域名系统北京市工程研究中心有限公司 | 定时任务集群方法及其装置 |
| CN103916481A (zh) * | 2014-04-17 | 2014-07-09 | 北京京东尚科信息技术有限公司 | 一种处理数据的方法和装置 |
| CN105100259A (zh) * | 2015-08-18 | 2015-11-25 | 北京京东尚科信息技术有限公司 | 一种分布式定时任务执行方法和系统 |
| CN106059843A (zh) * | 2016-08-16 | 2016-10-26 | 深圳市华成峰数据技术有限公司 | 一种基于Zookeeper 的节点配置系统及方法 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN107168813A (zh) | 2017-09-15 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP6731123B1 (ja) | 合意システムのダウンタイムの回復 | |
| CN111538763B (zh) | 一种确定集群中主节点的方法、电子设备和存储介质 | |
| WO2018196154A1 (zh) | 任务处理方法、系统、终端及计算机可读存储介质 | |
| JP2020518887A (ja) | 合意システムのダウンタイムの回復 | |
| WO2021226905A1 (zh) | 一种数据存储方法、系统及存储介质 | |
| CN112000635A (zh) | 一种数据请求方法、设备以及介质 | |
| WO2022036901A1 (zh) | 一种Redis副本集的实现方法及装置 | |
| WO2016202051A1 (zh) | 一种通信系统中管理主备节点的方法和装置及高可用集群 | |
| WO2020134199A1 (zh) | 实现数据一致性的方法和装置、服务器和终端 | |
| EP3352415A1 (en) | Smb service failure handling method, and storage device | |
| CN111966530A (zh) | 应用系统灾备切换方法、装置、计算机设备和存储介质 | |
| CN110602136A (zh) | 集群访问方法和相关产品 | |
| CN106331081B (zh) | 一种信息同步方法及装置 | |
| CN112650629B (zh) | 区块链索引数据恢复方法、装置、设备和计算机存储介质 | |
| CN110413433A (zh) | 一种Maria DB集群故障后的恢复方法、设备以及存储介质 | |
| CN111694516B (zh) | 一种分布式块存储系统的版本在线升级方法及终端 | |
| TWI514279B (zh) | 伺服器系統與韌體更新方法 | |
| CN106933545B (zh) | 应用系统及其启动保护方法及装置 | |
| CN107678891A (zh) | 一种存储系统的双控方法、装置及可读存储介质 | |
| CN111400095A (zh) | 一种集群以及异常断电重启集群的方法、系统以及介质 | |
| CN118740829A (zh) | 云端文件的导出方法及装置 | |
| CN107181608A (zh) | 一种恢复服务及性能提升的方法及运维管理系统 | |
| CN111324632A (zh) | 利用客户端侧高速缓存的透明数据库会话恢复 | |
| CN117093425A (zh) | 一种数据库高可用的方法、系统、设备和存储介质 | |
| CN113448760B (zh) | 一种硬盘异常状态的恢复方法、系统、设备以及介质 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 17906928 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM XXXX DATED 31/01/2020) |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 17906928 Country of ref document: EP Kind code of ref document: A1 |