CN115795121A - Method and device for inquiring machine information - Google Patents

Method and device for inquiring machine information Download PDF

Info

Publication number
CN115795121A
CN115795121A CN202211599893.7A CN202211599893A CN115795121A CN 115795121 A CN115795121 A CN 115795121A CN 202211599893 A CN202211599893 A CN 202211599893A CN 115795121 A CN115795121 A CN 115795121A
Authority
CN
China
Prior art keywords
machine
machine information
information
environment
query
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
CN202211599893.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.)
Advanced Nova Technology Singapore Holdings Ltd
Original Assignee
Alipay Labs Singapore Pte 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 Alipay Labs Singapore Pte Ltd filed Critical Alipay Labs Singapore Pte Ltd
Priority to CN202211599893.7A priority Critical patent/CN115795121A/en
Publication of CN115795121A publication Critical patent/CN115795121A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The disclosure provides a method and a device for inquiring machine information, which can improve the success rate of program operation. The method comprises the following steps: receiving a first query request sent by a query end, wherein the first query request is used for querying first machine information, and the first machine information is machine information of a target machine environment in multiple machine environments; inquiring the first machine information according to the first inquiry request; checking a service state of a first machine associated with the first machine information; if the service state of the first machine is an available state, returning the first machine information to the inquiry end; and if the service state of the first machine is the unavailable state, returning second machine information to the inquiry end, wherein the second machine information is the machine information in the target machine environment, and the service state of the second machine related to the second machine information is the available state.

Description

