CN110297706A - A kind of inserting method based on Eureka-Server project - Google Patents

A kind of inserting method based on Eureka-Server project Download PDF

Info

Publication number
CN110297706A
CN110297706A CN201910593743.7A CN201910593743A CN110297706A CN 110297706 A CN110297706 A CN 110297706A CN 201910593743 A CN201910593743 A CN 201910593743A CN 110297706 A CN110297706 A CN 110297706A
Authority
CN
China
Prior art keywords
offline
project
eureka
server
offline project
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
CN201910593743.7A
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.)
Beijing Shouqi Zhixing Technology Co Ltd
Original Assignee
Beijing Shouqi Zhixing 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 Beijing Shouqi Zhixing Technology Co Ltd filed Critical Beijing Shouqi Zhixing Technology Co Ltd
Priority to CN201910593743.7A priority Critical patent/CN110297706A/en
Publication of CN110297706A publication Critical patent/CN110297706A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/485Task life-cycle, e.g. stopping, restarting, resuming execution

Abstract

Inserting method disclosed by the invention based on Eureka-Server project, belong to big data technical field, by using Eureka-Server serviced component, does not need additional infrastructural support, additional maintenance, configuration and server overhead etc. will not be generated, manpower and material resources cost are saved.A variety of checking routines are provided with during offline to offline project, can thoroughly stop to offline project process and make offline to offline project gracefulness.

Description

