CN116743876B - Method for realizing multi-tenant scheduling based on xxl-job - Google Patents

Method for realizing multi-tenant scheduling based on xxl-job Download PDF

Info

Publication number
CN116743876B
CN116743876B CN202311018081.3A CN202311018081A CN116743876B CN 116743876 B CN116743876 B CN 116743876B CN 202311018081 A CN202311018081 A CN 202311018081A CN 116743876 B CN116743876 B CN 116743876B
Authority
CN
China
Prior art keywords
tenant
task
scheduling
job
available
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.)
Active
Application number
CN202311018081.3A
Other languages
Chinese (zh)
Other versions
CN116743876A (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.)
Yunzhu Information Technology Chengdu Co ltd
Original Assignee
Yunzhu Information Technology Chengdu 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 Yunzhu Information Technology Chengdu Co ltd filed Critical Yunzhu Information Technology Chengdu Co ltd
Priority to CN202311018081.3A priority Critical patent/CN116743876B/en
Publication of CN116743876A publication Critical patent/CN116743876A/en
Application granted granted Critical
Publication of CN116743876B publication Critical patent/CN116743876B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/63Routing a service request depending on the request content or context
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • H04L67/025Protocols based on web technology, e.g. hypertext transfer protocol [HTTP] for remote control or remote monitoring of applications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/34Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters 
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention discloses a method for realizing multi-tenant scheduling based on xxl-job, which comprises the steps of newly adding a machine room code field in an executor information table and newly adding an available tenant field in a task object; acquiring a task list of a task to be scheduled from a scheduling expansion information table; acquiring an available scheduling address under an executor corresponding to a task to be scheduled through a task object in a task list; screening out a remote address which is finally scheduled through a task object and an available scheduling address in a task list; based on the machine room code field and the available tenant field, tenant scheduling or normal scheduling is started. According to the method, xxl-job is used as a flow initiator, scheduling is performed based on the dimension of the tenant, tenant information can be transmitted to a scheduled service side, and the service scene of the same system for multi-tenant use is met.

Description