Method and device for inquiring machine information
Technical Field
The disclosure relates to the technical field of machine environment management, in particular to a method and a device for inquiring machine information.
Background
The configuration information of the engineering machine is written in the corresponding configuration files according to different environments, and when the program runs, the configuration information is loaded and the code runs on the fixed machine. However, if the service status of the machine running the code is in an unavailable status, the running of the program is directly failed, which is not beneficial to improving the success rate of the running of the program.
Disclosure of Invention
The disclosure provides a method and a device for inquiring machine information, which can improve the success rate of program operation.
In a first aspect, a method for querying machine information is provided, including: receiving a first query request sent by a query end, wherein the first query request is used for querying first machine information, and the first machine information is machine information of a target machine environment in multiple machine environments; inquiring the first machine information according to the first inquiry request; checking a service state of a first machine associated with the first machine information; if the service state of the first machine is an available state, returning the first machine information to the inquiry end; and if the service state of the first machine is the unavailable state, returning second machine information to the inquiry end, wherein the second machine information is the machine information in the target machine environment, and the service state of the second machine related to the second machine information is the available state.
In a second aspect, an apparatus for querying a machine is provided, comprising: the system comprises a receiving module, a query module and a query module, wherein the receiving module is used for receiving a first query request sent by a query end, the first query request is used for querying first machine information, and the first machine information is machine information of a target machine environment in multiple machine environments; a processing module to perform the following operations: inquiring the first machine information according to the first inquiry request; checking a service state of a first machine associated with the first machine information; if the service state of the first machine is an available state, returning the first machine information to the inquiry end; and if the service state of the first machine is the unavailable state, returning second machine information to the inquiry end, wherein the second machine information is the machine information in the target machine environment, and the service state of the second machine related to the second machine information is the available state.
In a third aspect, an apparatus for querying machine information is provided, including: a memory having executable code stored therein, the processor being configured to execute the executable code to perform the method of the first aspect.
In a fourth aspect, there is provided a computer readable storage medium having stored thereon executable code that when executed is capable of implementing the method of the first aspect.
A sixth aspect provides a computer program product comprising executable code that when executed is capable of implementing the method of the first aspect.
When the inquiry end inquires the machine information, the service state of the machine is checked. Only if the service state of the machine is in the available state, the corresponding machine information is returned. And if the service state of the machine is the unavailable state, returning the machine information of which the other service state is the available state to the inquiry end. Therefore, the machine inquired or used by the inquiry end is ensured to be the machine in the available state, and the success rate of program operation can be improved.
Drawings
Fig. 1 is a schematic diagram of a partitioning manner of a machine environment according to an embodiment of the present disclosure.
Fig. 2 is a schematic flowchart of a method for querying machine information according to an embodiment of the present disclosure.
Fig. 3 is a schematic flow chart of an implementation process of a data buffer according to an embodiment of the present disclosure.
Fig. 4 is a schematic structural diagram of a machine environment management system according to an embodiment of the present disclosure.
Fig. 5 is a schematic flow chart of another method for querying machine information according to an embodiment of the present disclosure.
Fig. 6 is a schematic flow chart of another implementation process of the data buffer according to the embodiment of the disclosure.
Fig. 7 is a schematic structural diagram of an apparatus for querying machine information according to an embodiment of the present disclosure.
Fig. 8 is a schematic structural diagram of another apparatus for querying information of a machine according to an embodiment of the disclosure.
Detailed Description
Applications need to run on the machine from development to deployment at the end. The machine may provide services during the stages of program development, testing, and acceptance. Machines in engineering can be classified according to environment, machine rooms and the like, different environments can correspond to different machines, and different machine rooms can also correspond to different machines. Different machines may perform different tasks such as development tasks, testing tasks, and acceptance tasks.
The environment in which the machine operates may be referred to as a machine environment. A machine environment may refer to a machine cluster environment invoked by an application program when running. The machine environment in the embodiments of the present disclosure may include a development environment, a test environment, a stable environment, a joint debugging environment, an isolation environment, and the like. The several machine environments are described below.
A development (dev) environment, in which development branch code developed by self is deployed on machines, mainly for developing new functions, verification and test usage, may be referred to as a temporary development environment. A machine deployed in a development environment may be referred to as a development machine.
Stable (stable) environment: the online code which is released last time is deployed on the machine, a set of testing environment which is the same as the online code is kept, and the database is consistent with the development (dev) environment. A machine deployed in a stable environment may be referred to as a stable machine.
Joint debugging environment: a cluster of service machines, combined by development (dev) machines and (stable) stable machines, is generally used for functional development and self-test. When the business link is long and development only needs to verify changes of a few of the systems, then the few systems can be deployed in the development environment, and other systems on the link can be deployed in a stable environment.
And (3) testing environment: a cluster of service machines combined by test machines. Deployed on the machine is the backbone (master) branch code, and the database uses a set of test environments, which are generally used for developing the functional test and regression test after the test.
And (3) isolating the environment: a cluster of service machines consisting of isolated machines. All middleware, applications and db in the environment are completely isolated from other environments, and the database is contracted with tables. And multiple sets of isolation environments can be expanded aiming at different industry lines and used for verification regression of corresponding services. The stability is higher because the using amount is reduced.
At present, the machine configuration information in engineering is written in corresponding configuration files according to different environments, and when a program runs, the configuration information is loaded and a code runs on a fixed machine service. This approach can have the following problems:
1. the success rate of program running is severely affected by the machine configuration. If a machine of a certain application fixedly written in a configuration file is in an unavailable state, for example, the machine is in deployment or the service of the machine is down, the running of a program can be directly caused to fail. In addition, if the machine is in an unavailable state, some program links with long verification can be terminated, so that the verification time is prolonged, and the verification success rate is seriously reduced.
2. The manual investigation and problem solving time is long. On the basis of the point 1, if the program case runs and reports errors, the time required for development and testing personnel to manually solve the problems is long. Development and testing personnel need to manually troubleshoot and redeploy the machine until the machine health is recovered, or replace the fixed problematic machine configuration on the configuration file, and perform testing again.
3. Multiple environment management lacks automation. For the situations that an application machine is newly added, a set of environment is newly added or the machine is abandoned, manual inspection and manual reconfiguration testing are needed, repetitive work is more, and intelligent management is lacked.
In view of one or more of the above problems, embodiments of the present disclosure provide a method and an apparatus for querying machine information, when a query end needs to query machine information, by checking a service state of a machine and returning the machine information whose service state is an available state, a problem that a success rate of program operation is reduced due to the use of an unavailable machine operation program can be avoided.
The method of the embodiment of the disclosure can be applied to a machine environment management system. The machine environment management system can support a variety of machine environments. The various machine environments may include the joint debugging environment, the testing environment, the isolation environment, and the like described above.
The machine environment of the machine center may include a development environment, a stable environment, a test environment, and an isolation environment. The embodiment of the disclosure can convert the machine environment of the machine center into the joint debugging environment, the testing environment and the isolation environment of the upgraded environment management center, as shown in fig. 1. Therein, the joint debugging environment may be represented by dev.
As can be seen from fig. 1, embodiments of the present disclosure may combine a development environment and a stable environment into a joint debugging environment. Additionally, the disclosed embodiments may directly utilize machine groupings in the environment hub. For example, machine groupings in the joint debugging environment of the upgraded environment management center may multiplex machine groupings in the development environment. The upgraded machine group of the isolated environment of the environment management center may also reuse the machine group of the isolated environment of the environment center. In the subsequent machine information inquiry process, inquiry can be performed by using a machine group. The stable machines in the joint debugging environment do not belong to the machines in the group, and in the subsequent inquiry process, if the machine to be inquired does not belong to the machines in the machine group, the inquiry can be carried out from the stable machines.
Machines in different environments have different clusters, and the label of each cluster is an environment group name and is a unique distinguishing label. The environment group name here may be used to indicate a machine in a machine group.
Different machine environments may have different machines deployed. In some embodiments, the machines in the machine environment may be divided by machine rooms. For example, a machine environment may include multiple machine rooms, each of which may have a different machine deployed therein.
A method for querying machine information according to an embodiment of the present disclosure is described below with reference to fig. 2. The method shown in fig. 2 includes steps S210 to S250.
In step S210, a first query request sent by a query end is received. The first query request is for querying first machine information. The first machine information is machine information of a target machine environment among the plurality of machine environments.
The machine environment system in the embodiment of the present disclosure may be deployed with machine information corresponding to a plurality of machine environments. The various machine environments may include the joint debugging environment, the testing environment, the isolation environment, and the like described above.
In some embodiments, the querying end may query for machine information in a particular machine environment. For example, the query side may query machine information in the joint debugging environment. That is, the first machine information may be machine information in a joint debugging environment. In some embodiments, the querying end may also query machine information for a particular application in a particular machine environment. For example, the querying end may query the isolated environment for machine information for application a. That is, the first machine information may be machine information for application a in the isolation environment. In other embodiments, the query end may query machine information of a specific machine room in a specific machine environment for a specific application. For example, the query side may query machine information for the application b in the machine room 1 in the test environment. That is, the first machine information may be machine information for the application b in the machine room 1 in the test environment.
The first machine information may be machine information of one machine, or may be machine information of multiple machines, which is not specifically limited in this disclosure.
In step S220, the first machine information is queried according to the first query request. After receiving the first query request, the machine environment management system may query the first machine information.
In step S230, a service status of the first machine associated with the first machine information is checked.
The service state of the first machine may include an available state and an unavailable state. The available state indicates that the first machine is capable of providing the service, and the unavailable state indicates that the first machine is not capable of providing the service.
The determination method of the service state of the first machine in the embodiment of the present disclosure is not particularly limited as long as the service state of the machine can be determined. For example, the service status of a machine may be checked based on service self-check techniques. If a certain service deployed on a machine supports a function of dynamically checking the health state of the service, for example, monitoring whether the service normally supports work through a timed task of programming a shell script, the embodiment of the present disclosure may check the service state of the machine by using the function of the machine.
Of course, in other embodiments, other means may be used to monitor the service status of the machine, such as deploying a health monitoring module on the machine to detect the service status of the machine.
In step S240, if the service status of the first machine is available, the first machine information is returned to the querying end.
In step S250, if the service status of the first machine is unavailable, the second machine information is returned to the querying end.
The second machine information is machine information in the target machine environment, and the service state of the second machine associated with the second machine information is an available state.
When detecting that the first machine is in the unavailable state, the machine environment management system may query other machines corresponding to the target machine environment, check the service states of the other machines, and select the second machine in the available state.
Whether a machine is available may be determined by the load of the machine and/or the connection status of the machine. As one example, if the load of the machine is too high, such as greater than a preset threshold, it may be determined that the machine is in an unavailable state; if the load on the machine is small, such as less than or equal to a preset threshold, it may be determined that the machine is in an available state. The size of the preset threshold is not specifically limited in the embodiment of the disclosure, and the preset threshold can be set according to actual needs. The preset threshold may be, for example, 0.7.
As another example, if the machine may connect normally, it may be determined that the machine is in an available state; if the machine is not able to connect properly, it may be determined that the machine is in an unavailable state.
The connection status of the machine may be determined by testing through a remote connection command. The remote connect command may be, for example, a telnet connect command. the telnet protocol is a member of the transmission control protocol/Internet protocol (TCP/IP) protocol suite, and is a standard protocol and a main mode for the Internet remote login service. It provides the user with the ability to do remote host work on the local computer. The telnet program is used on the end user's computer to enable connection to the server.
The embodiment of the disclosure can acquire other available machines in the target machine environment and return the machine information in the available state to the query end under the condition that the machine corresponding to the target machine environment is in the unavailable state, thereby ensuring that the machines used by the query end are all in the available state and improving the success rate of program operation. In addition, the problem of time efficiency caused by manual investigation can be avoided.
The machine environment management system may include a machine center in which machine information may be stored. Services in different machine environments may be performed and verified through a machine center. Each machine environment has a large amount of services, and if the machine center is directly accessed each time, the machine center generates a large load, which is not beneficial to improving the query efficiency.
Based on this, the embodiment of the disclosure can also deploy a data cache (or called a cache policy) in the machine environment management system. The data buffer can buffer machine information corresponding to different machine environments. By arranging the data cache, the query end can query from the data cache when querying the machine information, and then query from the machine center when the data cache does not contain the corresponding machine information, so that the frequency of accessing the machine center can be reduced, the load of the machine center is reduced, and the query efficiency is improved.
The embodiment of the present disclosure does not specifically limit the data content cached in the data cache. For example, the data buffer may buffer one piece of machine information corresponding thereto for each machine environment. Of course, in some embodiments, the data buffer may also buffer a plurality of corresponding machine information for each machine environment.
If the machine environment management system is deployed with the data cache, the machine environment management system can inquire whether the first machine information is cached in the data cache according to the first inquiry request. And if the first machine information is not cached in the data cache, inquiring the first machine information from the machine center. If the first machine information is cached in the data center, the first machine information can be directly obtained from the data cache.
The embodiment of the present disclosure does not specifically limit the structure of the data stored in the data buffer. The data in the data buffer may be stored in any of a variety of configurations. In some embodiments, a data storage module may be included in the data cache, and a multi-environment multi-room data model is deployed on the data storage module. The multi-environment multi-room data model may classify and/or index machine information in the data cache based on one or more of the following information: company name, machine environment, application name, and machine room to which the machine belongs. By classifying or indexing the machine information, query efficiency can be improved. In some embodiments, after receiving a first query request sent by a query end, the data cache may query, through the multi-environment multi-room data model, whether the first machine information is cached in the data cache.
The embodiment of the present disclosure does not specifically limit the hierarchy or the dimension of the 4 indexes, i.e., the company name, the machine environment, the application name, and the machine room to which the machine belongs. For example, the data may be stored in a first dimension of company information, a second dimension of environment information, a third dimension of application information, and a fourth dimension of machine room information. The code may be expressed as: map < String (String of company information), map < String (String of environment information), map < String (String of application information), hashMap < EnvZoneEnum, list < EnvBaseMachineInfo > >.
For example, if the keyword of the machine information to be queried by the querying end includes a company a, a joint tone environment, an application abc and a machine room US, the data cache may first search for the machine information corresponding to the company a, then select the machine information belonging to the joint tone environment from the machine information, then further select the machine information belonging to the application abc from the machine information, and finally further select the machine information belonging to the machine room US from the machine information, thereby obtaining the machine information to be queried by the querying end.
The embodiment of the disclosure can also detect the machine information in the data buffer to judge whether the machine information in the data buffer is reliable. For example, the reliability of the third machine information in the data buffer may be detected. And if the third machine information is unreliable, replacing the third machine information with reliable fourth machine information. By detecting the reliability of the machine information in the data buffer, the machine information stored in the data buffer can be ensured to be reliable, and the success rate of program operation can be further ensured. In addition, the reliability of the data cached in the data cache is ensured, the hit rate of the cached data can be improved, and the high performance and the high availability of a program running machine are ensured.
The reliability of the machine information may be determined based on one or more of the following information: the load of the machine, the creation time of the machine information, and the connection state of the machine. These cases are described separately below.
In some embodiments, the reliability of the machine information may be determined based on a load of the machine. If the load on the machine is too high, the machine information may be deemed unreliable. If the load of the machine is low, the machine information can be considered reliable. For example, the data cache may detect a load of the third machine with which the third machine information is associated. If the load of the third machine is greater than the preset threshold, indicating that the load of the third machine is too high, it may be determined that the third machine information is not reliable.
The load is an important index of a machine (such as a linux machine), and the state of the machine can be intuitively reflected. The reasons for the load of the machine may include Central Processing Unit (CPU) usage, memory usage, input Output (IO) consumption, and the like. Excessive use of either item can result in a sharp rise in machine load, resulting in improper machine operation.
In some embodiments, the reliability of the machine information may be determined based on a time interval between a creation time of the third machine information and a current time. If the time interval is greater than a preset threshold, it may be determined that the third machine information is unreliable; if the time interval is less than or equal to the preset threshold, it may be determined that the third machine information is reliable.
The data buffer can periodically perform timeout self-checking on the machine information in the data buffer to determine whether a time interval between creation time of the third machine information and current time is greater than a preset threshold. If the time interval is greater than the preset threshold, the data buffer may update the machine information from the machine center, such as updating the third machine information to the fourth machine information.
The data buffer may periodically perform a self-check for machine information over time to determine if the machine information needs to be updated. For example, the data buffer may self-check the machine information for timeouts every 30 minutes. Of course, the database buffer may also perform timeout self-check on the machine information by taking other time as a period, which is not specifically limited in the embodiment of the present disclosure.
The third device information may be device information of one device or device information of a plurality of devices. The data cache may check each piece of machine information individually or may check a batch of machine information together. The dividing manner of the third machine information is not specifically limited in the embodiments of the present disclosure. For example, the third machine information may be all machine information corresponding to one machine environment. For another example, the third machine information may be all the machine information corresponding to one machine room.
In some embodiments, the reliability of the machine information may be determined based on a connection state of the machine. If the machine can not be connected normally, the information of the machine is unreliable. If the machine can be normally connected, the information of the machine is reliable. For example, the data buffer may be instructed by a remote connection to test whether the machine can be connected normally. If the machine can be normally connected, the machine information related to the machine is reliable; if the machine is not properly connected, the machine information associated with the machine is unreliable. The remote connection command may be a telnet connection command.
The above reliability determination methods may be implemented individually or in combination, and this is not particularly limited in the embodiments of the present disclosure. For example, the reliability of the machine information may be determined based on the load of the machine and the creation time of the machine information. For another example, the reliability of the machine information may be determined based on the connection state of the machine and the load of the machine. For another example, the reliability of the machine information may be determined based on the load of the machine, the creation time of the machine information, and the connection state of the machine.
The reliability detection of the machine information can be completed through a policy module and a self-checking module in the data buffer. For example, the policy module may detect the load of the machine, the frequency of access of the machine information. For another example, the self-test module may detect a load of the machine and a connection state of the machine.
The following describes the execution process of the self-checking module, the data storage module and the policy module in the data buffer with reference to fig. 3.
In step S310, the self-check module checks the reliability of the machine information.
The self-checking of the self-checking module comprises two processes. The first process includes a telnet remote connection command to test whether the machine can be normally connected, and the information of the normally connected machine is stored in the data buffer. The second process involves looking at the load condition of the machine through the uptime command. And storing the machine information with the load in a lower state (such as the load is less than 0.7) into the data buffer.
In step S320, the data storage module stores the machine information after the self-test (after the self-test in step S310).
The data storage module can store the machine information according to the four dimensions of company information, environment information, application information and a machine room. When the machine information is stored, the data storage module may store the machine information with company information as a first dimension, environment information as a second dimension, application information as a third dimension, and a machine room as a fourth dimension.
In step S330, the policy module checks the authenticity of the machine information in the data cache.
Step S330 may include step S331 and step S332. In step S331, timeout self-checking is performed on the machine information in the data buffer. The policy module may renew the machine information in the data buffer after the creation time of the machine information exceeds a preset time.
For example, the policy module may establish a machine information creation time recording mechanism Map < String, date >. In some embodiments, a unique key may be combined with a first-dimension company CODE number COM _ CODE, a second-dimension environment NAME ENV _ NAME, and a creation time of the machine information may be recorded. That is, the machine information may be created or updated at the granularity of the company information and the environment name. Of course, the machine information may also be created or updated with other information as a granularity, which is not specifically limited by the embodiment of the present disclosure.
For example, assuming that the buffering creation time of ANT _ TEST is 2022-08-10, the timeout time is, for example, 8 hours, the timing task performs timeout self-checking every 30 minutes, and when the time interval between the creation time of the buffered machine information and the current time exceeds 8 hours, the data buffer may delete the buffered machine information, obtain valid machine information from the machine center (e.g., through an environment interface adapter described below) again and store the valid machine information in the data buffer, and update the buffering creation time of the machine information.
In step S332, the policy module may detect a load of the machine. If the machine is overloaded, the cached machine information is stale, and the policy module may replace the overloaded machine with a less loaded machine. For example, if the load of the machine exceeds 0.7, the data buffer may retrieve valid machine information from the machine center (e.g., via the environment interface adapter described below) and store the machine information in the data buffer, and update the buffer creation time of the machine information.
The policy module may periodically check the load of the machine. For example, the policy module may check the load of the machine every 1 hour.
For example, the policy module may check every 1 hour whether the cache machines of different environments of ANT corporation are too heavily loaded. The checking sequence of the machine information of different environments is not specifically limited in the embodiments of the present disclosure. For example, the policy module may check the machine information corresponding to the joint debugging environment and the testing environment first, and then check the machine information corresponding to the isolation environment.
Taking ANT _ TEST as an example, in the checking process, the policy module may perform self-checking on the machine information corresponding to ANT _ TEST according to the detection method in step S310. If the self-test is not passed, the data buffer can obtain valid machine information from the machine center again and store the valid machine information in the data buffer, and the buffer creation time of the machine information is updated.
As can be seen from the above, if the machine information in the data buffer is not reliable, the data buffer needs to be reloaded with the machine information from the machine center and inserted into the data buffer. In some embodiments, there are cases where different threads query the same machine information, and if two threads query the same machine information and the corresponding machine information in the data cache is not reliable, the data cache reloads the machine information from the machine center for the two threads, respectively.
If there is some delay difference between two threads, there may be a case where the machine information loaded by the two threads is different, that is, there may be a case where the two threads query the machine information of the same environment, but the query result is a different machine list. For example, external multiple threads (e.g., thread 1 and thread 2) query ANT _ TEST for machine information at the same time. Thread 1 returns machine list a from the machine center, thread 2 is later than thread 1, and in the time interval, the machine center is newly added with machine a, and there may be a case that the machine list queried by thread 2 includes machine a, and the machine list queried by thread 1 does not include machine a.
In view of this situation, the embodiment of the present disclosure provides that before inserting new machine information each time, the data buffer may check whether machine information corresponding to the same machine environment is already cached in the data buffer. If the machine information of the same environment is cached in the data cache and is reliable, the machine information can be directly used without inserting new machine information into the data cache, so that the same machine list can be accessed by different threads.
In some embodiments, the data buffer may check whether the data buffer has reliable sixth machine information buffered therein in response to an operation of adding the fifth machine information to the data buffer. And the sixth machine and the fifth machine belong to the same machine environment. The sixth device information may be the same as or different from the fifth device information. The fifth machine information and the sixth machine information may be machine information respectively queried by the plurality of threads described above.
If the data buffer does not have the reliable sixth machine information cached therein, the data buffer may add the fifth machine information to the data buffer. If the data buffer stores reliable sixth machine information, the sixth machine information of the data buffer can be directly used, for example, the data buffer can return the sixth machine information to the query end.
In the related technology, the query interfaces and parameters of each environment are inconsistent, and the user experience is poor.
For example, the related art mentions an Antvip query service whose main function is to provide a query service for an internal domain name- > IP address list. However, the query mode only supports the internal domain name to query the service machine, and does not support the provision of a real domain name query service machine. Meanwhile, the mapping rules of the internal domain name and the real domain name are not public, and machine information cannot be inquired through the real domain name.
Based on this, the embodiment of the present disclosure may provide a unified environment interface adapter, which may convert the query parameter input by the query end into an internal unified query parameter for querying, so that the query parameter input by the query end may not be limited, thereby facilitating the query of the query end.
For example, the machine environment management system may determine an internal query path of the first machine information according to the external parameter in the first query request through the pre-stored mapping relationship information; generating a second query request according to the internal query path; and inquiring the first machine information according to the second inquiry request.
The mapping relationship information may be used to indicate a mapping relationship between one or more of the following information: a machine environment name, a company name, a Uniform Resource Locator (URL), a request mode, a query parameter, and a request header. The company name may be a company code. Table 1 shows a mapping relationship configuration table.
TABLE 1
Figure BDA0003994834380000111
Figure BDA0003994834380000121
The translation of the query request described above may be implemented by an environment interface adapter. The environment interface adapter may provide a generic query method. For example, a company name, an environment group name, an application list to be queried, and the like are used as external access queries, then environment query configuration can be obtained from a mapping relationship configuration table through the company name and the environment name inside an interface, and a URL (uniform resource locator), a request mode, a query parameter and a request header are combined with the environment group name and the application list to be queried to perform call query, so that different request modes can be adapted.
The conversion process of the query request is described below with reference to several examples.
Example one
The company code number of the external query is ANT, the environment name is ISOLATED, the environment group name is qkgz00a-sitautonew23-apfund, and the application list to be queried is [ ifas, entitityfund control ]. Inside the interface, the environment configuration with the serial number a _202208150004 is matched by the environment name ISOLATED through the company code ANT, and then the request is initiated through the URL in the environment configuration. The parameter assembly is envName = qkgz00a-sitautonew23-
apfund, appName = [ ifas, intityfundcontrol ], the request mode is GET, the request header parameter is decrypted through a database key to obtain a complete token (token), and an external request is initiated.
Example two
The company code number of the external query incoming is ANT, the environment name is DEV, the environment GROUP name is GROUP _20220511110640, and the application list to be queried is ifas. Inside the interface, the environment name DEV matches the environment configuration with a serial number a _202208150001 via the company code ANT, and then initiates the request via the URL in the configuration. The parameter assembly is
envName = GROUP _20220511110640, appName = [ ifas, entityfundcontrol ], the request mode is GET, the request header parameter is decrypted by a database key to obtain a complete token, and an external request is initiated.
Because the application list ifas to be queried is not in the DEV query link range, the method is to make compatible logic in the joint debugging environment query, namely the ifas is obtained from the STABLE environment, the inside of the interface is matched with the environment configuration with the serial number A _202208150002 through the company code number ANT and the environment name STABLE, and then the request is initiated through the URL in the configuration. The parameter assembly is envName = GROUP _20220511110640, appName = [ ifas ], the request mode is GET, the request header parameter is decrypted by a database key to obtain a complete token, and an external request is initiated.
Example three
The company code number of the external query is ANT, the environment name is TEST, the environment group name is null, and the application list to be queried is ifas, entitityfondrol. The inside of the interface is matched with the environment configuration with the serial number of A _202208150003 through the company code ANT and the environment name ISOLATED, then the request is initiated through the URL in the configuration, the parameter assembly is envName = null, appName = [ ifas, entityfundcontroll ], the request mode is GET, the request head parameter is decrypted through a database key to obtain a complete token, and the external request is initiated.
The algorithm used in the encryption and decryption process is not specifically limited in the embodiment of the present disclosure. For example, the following function may be used for the encryption and decryption operation. The functions used by the encryption algorithm may be: HEX (AES _ ENCRYPT ('data to ENCRYPT', 'key a')). The function used by the decryption algorithm may be: AES _ DECRYPT (unex ('resulting encrypted string'), 'key a').
At present, the query interfaces, query parameters and returned result formats of different environments are inconsistent. Based on this, the present disclosure may also process the queried machine information so that formats of machine information of different machine environments in the plurality of machine environments are the same. The data buffer may include a model data processor, and the model data processor may be configured to unify formats of the found machine information.
The above-described functions may be implemented by converting a standard machine data model (transferBaseMachineInfo).
The present disclosure can perform unification processing of data formats for different machine environments, respectively. For example, the embodiment of the present disclosure may set corresponding three pieces of environment configuration information for the joint debugging environment, the testing environment, and the isolation environment, respectively, to perform unified processing, where the three pieces of environment configuration information may be, for example, devEnvConfig, testEnvConfig, isolettedendeenvconfig.
The reference object of the conversion standard machine data model is the machine information returned by the environment interface adapter under different environments, and the reference object is the standard model. For example, the out-reference object may include an application name (appName), a domain name (hostname), an IP address (IP), a machine room (zone).
In some embodiments, the application name, domain name, and IP address may be consistent with the corresponding fields of the returned machine information, and the machine room may be compatible according to the corresponding fields (zonelame/zone) of the returned machine information. For example, the zoneName field may be uniformly converted to a zone field.
The above scheme for making compatibility with the field corresponding to the computer room is only an example, and certainly, other fields may also be made compatible. For example, if there are other new fields that need to be compatible, logic may also be added that is compatible for the field.
The following specifically explains the scheme of the embodiment of the present disclosure with reference to fig. 4 to 6. It is to be understood that the schemes described below are merely for convenience of understanding, and the schemes of the present disclosure are described, and the present disclosure should not be limited thereto.
Fig. 4 is an architecture diagram of an environment management system according to an embodiment of the present disclosure. The environment management system may include an environment interface adapter 410, a data cache 420, and a model data processor 430.
Different machine environments may be connected to environment interface adapter 410 through different interfaces. For example, a joint debugging environment may be connected to environment interface adapter 410 through interface 1, an isolated environment may be connected to environment interface adapter 410 through interface 2, and so on.
The environment interface adapter 410 may be used to record query parameters for different environments. The environment interface adapter 410 may be coupled to a data cache 420.
The model data processor 430 may be coupled to the data cache 420 and the machine center 440. The model data processor 430 may obtain the machine information from the machine center 440, unify the machine information, and then cache the unified machine information into the data cache 420.
The data cache 420 may determine whether the cached machine information is reliable according to preconfigured rules. If the machine information is reliable, the cache information can be continuously used, and the corresponding machine information is returned to the service side. If not, reliable machine information may be retrieved from machine center 440.
Fig. 5 is a schematic flowchart of querying machine information according to an embodiment of the present disclosure.
In step S502, the query end queries machine information of a certain environment.
In step S504, the environment management system may query the machine information from the data cache.
In step S506, it is determined whether the data buffer has the machine information to be queried. If the machine information to be queried exists in the data buffer, step S508 is executed. If the machine information to be queried does not exist in the data buffer, step S510 is executed.
In step S508, the machine information is self-checked using a self-service check technique. And if the self-checking passes, acquiring corresponding machine information from the data buffer. If the self-check fails, step S510 is performed.
In step S510, the data buffer queries the corresponding machine information from the machine center.
In step S512, the machine information obtained from the machine center is processed in a unified format to obtain standardized model data.
In step S514, a self-test is performed on the machine information obtained from the machine center by using a service self-test technique.
In step S516, if the self-check passes, it is determined whether the machine information belonging to the same environment and passing the self-check exists in the data buffer.
In step S518, if present, the machine information is retrieved from the data buffer.
In step S520, if not, the machine information acquired from the machine center is inserted into the data buffer.
Fig. 6 is a flowchart illustrating an implementation process of a data buffer according to an embodiment of the disclosure.
In step S602, the data buffer starts a timing task of timeout self-checking, that is, periodically perform timeout self-checking on the machine information in the data buffer.
In step S604, it is determined whether the device information has timed out. If time out, step S610 is executed.
In step S606, the data buffer starts a timing task of load self-test, that is, the load of the machine is periodically self-tested.
In step S608, it is determined whether the load of the machine is too high. If the load of the machine is too high, step S610 is performed.
In step S610, the machine information is newly acquired from the machine center.
In step S612, the machine information acquired from the machine center is processed in a unified format, and standardized model data is obtained.
In step S614, the machine information obtained from the machine center is self-checked using the service self-checking technique.
In step S616, if the self-check passes, it is determined whether the machine information belonging to the same environment and passing the self-check exists in the data buffer.
In step S618, if there is, the machine information is acquired from the data buffer.
In step S620, if not, the machine information acquired from the machine center is inserted into the data buffer.
Method embodiments of the present disclosure are described in detail above in conjunction with fig. 1-6, and apparatus embodiments of the present disclosure are described in detail below in conjunction with fig. 7-8. It is to be understood that the description of the method embodiments corresponds to the description of the apparatus embodiments, and therefore reference may be made to the preceding method embodiments for parts not described in detail.
Fig. 7 is a schematic block diagram of an apparatus for querying machine information according to an embodiment of the disclosure. The apparatus 700 shown in fig. 7 may include a receiving module 710 and a processing module 720.
The receiving module 710 is configured to receive a first query request sent by a query end, where the first query request is used to query first machine information, and the first machine information is machine information of a target machine environment in multiple machine environments.
A processing module 720, configured to perform the following operations: inquiring the first machine information according to the first inquiry request; checking a service state of a first machine associated with the first machine information; if the service state of the first machine is an available state, returning the first machine information to the inquiry end; and if the service state of the first machine is the unavailable state, returning second machine information to the inquiry end, wherein the second machine information is the machine information in the target machine environment, and the service state of the second machine related to the second machine information is the available state.
In some embodiments, the processing module 720 is configured to: inquiring whether the first machine information is cached in a data cache or not according to the first inquiry request; and inquiring the first machine information from the machine center if the first machine information is not cached in the data cache.
In some embodiments, the processing module 720 is further configured to: detecting the reliability of the third machine information in the data buffer; and if the third machine information is unreliable, replacing the third machine information with reliable fourth machine information.
In some embodiments, the processing module 720 is configured to: detecting a time interval between a creation time of the third machine information and a current time; and if the time interval is larger than a preset threshold value, determining that the third machine information is unreliable.
In some embodiments, the processing module 720 is configured to: detecting a load of a third machine associated with the third machine information; and if the load of the third machine is greater than a preset threshold value, determining that the third machine information is unreliable.
In some embodiments, the processing module 720 is further configured to: in response to the operation of adding the fifth machine information into the data buffer, checking whether reliable sixth machine information is cached in the data buffer, wherein the sixth machine and the fifth machine belong to the same machine environment; if the reliable sixth machine information is not cached in the data cache, adding the fifth machine information to the data cache; and if the reliable sixth machine information is cached in the data cache and the sixth machine is in an available state, using the sixth machine information in the data cache.
In some embodiments, the processing module 720 is configured to: according to the first query request, whether the first machine information is cached in a data cache is queried through a multi-environment multi-machine-room data model, and the multi-environment multi-machine-room data model classifies and/or indexes the machine information in the data cache based on one or more of the following information: company name, machine environment, application name, and machine room to which the machine belongs.
In some embodiments, the processing module 720 is configured to: determining an internal query path of the first machine information according to external parameters in the first query request and through prestored mapping relation information; generating a second query request according to the internal query path; and inquiring the first machine information according to the second inquiry request.
In some embodiments, the mapping information is used to indicate a mapping between one or more of the following: name of machine environment, company name, URL, request mode, query parameters, and request header.
In some embodiments, the processing module 720 is further configured to: and processing the inquired machine information to enable the formats of the machine information of different machine environments in the multiple machine environments to be the same.
In some embodiments, the plurality of machine environments includes one or more of the following: joint debugging environment, test environment and isolation environment.
Fig. 8 is a schematic structural diagram of an apparatus for querying machine information according to yet another embodiment of the present disclosure. The apparatus 800 may be a computing-enabled apparatus. The apparatus may be an electronic device installed with an operating system. The apparatus 800 may include a memory 810 and a processor 820. Memory 810 may be used to store executable code. The processor 820 may be configured to execute the executable code stored in the memory 810 to implement the steps of the various methods described above. In some embodiments, the apparatus 800 may further include a network interface 830, and the data exchange between the processor 820 and the external device may be implemented through the network interface 830.
It should be understood that, in the embodiments of the present disclosure, the processor may be a Central Processing Unit (CPU), and the processor may also be other general-purpose processors, digital Signal Processors (DSPs), application Specific Integrated Circuits (ASICs), field Programmable Gate Arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
It should be understood that in the embodiments of the present disclosure, "B corresponding to a" means that B is associated with a, from which B can be determined. It should also be understood that determining B from a does not mean determining B from a alone, but may be determined from a and/or other information.
It should be understood that the term "and/or" herein is only one kind of association relationship describing the association object, and means that there may be three kinds of relationships, for example, a and/or B, and may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
It should be understood that, in various embodiments of the present disclosure, the sequence numbers of the above-mentioned processes do not mean the execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present disclosure.
In the several embodiments provided in the present disclosure, it should be understood that the disclosed system, apparatus, and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one type of logical functional division, and other divisions may be realized in practice, for example, multiple 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.
The 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 disclosure may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
In the above embodiments, all or part of the implementation may be realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. The procedures or functions described in accordance with the embodiments of the disclosure are all or partially produced when the computer program instructions are loaded and executed on a computer. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored on a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website, computer, server, or data center to another website, computer, server, or data center via wire (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be read by a computer or a data storage device including one or more available media integrated servers, data centers, and the like. The usable medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a Digital Versatile Disk (DVD)), or a semiconductor medium (e.g., a Solid State Disk (SSD)), among others.
The above description is only for the specific embodiments of the present disclosure, but the scope of the present disclosure is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present disclosure, and all the changes or substitutions should be covered within the scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.