A kind of inserting method based on Eureka-Server project
Technical field
The invention belongs to big data technical fields, and in particular to a kind of inserting method based on Eureka-Server project.
Background technique
Offline project framework is waited for using spring cloud mode in company parts rear end, in service registration to Eureka, with Guarantee system 7 × 24 hours active.But it when offline project is issued, is needing to guarantee not requesting that the clothes can be distributed Business device, otherwise user just can be appreciated that 404 or 505 mistake.So need the operation of one " offline ", want it is offline to Offline item nodes are extractd from load balancing, so that entirely lower line process is enough gracefulnesses, to guarantee that front-end customer is sent Unaware when request, at the same to offline project can complete process be assigned to the business datum on this node.
Currently, the inserting method to offline project mainly includes following several:
The first scheme: completed using Service Mesh (service grid environment) between offline project network call, Current limliting, fusing and monitoring, reach the offline unaware of application program in issuing process, and generally major company is used;
Second scheme: being completed using kill java process, which by be that Spring Boot is applied Shutdown hook, offline using itself are also graceful.Generally small-to-medium business is used;
The third mode: provided using Spring Boot/endpoints such as shutdown endpoint and/pause realize under The gracefulness of line project is offline.
These three schemes have the following deficiencies:
(1) Service Mesh has enough advantages, and disadvantage is also relatively more clear.Service Mesh is used also in evolution Scene is complicated, need to put into huge manpower and material resources come present environment is transformed, to offline project etc., when necessary must be for enterprise The specifically used scene of industry carries out secondary development.
(2) kill java process and Spring Boot provide /shutdown endpoint, which by be The Shutdown hook of Spring Boot application, offline using itself are also gracefulness, but if the clothes to offline project Business discovery component uses Eureka-Server, then default longest delay in 90 seconds, other wait for that offline project can just perceive It is offline to the service, it is intended that in 90 seconds after the example is offline, it is offline that other services still can be capable of calling this To offline project, it is also possible to because certain reasons cause process Hang to lead to not thoroughly stop the process.
(3) Spring Boot provide /pause endpoint, only can will it is offline to offline project mark be DOWN, no Can really it stop.
Summary of the invention
In view of the defects existing in the prior art, the embodiment of the invention provides a kind of based on Eureka-Server project Inserting method, method includes the following steps:
According to offline project name, obtain to offline item destination slogan;
According to the port numbers, whether the described judgement to offline project is to be registered on Eureka-Server to offline item Mesh, if so, obtaining the status flags information to offline project;
If the status flags information is UP, by sending POST request to pause endpoint, circulation triggers offline reality Example, is changed to DOWN for the status flags information to offline project;
It checks to offline project log, judges whether become zero in the set time period to offline item target flow, if it is not, " kill " order is then executed, transmission SIGTERM signal extremely to the corresponding process of offline project and judges the process in setting Whether stop in period, if it is not, then executing " kill-9 " order, sends SIGKILL signal to the process until to offline Project is offline.
Preferably, the method also includes:
By mail feedback to offline project name, to the offline IP of offline project, to the offline executor of offline project and to The offline offline implementing result of project.
Preferably, judging whether the port numbers provided are consistent with the port numbers of acquisition includes:
If inconsistent, terminate offline to offline project and fed back by mail to the offline rank executed at present of offline project Section and terminate the reason offline to offline project.
Preferably, judgement it is described to offline item target flow in the set time period with the presence or absence of including:
If so, terminate it is offline to offline project and fed back by mail to the offline project offline stage executed at present and Terminate the reason offline to offline project.
Preferably, according to offline project name, obtain registered on Eureka-Server to offline project information Before, the method also includes:
Modify Eureka Server configuration file, comprising:
Close self-protection mode;
Active failure detection times interval is set.
Preferably, according to offline project name, obtain registered on Eureka-Server to offline project information Before, the method also includes:
Modification is to offline project profile, comprising:
Setting service expired time interval;
Setting service refresh time;
The periodic refreshing local cache time is set;
The ribbon cache flush time is set;
Enable pause endpoint.
Inserting method provided in an embodiment of the present invention based on Eureka-Server project has the advantages that
Using Eureka-Server serviced component, additional infrastructural support is not needed, additional maintenance will not be generated, matched It sets and server overhead etc., saves manpower and material resources cost;
A variety of checking routines are provided with during offline to offline project, can thoroughly be stopped to offline project process simultaneously So that offline to offline project gracefulness.
Detailed description of the invention
Fig. 1 is the inserting method flow diagram provided in an embodiment of the present invention based on Eureka-Server project.
Specific embodiment
Specific introduce is made to the present invention below in conjunction with the drawings and specific embodiments.
As shown in Figure 1, the inserting method provided in an embodiment of the present invention for waiting for offline project based on Eureka-Server includes Following steps:
S101 is obtained according to offline project name to offline item destination slogan.
S102 judges that this waits for whether offline project is to be registered on Eureka-Server to offline item according to the port numbers Mesh, if so, obtaining the status flags information to offline project.
S103, if status flags information is UP, by sending POST request to pause endpoint, circulation triggers offline reality Example, is changed to DOWN for the status flags information to offline project.
, can be by code by curl-X POST http as a specific embodiment: // to offline to offline Corresponding IP address/the actuator/pause of project will be changed to DOWN to the offline status flags information to offline project.
S104 is checked to offline project log, judges whether become zero in the set time period to offline item target flow, If it is not, then executing " kill " order, transmission SIGTERM signal extremely to the corresponding process of offline project and judges that the process is being set Period in whether stop, if it is not, then executing " kill-9 " order, send SIGKILL signal to the process until to offline Project is offline.
As a specific embodiment, the flow detection time is greater than service expired time interval, can be by flow detection Time is set as 12 seconds, and service expired time is set to 10 seconds.
Optionally, the method also includes:
By mail feedback to offline project name, to the offline IP of offline project, to the offline executor of offline project and to The offline offline implementing result of project.
Optionally, judging whether the port numbers provided are consistent with the port numbers of acquisition includes:
If inconsistent, terminate offline to offline project and fed back by mail to the offline rank executed at present of offline project Section and terminate the reason offline to offline project.
Optionally, judgement it is described to offline item target flow in the set time period with the presence or absence of including:
If so, terminate it is offline to offline project and fed back by mail to the offline project offline stage executed at present and Terminate the reason offline to offline project.
Optionally, according to offline project name, obtain registered on Eureka-Server to offline project information Before, the method also includes:
Modify Eureka Server configuration file, comprising:
Close self-protection mode.
As a specific embodiment, the code for closing self-protection mode is eureka.server.enableSel FPreservation=false.
Active failure detection times interval is set.
As a specific embodiment, code can be passed through
Eureka.server.eviction-interval-timer-in-ms=5000 will be between active failure detection times Every being set as 5 seconds.
Preferably, according to offline project name, obtain registered on Eureka-Server to offline project information Before, the method also includes:
Modification is to offline project profile, comprising:
Setting service expired time interval.
As a specific embodiment, code can be passed through
When eureka.instance.lease-expiration-duration-in-seconds=10 will service expired Between be set to 10 seconds.
Setting service refresh time.
As a specific embodiment, code can be passed through
Eureka.instance.lease-renewal-interval-in-seconds=5 is set refresh time is serviced It is set to 5 seconds.
The periodic refreshing local cache time is set.
As a specific embodiment, code can be passed through
When eureka.client.registry-fetch-interval-seconds=5 is by periodic refreshing local cache Between be set as 5 seconds.
The ribbon cache flush time is set.
As a specific embodiment, code can be passed through
Ribbon.ServerListRefreshInterval=3000 sets the ribbon cache flush time to 3 seconds.
Enable pause endpoint.
As a specific embodiment, enabling/pause endpoint code includes:
management.endpoint.pause.enabled:true;
management.endpoint.restart.enabled:true;
management.endpoints.web.exposure.include:pause,restart。
Inserting method provided in an embodiment of the present invention based on Eureka-Server project, by using Eureka- Server serviced component does not need additional infrastructural support, will not generate additional maintenance, configuration and server overhead etc., section Manpower and material resources cost are saved.A variety of checking routines are provided with during offline to offline project, can thoroughly be stopped under Line project process simultaneously makes offline to offline project gracefulness.
In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, there is no the portion being described in detail in some embodiment Point, reference can be made to the related descriptions of other embodiments.
It is understood that the correlated characteristic in the above method and device can be referred to mutually.The technology people of fields Member can be understood that, for convenience and simplicity of description, the specific works mistake of the system, apparatus, and unit of foregoing description Journey can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
Algorithm and display are not inherently related to any particular computer, virtual system, or other device provided herein. Various general-purpose systems can also be used together with teachings based herein.As described above, it constructs required by this kind of system Structure be obvious.In addition, the present invention is also not directed to any particular programming language.It should be understood that can use various Programming language realizes summary of the invention described herein, and the description done above to language-specific is to disclose this hair Bright preferred forms.
In addition, memory may include the non-volatile memory in computer-readable medium, random access memory (RAM) and/or the forms such as Nonvolatile memory, such as read-only memory (ROM) or flash memory (flash RAM), memory includes extremely A few storage chip.
It should be understood by those skilled in the art that, embodiments herein can provide as method, system or computer program Product.Therefore, complete hardware embodiment, complete software embodiment or reality combining software and hardware aspects can be used in the application Apply the form of example.Moreover, it wherein includes the computer of computer usable program code that the application, which can be used in one or more, The computer program implemented in usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) produces The form of product.
The application is referring to method, the process of equipment (system) and computer program product according to the embodiment of the present application Figure and/or block diagram describe.It should be understood that every one stream in flowchart and/or the block diagram can be realized by computer program instructions The combination of process and/or box in journey and/or box and flowchart and/or the block diagram.It can provide these computer programs Instruct the processor of general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to produce A raw machine, so that being generated by the instruction that computer or the processor of other programmable data processing devices execute for real The device for the function of being specified in present one or more flows of the flowchart and/or one or more blocks of the block diagram.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates, Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one The step of function of being specified in a box or multiple boxes.
In a typical configuration, calculating equipment includes one or more processors (CPU), input/output interface, net Network interface and memory.
Memory may include the non-volatile memory in computer-readable medium, random access memory (RAM) and/ Or the forms such as Nonvolatile memory, such as read-only memory (ROM) or flash memory (flash RAM).Memory is computer-readable Jie The example of matter.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by any method Or technology come realize information store.Information can be computer readable instructions, data structure, the module of program or other data. The example of the storage medium of computer includes, but are not limited to phase change memory (PRAM), static random access memory (SRAM), moves State random access memory (DRAM), other kinds of random access memory (RAM), read-only memory (ROM), electric erasable Programmable read only memory (EEPROM), flash memory or other memory techniques, read-only disc read only memory (CD-ROM) (CD-ROM), Digital versatile disc (DVD) or other optical storage, magnetic cassettes, tape magnetic disk storage or other magnetic storage devices Or any other non-transmission medium, can be used for storage can be accessed by a computing device information.As defined in this article, it calculates Machine readable medium does not include temporary computer readable media (transitory media), such as the data-signal and carrier wave of modulation.
It should also be noted that, the terms "include", "comprise" or its any other variant are intended to nonexcludability It include so that the process, method, commodity or the equipment that include a series of elements not only include those elements, but also to wrap Include other elements that are not explicitly listed, or further include for this process, method, commodity or equipment intrinsic want Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including element There is also other identical elements in process, method, commodity or equipment.
It will be understood by those skilled in the art that embodiments herein can provide as method, system or computer program product. Therefore, complete hardware embodiment, complete software embodiment or embodiment combining software and hardware aspects can be used in the application Form.It is deposited moreover, the application can be used to can be used in the computer that one or more wherein includes computer usable program code The shape for the computer program product implemented on storage media (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) Formula.
The above is only embodiments herein, are not intended to limit this application.To those skilled in the art, Various changes and changes are possible in this application.It is all within the spirit and principles of the present application made by any modification, equivalent replacement, Improve etc., it should be included within the scope of the claims of this application.
It should be noted that the above embodiments do not limit the invention in any form, it is all to use equivalent replacement or equivalent change The mode changed technical solution obtained, falls within the scope of protection of the present invention.