Method for realizing multi-tenant scheduling based on xxl-job
Technical Field
The invention belongs to the technical field of task scheduling, and particularly relates to a method for realizing multi-tenant scheduling based on xxl-job.
Background
Under the scenario that the service has multiple tenants, tenant information needs to be transmitted when requests are made among the services, and the service executes corresponding service logic aiming at different tenants. xxl-job is a distributed task scheduling platform, which is used for scheduling and executing tasks in a large-scale distributed environment, and is widely applied to various distributed task scheduling scenes, in particular to the fields of big data processing, timing tasks, data synchronization and the like.
xxl-job is taken as a flow initiator, the context can not transfer tenant information when the service is called, and the requirement of a multi-tenant service scene can not be met, so that the technical problem to be solved in the technical field is urgent.
Disclosure of Invention
The invention aims to solve the technical problems that: a method for implementing multi-tenant scheduling based on xxl-job is provided to at least solve the above technical problems.
In order to achieve the above purpose, the technical scheme adopted by the invention is as follows:
a method for realizing multi-tenant scheduling based on xxl-job, comprising the following steps:
step 1, newly adding a machine room code field in an actuator information table, wherein the machine room code field is used for representing machine room information corresponding to an actuator; newly adding an available tenant field in the task object, wherein the available tenant field is used for representing a dispatching mode corresponding to a tenant;
step 2, acquiring a task list of a task to be scheduled from a scheduling expansion information table;
step 3, acquiring an available scheduling address under an executor corresponding to a task to be scheduled through a task object in a task list;
step 4, screening out a remote address which is finally scheduled through a task object and an available scheduling address in the task list;
and step 5, starting tenant scheduling or common scheduling based on the machine room code field and the available tenant field.
Further, in the step 5, when the value of the available tenant field in the task object is 1, it indicates that the tenant scheduling mode is tenant scheduling; when the value of the available tenant field in the task object is 0, the dispatching mode of the tenant is the common dispatching.
Further, in the step 5, the method for dispatching the tenant is as follows: step A, inquiring a lessor list from a lessee inquiry service by using a machine room code field of an executor; step B, traversing the tenant list, adding tenant ID fields in the task parameters of the executors of the task objects, and setting tenant information into the tenant ID fields every time in the traversing process; step C, xxl-job server dispatching center initiates Http dispatching request to remote address, and uses task parameter of task object executor as parameter of Http dispatching request to transfer to remote address; and D, the service in the remote address is used as a dispatcher, after the remote address receives the Http dispatch request, the task parameter of the executor is analyzed, the tenant information in the tenant ID field is extracted, the tenant information is set into a local context through a local thread variable, a local method associated with a task processor is executed, after the local method is executed, the dispatch request of a dispatch center is responded to be successful, and one-time tenant dispatch is finished.
Further, in the step D, in the local method, the tenant ID of the tenant information is extracted through the local context, resource isolation is performed based on the tenant information, the service corresponding to the tenant is executed according to routing of the tenant information to the scheduled service side.
Further, the method for common scheduling comprises the following steps: a, a dispatching center of a xxl-job server initiates an Http dispatching request to a remote address, and an executor task parameter of a task object is used as a parameter of the Http dispatching request to be transmitted to the remote address; and b, taking the service in the remote address as a dispatcher, analyzing task parameters of an executor after the remote address receives the Http dispatch request, executing a local method associated with a task processor by using the task parameters, and after the local method is executed, responding to the dispatch request of a dispatch center as success, and ending the ordinary dispatch once.
Further, in the step 3, the available scheduling address under the corresponding executor of the task to be scheduled is obtained through the name of the executor associated executor information table of the task object in the task list.
Further, in the step 4, the remote address which is finally scheduled is screened out through the executor routing policy of the task object in the task list and the available scheduling address obtained in the step 3.
Compared with the prior art, the invention has the following beneficial effects:
according to the method, xxl-job is used as a flow initiator, scheduling is performed based on the dimension of the tenant, tenant information can be transmitted to a scheduled service side, and the service scene of the same system for multi-tenant use is met.
Drawings
FIG. 1 is a flow chart of the method of the present invention.
Detailed Description
Term interpretation:
xxl-job is a popular comment distributed task scheduling platform and is a lightweight distributed task scheduling platform.
The present invention will be described in further detail with reference to the accompanying drawings, in order to make the objects, technical solutions and advantages of the present invention more apparent. It will be apparent that the described embodiments are only some, but not all, embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
As shown in fig. 1, the method for realizing multi-tenant scheduling based on xxl-job provided by the invention comprises the following steps:
step 1, a room code field (room_code field) is newly added in an executor information table (xxl _job_group table) to represent room information corresponding to an executor (job_group); an available tenant field (enable_tent field) is newly added in a task object (xxl _job_info) and is used for representing a scheduling mode corresponding to a tenant;
step 2, acquiring a task list of a task to be scheduled from a scheduling expansion information table (xxl _job_group table);
step 3, acquiring an available scheduling address (address_list) of an executor corresponding to a task to be scheduled through a task object (xxl _job_info) in a task list;
step 4, screening out a remote address (remote_address) which is finally scheduled through a task object (xxl _job_info) and an available scheduling address (address_list) in the task list;
and 5, starting tenant scheduling or common scheduling based on the value of an available tenant field (an enable_tenant field) in the task object.
Preferably, in the step 5, when the value of the available tenant field (enable_tent field) in the task object (xxl _job_info) is 1, it indicates that the tenant scheduling mode is tenant scheduling, and the task object starts tenant scheduling; when the value of the available tenant field (enable_tent field) in the task object (xxl _job_info) is 0, it indicates that the tenant schedule is the normal schedule, and the task object starts the normal schedule.
Preferably, in the step 5, when the task object is tenant scheduling, the method for tenant scheduling is: step A, inquiring a lessor list from a lessee inquiry service (generally a lessee center service, which is defined by different enterprises according to the self situation) by using a machine room code field (room_code field) of an executor (job_group); step B, traversing the tenant list, adding a tenant ID field (tenantId field) in a task parameter (executor_parameter) of an executor (job_group) of a task object (xxl _job_info), and setting one piece of tenant information into the tenant ID field (tenantId field) each time; step C, xxl-the dispatch center (xxl-job-admin) of the job server initiates an Http dispatch request to the remote address, and the task parameter (executor_parameter) of the executor (job_group) of the task object (xxl _job_info) is used as the parameter of the Http dispatch request to be transferred to the remote address; and D, the service in the remote address is used as a dispatcher, after receiving the Http dispatch request, the remote address analyzes the task parameter (executor_parameter) of the executor (job_group), extracts the tenant information in the tenant ID field (tenntid field), sets the tenant information into a local context through a local thread variable (set method), executes a local method associated with a task processor (job handler), and responds to the dispatch request of a dispatch center (xxl-job-admin) as success after the local method is executed, and one-time tenant dispatch is finished. When the executor (job_group) needs tenant information, the tenant information can be acquired from the context through a get method of the wiredlocal.
More preferably, in the step D, in the local method, the tenant ID of the tenant information is extracted through the local context, resource isolation is performed based on the tenant information, and the service corresponding to the tenant is executed according to routing of the tenant information to the task resource (such as a database, a message queue, and a search platform). The present invention sets the manner of tenant information to context by implicitly passing tenant identification and invoked Fang Yinshi. To satisfy the business scenario of the same system for multi-tenant use.
Preferably, in the step 5, when the task object is a normal schedule, the method of the normal schedule is as follows: a, a dispatch center (xxl-job-admin) of a xx-job server initiates an Http dispatch request to a remote address (remote_address), and a task parameter (executor_parameter) of an executor (job_group) of a task object (xxl _job_info) is used as a parameter of the Http dispatch request to be transmitted to the remote address; in the step b, the service in the remote address is used as a dispatcher, after the remote address receives the Http dispatch request, the task parameter (executor_parameter) of the executor (jobgroup) is analyzed, the local method associated with the task processor (jobHandler) is executed by using the task parameter (executor_parameter), and after the local method is executed, the dispatch request of the dispatch center is responded to be successful, and one-time ordinary dispatch is finished.
Preferably, in the step 3, the name of the executor information table associated with the executor (job_group) of the task object (xxl _job_info) in the task list is used to obtain an available scheduling address (address_list) under the executor (job_group) corresponding to the task to be scheduled.
Finally, it should be noted that: the above embodiments are merely preferred embodiments of the present invention for illustrating the technical solution of the present invention, but not limiting the scope of the present invention; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the corresponding technical solutions; that is, even though the main design concept and spirit of the present invention is modified or finished in an insubstantial manner, the technical problem solved by the present invention is still consistent with the present invention, and all the technical problems are included in the protection scope of the present invention; in addition, the technical scheme of the invention is directly or indirectly applied to other related technical fields, and the technical scheme is included in the scope of the invention.

