Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to" determining "or" in response to detecting ". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
Furthermore, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used for distinguishing between descriptions and not necessarily for describing or implying relative importance.
Reference throughout this specification to "one embodiment" or "some embodiments," or the like, means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated otherwise. The terms "comprising," "including," "having," and variations thereof mean "including, but not limited to," unless expressly specified otherwise.
In order to explain the technical means of the present application, the following examples are given below.
Example one
Referring to fig. 1, a system architecture diagram of an application of a service management method according to an embodiment of the present application is provided.
As shown in fig. 1, the system architecture may include a user terminal 101, a service manager 102. The user terminal 101 and the service manager 102 are connected via a network. A plurality of services may run on the service manager 102, such as a first service 1021, a second service 1022, and a third service 1023.
The user terminal 101 may be various electronic devices including, but not limited to, a smart phone, a tablet computer, a laptop portable computer, a desktop computer, and the like. Various applications may be installed on the user terminal 101, such as a vehicle diagnostic application, an error-checking application, an instant chat application, and so on.
The service manager 102 may establish a communication connection with the user terminal 101 through a network. In practice, the user terminal 101 and the service manager 102 may communicate with each other through a Transmission Control Protocol (TCP) or a Hypertext Transfer Protocol (HTTP).
The service manager 102 may be a server that provides various services, for example, a server that manages a target service (e.g., one or more of the first service 1021, the second service 1022, and the third service 1023) running on the service manager 102 based on control information transmitted by the user terminal 101. The service manager 102 may establish a communication connection with the user terminal 101; receiving control information sent by a user terminal 101, wherein the control information comprises a service identifier and an operation type; executing target operation corresponding to the operation type on the target service indicated by the service identification; the operation result information after the target operation is performed on the target service is transmitted to the user terminal 101.
The server may be hardware or software. When the server is hardware, it may be implemented as a distributed server cluster formed by multiple servers, or may be implemented as a single server. When the server is software, it may be implemented as multiple pieces of software or software modules (e.g., multiple pieces of software or software modules used to provide distributed services), or as a single piece of software or software module. And is not particularly limited herein.
It should be noted that the service management method provided in the embodiment of the present application is generally executed by the service manager 102, and accordingly, the service management apparatus is generally disposed in the service manager 102.
It should be understood that the number of user terminals and service managers in fig. 1 is merely illustrative. There may be any number of user terminals and service managers, as desired for the implementation.
Example two
Referring to fig. 2, a schematic flow chart of a service management method provided in an embodiment of the present application is shown, where the service management method shown in fig. 2 includes:
step 201, establishing a communication connection with a user terminal.
In the present embodiment, the execution subject for executing the service management method is generally a service manager (e.g., the service manager 102 shown in fig. 1). The execution main body can establish communication connection with the user terminal through a network. In practice, the execution body mentioned above is in communication connection with the user terminal proposal, typically by means of the TCP protocol and/or the HTTP protocol.
Step 202, receiving control information sent by the user terminal.
Wherein the control information comprises a service identification and an operation type. The service identification is generally information for indicating a service. For example, the service identification may be "1" to indicate the service currently numbered 1. The operation type is generally a type for operating on a service.
In practice, the type of operation may include, but is not limited to, at least one of: the method comprises the steps of looking up configuration information of the service, editing configuration files of the service, reloading the configuration files of the service, looking up running state information of the service, looking up running logs of the service and switching service directories. In practical applications, the operation types may further include: closing the service, starting the service, restarting the service, looking up the service list, closing all the services, and the like.
Wherein, the consulting of the configuration information of the service is generally to present the configuration information of the service to a user of the user terminal for consulting.
The configuration file of the service is edited, and the user of the user terminal generally adjusts the configuration information in the configuration file.
Reloading the configuration file of the service is typically based on restarting the service with the latest configuration file.
The operation state information of the service is referred, and is generally presented to the user of the user terminal for reference. The operation state information is generally information for describing an operation state of a service. The operating state information may include, but is not limited to, a start state including an on state and an off state, a number of restarts, an operating state, and the like. The running state generally refers to a state in which the service is in the course of running.
The switching service directory is typically used to switch the currently displayed directory to the directory currently entered by the user. For example, the control information may include "cd send" for switching to the "send" directory, where "cd" is used to indicate that the operation type is a switching service directory. In practice, if the operation type is switching service directory, the control information usually includes the directory currently input by the user.
It should be noted that, in the service manager, a configuration file may be stored for each service, and the configuration file carries configuration information for the service, such as a log path, a log name, a log level, a log open/close state, a dynamic library file name corresponding to the service, and the like.
The user terminal may send control information to the service manager via the network. In this way, the service manager may receive the control information. In practical applications, the control information may be communication information based on a TCP protocol, or communication information based on an HTTP protocol.
And step 203, executing the target operation corresponding to the operation type on the target service indicated by the service identification.
Wherein, the target service is generally the service indicated by the service identification. For example, if the service identifier is "1", the indicated service may be the service currently numbered 1.
The target operation is generally an operation corresponding to the operation type. In practical applications, each operation type may correspond to an operation.
In practice, if the operation type is configuration information of the lookup service, the operation corresponding to the operation type may be: configuration information of the target service is extracted.
If the operation type is a configuration file of the editing service, the operation corresponding to the operation type may be: and switching the configuration information of the target service into the configuration information currently input by the user.
If the operation type is a configuration file of the reloading service, the operation corresponding to the operation type may be: restarting the target service based on the latest configuration file of the target service.
If the operation type is the running state information of the lookup service, the operation corresponding to the operation type may be: and extracting the running state information of the target service.
If the operation type is the operation log of the lookup service, the operation corresponding to the operation type may be: and extracting the running log of the target service.
If the operation type is the switching service directory, the operation corresponding to the operation type may be: and switching the currently displayed directory to the directory currently input by the user.
Here, the execution agent may use the service identifier in the control information to find the service indicated by the service identifier from the plurality of services running on the service manager, and for convenience of description, the found service may be referred to as a target service. Then, the execution body may determine an operation corresponding to the operation type in the control information, and for convenience of description, it is referred to as a target operation. And finally, the execution main body executes the target operation on the target service. As an example, if the target operation is to extract a running log of the target service, the execution subject may extract the running log of the target service from a storage address where the running log of the target service is stored.
And step 204, sending operation result information after the target operation is executed on the target service to the user terminal.
The operation result information is generally information obtained by performing a target operation on a target service. As an example, if the target operation is to extract a running log of the target service, the execution subject may extract the running log of the target service from a storage address where the running log of the target service is stored. At this time, the obtained information is a running log, and the operation result information is a running log.
Here, after the target operation is performed on the target service, the execution body may transmit the operation result information to the user terminal through the network. In this way, the user of the user terminal can remotely acquire the operation result information of the target service to be managed.
According to the method provided by the embodiment, the user terminal can remotely manage the target service running on the service manager in a mode of sending the control information to the service manager, does not need to be on site at the service manager and does not need to execute complicated operation to connect a remote desktop to the service manager, and the method is favorable for flexibly and conveniently managing the service running on the service manager.
In some optional implementation manners of this embodiment, executing a target operation corresponding to the operation type on a target service that is executed on the service manager and indicated by the service identifier may include: and if the operation type is the configuration information of the consulting service, extracting the configuration information of the target service from a storage address for storing the configuration information of the target service.
At this time, the sending, to the user terminal, operation result information after the target operation is performed on the target service may include: and sending the configuration information of the target service to the user terminal.
Here, if the user terminal requests to acquire the configuration information of the target service on the service manager, the service manager may return the configuration information of the target service to the user terminal. The service manager can send information to the user terminal according to the requirement of the user terminal, and more comprehensively sends various information of the target service to the user terminal, so that network resources can be saved, the information sending speed is increased, and the service can be efficiently managed.
In some optional implementation manners of this embodiment, executing a target operation corresponding to the operation type on a target service that is executed on the service manager and indicated by the service identifier may include: and if the operation type is the running state information of the consulting service, extracting the running state information of the target service from a storage address for storing the running state information of the target service.
At this time, the sending, to the user terminal, operation result information after the target operation is performed on the target service may include: and transmitting the running state information of the target service to the user terminal.
Here, if the user terminal requests to acquire the operation state information of the target service on the service manager, the service manager may return the operation state information of the target service to the user terminal. The service manager can send information to the user terminal according to the requirement of the user terminal, and more comprehensively sends various information of the target service to the user terminal, so that network resources can be saved, the information sending speed is increased, and the service can be further efficiently managed.
In some optional implementation manners of this embodiment, executing a target operation corresponding to the operation type on a target service that is executed on the service manager and indicated by the service identifier may include: and if the operation type is the configuration file of the editing service and the control information further comprises the currently input configuration information, switching the configuration information of the target service into the currently input configuration information.
At this time, the sending, to the user terminal, operation result information after the target operation is performed on the target service may include: and sending information for prompting that the configuration information of the target service is switched to be completed to the user terminal.
Here, if the user terminal requests to adjust the configuration file of the service, the service manager may switch the configuration information of the target service to the currently input configuration information, may implement convenient and flexible management of the target service, and is helpful to further implement flexible and convenient management of the service running on the server.
In an alternative implementation manner of the various embodiments of the present application, the control information includes a command line and the service identifier and the operation type in the control information are parameters of the command line. At this time, the service management method may further include: and responding to the user terminal and the service manager to establish communication connection, and sending operation prompt information to the user terminal. The operation prompt information comprises a command line and instruction information of the command line.
In practice, the control information may be implemented as a command line, and when the control information is implemented as a command line, the service identifier and the operation type in the control information may be implemented as parameters of the command line.
The command line generally refers to a command prompt, which is a kind of work prompt for prompting command input in the operating system.
FIG. 3 is a schematic diagram of command lines and an illustration of use of command lines provided by an embodiment of the present application.
As shown in FIG. 3, the "help" command may obtain help information. In practice, if the user enters "help", the service manager may return all of the contents shown in fig. 3 to the user terminal.
The "exit" command may be used to exit the current application. The "exit" command may function the same as the "get" command.
The "cd" command may be used to switch service directories.
The "ls" command may be used to consult a service list. The "ls-r" command may be used to refresh the service list and the "ls-l" may be used to refer to the entire service list.
The "start" command may be used to start a service. The "start 2" command may be used to start a service with sequence number 2. The "start all" command may be used to start all services.
The "startAll" command may be used to start all services.
The "stop" command may be used to close the service. The "stop 2" command may be used to close the service with sequence number 2. The "stop all" command may be used to close all services.
The "restart" command may be used to restart the service. The "restart 2" command may be used to restart a service with sequence number 2. The "restart all" command may be used to restart all services.
The "load" command is used to reload the configuration file for the service. The newly loaded configuration file is only valid if the service is restarted.
The "stopMgr" command is used to close all services and manage processes.
The "dump" command is used to refer to the intra-service message. Here, it is general to refer to the operation state information of the service.
The showcfg command is used to refer to service internal data. Here, it is general to refer to configuration information of the service.
The "updata" command is used to edit the service configuration. Here, it is typically a configuration file for editing a service.
Here, since there are usually many command lines, in order to facilitate the operation of the operation and maintenance staff, when the user terminal establishes a communication connection with the service manager, the service manager may push various command lines and instructions for the command lines to the user terminal. Therefore, the user of the user terminal can conveniently and quickly use the command line to conveniently and flexibly manage each service operated on the service manager.
In an optional implementation manner of each embodiment of the present application, the service management method may further include the following steps: and aiming at each service running on the service manager, if the corresponding service meets the preset restarting condition, executing service restarting on the corresponding service.
Wherein the preset restart condition comprises that the starting state is changed from the starting state to the stopping state and at least one of the following two items: the restart times are smaller than a preset time threshold value and belong to a preset service set.
Here, if the number of times of restarting a certain service is less than a preset number threshold, the service may be restarted. Otherwise, if the restart time of a certain service is greater than or equal to the preset time threshold, for example, 5, the service is not restarted any more.
The services in the preset service set are generally preset services, and may be payment-related services, for example. Here, if a service belongs to a preset service set, the service may be restarted.
It should be noted that since some services need to be run for a long time, for example, paying for related services, restarting the service can ensure the stability of the application. In addition, since the calculation resources are consumed for restarting the service, only the service meeting the preset restart condition is restarted, and the calculation resources can be saved.
In an optional implementation manner of each embodiment of the present application, the service management method may further include: and aiming at each service running on the service manager, if the corresponding service is detected to be abnormal, sending abnormal prompt information for prompting that the corresponding service is abnormal to the user terminal.
The abnormality notification information is generally information for notifying that there is an abnormality in the service. Here, for each service running on the service manager, if there is an abnormality in the service, for example, the start state changes to the stop state after the service is restarted four times, the execution body may send an abnormality notification message to the user terminal. Therefore, the user of the user terminal can timely learn about the abnormal service and process the abnormal service.
In an alternative implementation of various embodiments of the present application, the configuration files of the services running on the service manager are in the same format. The log files of each service running on the service manager are in the same format.
In practice, the format data of the configuration file of each service may include, but is not limited to, at least one of: service name, service function description information, service log name, service log path information, service log level information, and the like. The format data of the log file of each service may include, but is not limited to, at least one of: log generation time, name of service recorded by the log, log type, log entry, etc.
It should be noted that the configuration files of the services running on the service manager have the same format, and the log files of the services running on the service manager have the same format, so that the configuration files and the log files of the services can be uniformly and efficiently managed, and the efficiency of managing the services running on the management server is improved.
In an alternative implementation of various embodiments of the present application, the service programs for each service running on the service manager are stored in the form of a dynamic library.
Among them, a Dynamic Library is also called a Dynamic Link Library (DLL), which is a Library containing code and data that can be used by a plurality of programs at the same time, and the DLL is not an executable file. DLLs facilitate sharing of data and resources, and multiple applications can access the contents of a single DLL copy in memory at the same time. The dynamic library under the Windows operating system is a dll suffix, and the dynamic library under the linux operating system is a so suffix.
It should be noted that the service programs of the services running on the service manager are stored in the form of a dynamic library, and the service manager can uniformly load or manage the service programs of the services. The efficiency of managing each service running on the management server is further improved.
EXAMPLE III
Further referring to fig. 4, corresponding to the service management method of the foregoing embodiment, fig. 4 is a block diagram of a service management apparatus 400 provided in the embodiment of the present application, and for convenience of description, only the relevant parts of the embodiment of the present application are shown.
Referring to fig. 4, the apparatus includes:
a connection establishing unit 401, configured to establish a communication connection with a user terminal;
an information receiving unit 402, configured to receive control information sent by a user terminal, where the control information includes a service identifier and an operation type;
an operation execution unit 403, configured to execute a target operation corresponding to the operation type on the target service indicated by the service identifier;
a result sending unit 404, configured to send operation result information after the target operation is performed on the target service to the user terminal.
In some embodiments, the type of operation includes at least one of: the method comprises the steps of looking up configuration information of the service, editing configuration files of the service, reloading the configuration files of the service, looking up running state information of the service, looking up running logs of the service and switching service directories.
In some embodiments, the configuration files for each service running on the service manager are in the same format;
the log files of each service running on the service manager are in the same format.
In some embodiments, the service programs for each service running on the service manager are stored in a dynamic library form.
In some embodiments, the apparatus further comprises an exception prompting unit (not shown in the figures). Wherein, the abnormity prompting unit is used for: and aiming at each service running on the service manager, if the corresponding service is detected to be abnormal, sending abnormal prompt information for prompting that the corresponding service is abnormal to the user terminal.
In some embodiments, the control information includes a command line and the service identification and the operation type in the control information are parameters of the command line; and the device may further comprise an information prompting unit (not shown in the figures). Wherein, the information prompting unit can be used for: and responding to the communication connection established between the user terminal and the service manager, and sending operation prompt information to the user terminal, wherein the operation prompt information comprises a command line and instruction information of the command line.
In some embodiments, the apparatus may further include a restart judgment unit (not shown in the drawings). Wherein, the restart judging unit may be configured to: for each service running on the service manager, if the corresponding service meets a preset restarting condition, executing service restarting on the corresponding service; wherein the preset restart condition comprises a change of the starting state from the starting state to the stopping state and at least one of the following: the restart times are smaller than a preset time threshold value and belong to a preset service set.
According to the device provided by the embodiment, the user terminal can remotely manage the target service running on the service manager in a mode of sending the control information to the service manager, the user terminal does not need to be on the site of the service manager in a squatting mode, and does not need to execute complicated operation to connect a remote desktop to the service manager, so that the user terminal is beneficial to flexibly and conveniently managing the service running on the server.
It should be noted that, for the information interaction, execution process, and other contents between the above-mentioned devices/units, the specific functions and technical effects thereof are based on the same concept as those of the embodiment of the method of the present application, and specific reference may be made to the part of the embodiment of the method, which is not described herein again.
Example four
Referring further to fig. 5, fig. 5 is a schematic structural diagram of a server 500 according to an embodiment of the present application. As shown in fig. 5, the server 500 of this embodiment includes: at least one processor 501 (only one processor is shown in fig. 5), a memory 502, and a computer program 503, such as a service management program, stored in the memory 502 and operable on the at least one processor 501. The steps in any of the various method embodiments described above are implemented when the computer program 503 is executed by the processor 501. The steps in the embodiments of the respective service management methods described above are implemented when the processor 501 executes the computer program 503. The processor 501, when executing the computer program 503, implements the functions of each module/unit in each device embodiment described above, such as the functions of the units 401 to 404 shown in fig. 4.
Illustratively, the computer program 503 may be divided into one or more modules/units, which are stored in the memory 502 and executed by the processor 501 to accomplish the present application. One or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution of the computer program 503 in the server 500. For example, the computer program 503 may be divided into a connection establishing unit, an information receiving unit, an operation executing unit, and a result sending unit, and specific functions of each unit are described in the foregoing embodiments, and are not described herein again.
The server 500 may be a server, a desktop computer, a tablet computer, a cloud server, a mobile terminal, and other computing devices. The server 500 may include, but is not limited to, a processor 501, a memory 502. Those skilled in the art will appreciate that fig. 5 is merely an example of a server 500 and is not intended to be limiting of server 500, and may include more or fewer components than those shown, or some components in combination, or different components, e.g., the server may also include input-output devices, network access devices, buses, etc.
The Processor 501 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The storage 502 may be an internal storage unit of the server 500, such as a hard disk or a memory of the server 500. The memory 502 may also be an external storage device of the server 500, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), etc. provided on the server 500. Further, memory 502 may also include both internal storage units of server 500 and external storage devices. The memory 502 is used to store computer programs and other programs and data required by the server. The memory 502 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules, so as to perform all or part of the functions described above. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/server and method may be implemented in other ways. For example, the above-described apparatus/server embodiments are merely illustrative, and for example, a division of modules or units is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated module, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in a computer readable storage medium. The computer readable storage medium may be non-volatile or volatile. Based on such understanding, all or part of the processes in the methods of the embodiments described above may be implemented by hardware related to instructions of a computer program, which may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the steps of the methods described above may be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable storage medium may include: any entity or device capable of carrying computer program code, recording medium, U.S. disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution media, and the like. It should be noted that the computer readable storage medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable storage media that does not include electrical carrier signals and telecommunications signals in accordance with legislation and patent practice.
The above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.