Claims (6)

1. a kind of inserting method based on Eureka-Server project characterized by comprising
According to offline project name, obtain to offline item destination slogan;
According to the port numbers, judgement it is described to offline project whether be registered on Eureka-Server to offline project, if It is then to obtain the status flags information to offline project;
If the status flags information is UP, by sending POST request to pause endpoint, circulation triggers offline example, will Status flags information to offline project is changed to DOWN;
It checks to offline project log, judges whether become zero in the set time period to offline item target flow, if it is not, then holding Row " kill " order, transmission SIGTERM signal extremely to the corresponding process of offline project and judge the process in the time of setting Whether stop in section, if it is not, then executing " kill-9 " order, sends SIGKILL signal to the process until to offline project It is offline.
2. inserting method according to claim 1, which is characterized in that after offline to offline project, the method is also Include:
By mail feedback to offline project name, to the offline IP of offline project, to the offline executor of offline project and to offline The offline implementing result of project.
3. inserting method according to claim 1, which is characterized in that judging the port numbers of the port numbers provided and acquisition is It is no unanimously to include:
If inconsistent, terminate it is offline to offline project and fed back by mail to the offline project offline stage executed at present and Terminate the reason offline to offline project.
4. inserting method according to claim 1, which is characterized in that described in judgement when offline item target flow in setting Between in section with the presence or absence of including:
If so, terminating offline to offline project and being fed back by mail to the offline project offline stage executed at present and termination The reason offline to offline project.
5. inserting method according to claim 1, which is characterized in that according to offline project name, obtain Registered on Eureka-Server to offline project information before, the method also includes:
Modify Eureka Server configuration file, comprising:
Close self-protection mode;
Active failure detection times interval is set.
6. inserting method according to claim 1, which is characterized in that according to offline project name, obtain Registered on Eureka-Server to offline project information before, the method also includes:
Modification is to offline project profile, comprising:
Setting service expired time interval;
Setting service refresh time;
The periodic refreshing local cache time is set;
The ribbon cache flush time is set;
Enable pause endpoint.
CN201910593743.7A 2019-07-03 2019-07-03 A kind of inserting method based on Eureka-Server project Pending CN110297706A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910593743.7A CN110297706A (en) 2019-07-03 2019-07-03 A kind of inserting method based on Eureka-Server project

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910593743.7A CN110297706A (en) 2019-07-03 2019-07-03 A kind of inserting method based on Eureka-Server project