Claims (4)

1. A method for implementing multi-tenant scheduling based on xxl-job, comprising the steps of:
step 1, newly adding a machine room code field in an actuator information table, wherein the machine room code field is used for representing machine room information corresponding to an actuator; newly adding an available tenant field in the task object, wherein the available tenant field is used for representing a dispatching mode corresponding to a tenant;
step 2, acquiring a task list of a task to be scheduled from a scheduling expansion information table;
step 3, acquiring an available scheduling address under an executor corresponding to a task to be scheduled through a task object in a task list;
step 4, screening out a remote address which is finally scheduled through a task object and an available scheduling address in the task list;
step 5, starting tenant scheduling or common scheduling based on the machine room code field and the available tenant field;
when the value of an available tenant field in the task object is 1, the dispatching mode of the tenant is represented as tenant dispatching; when the value of an available tenant field in the task object is 0, the dispatching mode of the tenant is represented as common dispatching;
the tenant scheduling method comprises the following steps: step A, inquiring a lessor list from a lessee inquiry service by using a machine room code field of an executor; step B, traversing the tenant list, adding tenant ID fields in the task parameters of the executors of the task objects, and setting tenant information into the tenant ID fields every time in the traversing process; step C, xxl-job server dispatching center initiates Http dispatching request to remote address, and uses task parameter of task object executor as parameter of Http dispatching request to transfer to remote address; step D, the service in the remote address is used as a dispatcher, after the remote address receives the Http dispatch request, the task parameter of an executor is analyzed, the tenant information in the tenant ID field is extracted, the tenant information is set into a local context through a local thread variable, a local method associated with a task processor is executed, after the local method is executed, the dispatch request of a dispatch center is responded to be successful, and one-time tenant dispatch is finished;
the method for the common scheduling comprises the following steps: a, a dispatching center of a xxl-job server initiates an Http dispatching request to a remote address, and an executor task parameter of a task object is used as a parameter of the Http dispatching request to be transmitted to the remote address; and b, taking the service in the remote address as a dispatcher, analyzing task parameters of an executor after the remote address receives the Http dispatch request, executing a local method associated with a task processor by using the task parameters, and after the local method is executed, responding to the dispatch request of a dispatch center as success, and ending the ordinary dispatch once.
2. The method for realizing multi-tenant scheduling based on xxl-job of claim 1, wherein in the step D, the local method extracts the tenant ID of the tenant information through the local context, performs resource isolation based on the tenant information, routes to the scheduled service side according to the tenant information, and executes the service corresponding to the tenant.
3. The method for realizing multi-tenant scheduling based on xxl-job according to claim 1, wherein in the step 3, the names of the executors information table are associated through the executors of the task objects in the task list, and the available scheduling addresses under the executors corresponding to the tasks to be scheduled are obtained.
4. The method for realizing multi-tenant scheduling based on xxl-job of claim 1, wherein in step 4, the remote address which is finally scheduled is screened out through the executor routing policy of the task object in the task list and the available scheduling address obtained in step 3.
CN202311018081.3A 2023-08-14 2023-08-14 Method for realizing multi-tenant scheduling based on xxl-job Active CN116743876B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311018081.3A CN116743876B (en) 2023-08-14 2023-08-14 Method for realizing multi-tenant scheduling based on xxl-job

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311018081.3A CN116743876B (en) 2023-08-14 2023-08-14 Method for realizing multi-tenant scheduling based on xxl-job