Claims (23)

1. A method of querying machine information, comprising:
receiving a first query request sent by a query end, wherein the first query request is used for querying first machine information, and the first machine information is machine information of a target machine environment in multiple machine environments;
inquiring the first machine information according to the first inquiry request;
checking a service state of a first machine associated with the first machine information;
if the service state of the first machine is an available state, returning the information of the first machine to the inquiry end;
and if the service state of the first machine is the unavailable state, returning second machine information to the inquiry end, wherein the second machine information is the machine information in the target machine environment, and the service state of the second machine related to the second machine information is the available state.
2. The method of claim 1, the querying the first machine information according to the first query request, comprising:
inquiring whether the first machine information is cached in a data cache or not according to the first inquiry request;
and inquiring the first machine information from the machine center if the first machine information is not cached in the data cache.
3. The method of claim 2, further comprising:
detecting the reliability of the third machine information in the data buffer;
and if the third machine information is unreliable, replacing the third machine information with reliable fourth machine information.
4. The method of claim 3, the detecting the reliability of the third machine information in the data buffer, comprising:
detecting a time interval between a creation time of the third machine information and a current time;
and if the time interval is larger than a preset threshold value, determining that the third machine information is unreliable.
5. The method of claim 3 or 4, the detecting the reliability of the third machine information in the data buffer, comprising:
detecting a load of a third machine associated with the third machine information;
and if the load of the third machine is greater than a preset threshold value, determining that the third machine information is unreliable.
6. The method of claim 2, further comprising:
in response to the operation of adding the fifth machine information into the data buffer, checking whether reliable sixth machine information is cached in the data buffer, wherein the sixth machine and the fifth machine belong to the same machine environment;
if the reliable sixth machine information is not cached in the data cache, adding the fifth machine information to the data cache;
and if the reliable sixth machine information is cached in the data cache and the sixth machine is in an available state, using the sixth machine information in the data cache.
7. The method of claim 2, wherein the querying whether the first machine information is cached in a data cache according to the first query request comprises:
according to the first query request, whether the first machine information is cached in a data cache is queried through a multi-environment multi-machine-room data model, and the multi-environment multi-machine-room data model classifies and/or indexes the machine information in the data cache based on one or more of the following information: company name, machine environment, application name, and machine room to which the machine belongs.
8. The method of claim 1, the querying the first machine information according to the first query request, comprising:
determining an internal query path of the first machine information according to external parameters in the first query request and through prestored mapping relation information;
generating a second query request according to the internal query path;
and inquiring the first machine information according to the second inquiry request.
9. The method of claim 8, the mapping information indicating a mapping between one or more of the following: name of machine environment, company name, URL, request mode, query parameter and request head.
10. The method of claim 1, further comprising:
and processing the inquired machine information to enable the formats of the machine information of different machine environments in the multiple machine environments to be the same.
11. The method of claim 1, the plurality of machine environments comprising one or more of: joint debugging environment, test environment and isolation environment.
12. An apparatus for querying machine information, comprising:
the system comprises a receiving module, a query module and a query module, wherein the receiving module is used for receiving a first query request sent by a query end, the first query request is used for querying first machine information, and the first machine information is machine information of a target machine environment in multiple machine environments;
a processing module to perform the following operations:
inquiring the first machine information according to the first inquiry request;
checking a service state of a first machine associated with the first machine information;
if the service state of the first machine is an available state, returning the information of the first machine to the inquiry end;
and if the service state of the first machine is the unavailable state, returning second machine information to the inquiry end, wherein the second machine information is the machine information in the target machine environment, and the service state of the second machine related to the second machine information is the available state.
13. The apparatus of claim 12, the processing module to:
inquiring whether the first machine information is cached in a data cache or not according to the first inquiry request;
and if the first machine information is not cached in the data cache, inquiring the first machine information from the machine center.
14. The apparatus of claim 13, the processing module further to:
detecting the reliability of the third machine information in the data buffer;
and if the third machine information is unreliable, replacing the third machine information with reliable fourth machine information.
15. The apparatus of claim 14, the processing module to:
detecting a time interval between a creation time of the third machine information and a current time;
and if the time interval is larger than a preset threshold value, determining that the third machine information is unreliable.
16. The apparatus of claim 14 or 15, the processing module to:
detecting a load of a third machine associated with the third machine information;
and if the load of the third machine is greater than a preset threshold value, determining that the third machine information is unreliable.
17. The apparatus of claim 13, the processing module further to:
in response to the operation of adding the fifth machine information into the data buffer, checking whether reliable sixth machine information is cached in the data buffer, wherein the sixth machine and the fifth machine belong to the same machine environment;
if the reliable sixth machine information is not cached in the data cache, adding the fifth machine information to the data cache;
and if the reliable sixth machine information is cached in the data cache and the sixth machine is in an available state, using the sixth machine information in the data cache.
18. The apparatus of claim 13, the processing module to:
according to the first query request, whether the first machine information is cached in a data cache is queried through a multi-environment multi-machine-room data model, and the multi-environment multi-machine-room data model classifies and/or indexes the machine information in the data cache based on one or more of the following information: company name, machine environment, application name, and machine room to which the machine belongs.
19. The apparatus of claim 12, the processing module to:
determining an internal query path of the first machine information according to external parameters in the first query request and through prestored mapping relation information;
generating a second query request according to the internal query path;
and inquiring the first machine information according to the second inquiry request.
20. The apparatus of claim 19, the mapping information indicating a mapping between one or more of: name of machine environment, company name, URL, request mode, query parameters, and request header.
21. The apparatus of claim 12, the processing module further to:
and processing the inquired machine information to enable the formats of the machine information of different machine environments in the multiple machine environments to be the same.
22. The apparatus of claim 12, the plurality of machine environments comprising one or more of: joint debugging environment, test environment and isolation environment.
23. An apparatus for querying machine information, comprising a memory having executable code stored therein and a processor configured to execute the executable code to implement the method of any of claims 1-11.
CN202211599893.7A 2022-12-12 2022-12-12 Method and device for inquiring machine information Pending CN115795121A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211599893.7A CN115795121A (en) 2022-12-12 2022-12-12 Method and device for inquiring machine information

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211599893.7A CN115795121A (en) 2022-12-12 2022-12-12 Method and device for inquiring machine information