Publications (1)

Publication Number Publication Date
CN110297706A true CN110297706A (en) 2019-10-01

Family

ID=68030062

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910593743.7A Pending CN110297706A (en) 2019-07-03 2019-07-03 A kind of inserting method based on Eureka-Server project

Country Status (1)

Country Link
CN (1) CN110297706A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112911008A (en) * 2021-02-04 2021-06-04 中国工商银行股份有限公司 Cloud computing container online and offline method and device
CN113190546A (en) * 2021-05-26 2021-07-30 成都新希望金融信息有限公司 Eureka service control method, system and readable storage medium

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
TRUST_FREEDOM: "SpringCloud微服务如何优雅停机及源码分析", <HTTPS://WWW.CNBLOGS.COM/TRUST-FREEDOM/P/10744683.HTML> *
周立_ITMUCH: "实用技巧:SpringCloud中,如何优雅下线微服务?", 《HTTPS://WWW.JIANSHU.COM/P/82FB442480C3》 *
欢醉: "Eureka服务下线后快速感知配置", 《HTTPS://WWW.CNBLOGS.COM/ZHANGS1986/P/10529815.HTML》 *
菜兜兜: "kill与kill -9的区别", 《HTTPS://BLOG.CSDN.NET/U010486679/ARTICLE/DETAILS/78415666》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112911008A (en) * 2021-02-04 2021-06-04 中国工商银行股份有限公司 Cloud computing container online and offline method and device
CN113190546A (en) * 2021-05-26 2021-07-30 成都新希望金融信息有限公司 Eureka service control method, system and readable storage medium