Publications (2)

Publication Number Publication Date
CN116743876A CN116743876A (en) 2023-09-12
CN116743876B true CN116743876B (en) 2023-12-08

Family

ID=87911826

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311018081.3A Active CN116743876B (en) 2023-08-14 2023-08-14 Method for realizing multi-tenant scheduling based on xxl-job

Country Status (1)

Country Link
CN (1) CN116743876B (en)

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104010025A (en) * 2014-03-06 2014-08-27 西安邮电大学 Informationized public platform implementation architecture
CN106559488A (en) * 2016-11-24 2017-04-05 天津市普迅电力信息技术有限公司 A kind of method of the electrical network geographical information space service for setting up tenant's driving
CN110336859A (en) * 2019-06-06 2019-10-15 广州市玄武无线科技股份有限公司 Task scheduling system under multi-tenant environment
CN110532074A (en) * 2019-08-08 2019-12-03 北明云智(武汉)网软有限公司 A kind of method for scheduling task and system of multi-tenant Mode S aaS service cluster environment
CN111580998A (en) * 2020-06-12 2020-08-25 上海通联金融服务有限公司 RPC calling method of multiple tenants in SaaS service mode
CN111641675A (en) * 2020-04-28 2020-09-08 深圳壹账通智能科技有限公司 Multi-tenant access service implementation method, device, equipment and storage medium
CN111984385A (en) * 2020-08-25 2020-11-24 广联达科技股份有限公司 Task scheduling method and task scheduling device based on decorative BIM model
CN112035213A (en) * 2020-08-28 2020-12-04 北京白龙马云行科技有限公司 Multi-tenant network car booking system and dynamic isolation method
CN112291232A (en) * 2020-10-27 2021-01-29 中国联合网络通信有限公司深圳市分公司 Safety capability and safety service chain management platform based on tenants
CN114328509A (en) * 2021-11-25 2022-04-12 泰康保险集团股份有限公司 Service processing method and device
CN114422218A (en) * 2021-12-31 2022-04-29 中国电信股份有限公司 Tenant isolation method, device and storage medium
CN116074315A (en) * 2023-01-17 2023-05-05 浪潮通用软件有限公司 Multi-tenant scheduling system based on cloud native architecture
CN116455951A (en) * 2023-06-19 2023-07-18 云筑信息科技(成都)有限公司 Calling method for realizing RPC isolation of multi-tenant service based on dynamic rules