Publications (1)

Publication Number Publication Date
CN115795121A true CN115795121A (en) 2023-03-14

Family

ID=85419787

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211599893.7A Pending CN115795121A (en) 2022-12-12 2022-12-12 Method and device for inquiring machine information

Country Status (1)

Country Link
CN (1) CN115795121A (en)

Similar Documents

Publication Publication Date Title
US9760468B2 (en) Methods and arrangements to collect data
US6651183B1 (en) Technique for referencing failure information representative of multiple related failures in a distributed computing environment
US9009324B2 (en) Managing and reconciling information technology assets in a configuration database
US8892582B2 (en) Method and system for identifying objects of service
US7817583B2 (en) Method for verifying a storage area network configuration
CN111522922A (en) Log information query method and device, storage medium and computer equipment
CN110287696B (en) Detection method, device and equipment for rebound shell process
CN110162512B (en) Log retrieval method, device and storage medium
US10516734B2 (en) Computer servers for datacenter management
US11362912B2 (en) Support ticket platform for improving network infrastructures
CN109726091B (en) Log management method and related device
CN113704790A (en) Abnormal log information summarizing method and computer equipment
CN114356921A (en) Data processing method, device, server and storage medium
US8327324B1 (en) Message logging system
CN111506358B (en) Method and device for updating container configuration
US8086627B2 (en) Software inventorying system for a shared file system
CN115795121A (en) Method and device for inquiring machine information
CN111124542A (en) Configuration information management system
US7734640B2 (en) Resource discovery and enumeration in meta-data driven instrumentation
CN115840788A (en) Method, device, terminal and storage medium for synchronizing MySql data to ES
CN115757505A (en) Information query method and cabinet management node
CN114185804A (en) Interface testing method and device and terminal equipment
CN113553243A (en) Remote error detection method
CN111538651A (en) Interface testing method, device, server and storage medium
CN105071946A (en) System monitoring method and device

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
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20240219

Address after: Guohao Times City # 20-01, 128 Meizhi Road, Singapore

Applicant after: Advanced Nova Technology (Singapore) Holdings Ltd.

Country or region after: Singapore

Address before: 51 Belarusian Bashar Road, Singapore, Lai Zanda 1 # 04-08

Applicant before: Alipay laboratories (Singapore) Ltd.

Country or region before: Singapore