Similar Documents

Publication Publication Date Title
US11005969B2 (en) Problem solving in a message queuing system in a computer network
US10719367B1 (en) Management of workers executing program code functions
US10713088B2 (en) Event-driven scheduling using directed acyclic graphs
CN107451147B (en) Method and device for dynamically switching kafka clusters
US10630556B2 (en) Discovering and publishing device changes in a cloud environment
US10505881B2 (en) Generating message envelopes for heterogeneous events
CN107534570A (en) Virtualize network function monitoring
US10592295B2 (en) Injection method of monitoring and controlling task execution in a distributed computer system
CN110245031B (en) AI service opening middle platform and method
CN109309585A (en) A kind of log collecting method, device and equipment
US10498817B1 (en) Performance tuning in distributed computing systems
CN106411970B (en) A kind of fault handling method based on service call, device and system
US9973306B2 (en) Freshness-sensitive message delivery
CN110297706A (en) A kind of inserting method based on Eureka-Server project
US11418583B2 (en) Transaction process management by dynamic transaction aggregation
CN112733001A (en) Method and device for acquiring subscription information and electronic equipment
CN107729213A (en) A kind of background task monitoring method and device
US11068487B2 (en) Event-stream searching using compiled rule patterns
US20180365126A1 (en) Processing failed events on an application server
US10346626B1 (en) Versioned access controls
US11061743B2 (en) Event loop optimization through event ordering
US11507437B2 (en) Deploying multiple different applications into a single short-lived container along with a master runtime
US11709750B2 (en) Dynamically mapping software infrastructure utilization
CN112866256A (en) Data processing method, device and storage medium
CN115134358B (en) Cross-cluster traffic forwarding method and device, computer 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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20191001