Patent Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104010025A (en) * 2014-03-06 2014-08-27 西安邮电大学 Informationized public platform implementation architecture
CN106559488A (en) * 2016-11-24 2017-04-05 天津市普迅电力信息技术有限公司 A kind of method of the electrical network geographical information space service for setting up tenant's driving
CN110336859A (en) * 2019-06-06 2019-10-15 广州市玄武无线科技股份有限公司 Task scheduling system under multi-tenant environment
CN110532074A (en) * 2019-08-08 2019-12-03 北明云智(武汉)网软有限公司 A kind of method for scheduling task and system of multi-tenant Mode S aaS service cluster environment
WO2021218328A1 (en) * 2020-04-28 2021-11-04 深圳壹账通智能科技有限公司 Multi-tenant access service implementation method, apparatus and device, and storage medium
CN111641675A (en) * 2020-04-28 2020-09-08 深圳壹账通智能科技有限公司 Multi-tenant access service implementation method, device, equipment and storage medium
CN111580998A (en) * 2020-06-12 2020-08-25 上海通联金融服务有限公司 RPC calling method of multiple tenants in SaaS service mode
CN111984385A (en) * 2020-08-25 2020-11-24 广联达科技股份有限公司 Task scheduling method and task scheduling device based on decorative BIM model
CN112035213A (en) * 2020-08-28 2020-12-04 北京白龙马云行科技有限公司 Multi-tenant network car booking system and dynamic isolation method
CN112291232A (en) * 2020-10-27 2021-01-29 中国联合网络通信有限公司深圳市分公司 Safety capability and safety service chain management platform based on tenants
CN114328509A (en) * 2021-11-25 2022-04-12 泰康保险集团股份有限公司 Service processing method and device
CN114422218A (en) * 2021-12-31 2022-04-29 中国电信股份有限公司 Tenant isolation method, device and storage medium
CN116074315A (en) * 2023-01-17 2023-05-05 浪潮通用软件有限公司 Multi-tenant scheduling system based on cloud native architecture
CN116455951A (en) * 2023-06-19 2023-07-18 云筑信息科技(成都)有限公司 Calling method for realizing RPC isolation of multi-tenant service based on dynamic rules

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
IT支撑系统多租户模式应用研究;闫春荣;《通信管理与技术》;全文 *

Also Published As

Publication number Publication date
CN116743876A (en) 2023-09-12

Similar Documents

Publication Publication Date Title
CN111752965B (en) Real-time database data interaction method and system based on micro-service
CN105677469B (en) Timed task execution method and device
CN108023908B (en) Data updating method, device and system
CN109150572B (en) Method, device and computer readable storage medium for realizing alarm association
CN110611707B (en) Task scheduling method and device
CN109766194B (en) Method and system for realizing low-coupling plan task component based on message
CN101408852B (en) Method, apparatus and system for scheduling task
CN110012062B (en) Multi-computer-room task scheduling method and device and storage medium
CN109766201A (en) Task distribution method, server, client and system
CN107623731A (en) A kind of method for scheduling task, client, service cluster and system
CN116743876B (en) Method for realizing multi-tenant scheduling based on xxl-job
CN109388501B (en) Communication matching method, device, equipment and medium based on face recognition request
CN113821322A (en) Loosely-coupled distributed workflow coordination system and method
CN104410511A (en) Server management method and system
CN112180757B (en) Intelligent household system and strategy management method thereof
CN112433830A (en) ZooKeeper-based distributed task scheduling method, system and storage medium
CN112613276A (en) Parallel execution method and system for streaming document analysis
CN115526586A (en) Business process processing method based on intelligent operation
CN112581080A (en) Lightweight distributed workflow engine construction system
US10616109B1 (en) System and method for web service atomic transaction (WS-AT) affinity routing
CN111309500A (en) Service processing method, device, equipment and storage medium
CN113204434B (en) Planned task execution method and device based on k8s and computer equipment
CN116910157B (en) Heterogeneous system data synchronization method and system based on double-layer topological scheduling
CN116954871B (en) Asynchronous distribution task data chain management method and system
CN117076508B (en) Method for supporting batch data processing by stream data processing system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant