CN111143319A - Method and device for detecting instance topology - Google Patents
Method and device for detecting instance topology Download PDFInfo
- Publication number
- CN111143319A CN111143319A CN201811312995.XA CN201811312995A CN111143319A CN 111143319 A CN111143319 A CN 111143319A CN 201811312995 A CN201811312995 A CN 201811312995A CN 111143319 A CN111143319 A CN 111143319A
- Authority
- CN
- China
- Prior art keywords
- instance
- instances
- searching
- relationship
- topology
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 35
- 238000001514 detection method Methods 0.000 claims abstract description 28
- 238000012423 maintenance Methods 0.000 abstract description 25
- 230000008569 process Effects 0.000 description 12
- 238000010586 diagram Methods 0.000 description 10
- 238000004590 computer program Methods 0.000 description 7
- 238000004891 communication Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 230000008859 change Effects 0.000 description 3
- 239000000523 sample Substances 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000007613 environmental effect Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
Images
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The application discloses a method and a device for detecting instance topology, wherein the method comprises the following steps: generating a base table of a plurality of instances; acquiring a plurality of instances to be detected in the basic table; traversing and searching the instance relation of each instance in the multiple instances to be detected; generating a new instance relation table corresponding to the instance relation one by one; the new instance relationship table and the old instance relationship table associated therewith are merged. The example topology detection method provided by the embodiment of the application realizes active detection and update of the example topology relation, avoids manual repeatability of database operation and maintenance operation, and improves the efficiency of operation and maintenance management.
Description
Technical Field
The application relates to the technical field of database operation and maintenance management, in particular to a method and a device for detecting instance topology.
Background
With the continuous update of internet products, the data types stored in the database are developed from simple stored information to multi-dimensional data such as transaction, point, log, user dynamics and the like, and the data volume is increased accordingly. Therefore, the server is configured for the database separately, and meanwhile, the architecture of the database is also increased from a single instance to multiple instances.
Currently, a one-master-multi-slave architecture is adopted in a wide range of relational databases, and the databases in such relational databases are generally distributed in different computer rooms, and one or more databases are operated by multiple instances. But due to network failure and the like, the master-slave relationship of the instance of the database is changed, and only the initial master-slave relationship is maintained in the initially constructed instance topology table.
For maintenance personnel, when detecting instance relationships in the database maintenance process, the maintenance personnel are required to manually input operation instructions to detect the topological relationships of the instances and perform maintenance management on the database instances. Obviously, the management mode based on manual searching and maintenance increases the workload of maintenance personnel, and the working efficiency is very low.
Disclosure of Invention
In view of the above-mentioned drawbacks and deficiencies of the prior art, it is desirable to provide a method and apparatus for detecting an instance topology to automatically detect the instance topology.
In a first aspect, the present application provides a method for detecting an instance topology, including:
generating a base table of a plurality of instances;
acquiring a plurality of instances to be detected in the basic table;
traversing and searching the instance relation of each instance in the multiple instances to be detected;
generating a new instance relation table corresponding to the instance relation one by one;
the new instance relationship table and the old instance relationship table associated therewith are merged.
In a second aspect, the present application provides an example topology detection apparatus, including:
the first generation module is used for generating a base table of a plurality of instances;
the acquisition module is used for acquiring a plurality of instances to be detected in the basic table;
the searching module is used for searching the example relationship of each example in the plurality of examples to be detected in a traversing way;
the second generation module is used for generating a new instance relation table corresponding to the instance relation one by one;
and the merging module is used for merging and processing the new instance relation table and the old instance relation table associated with the new instance relation table.
In summary, according to the method and the device for detecting the instance topology provided by the embodiment of the present application, after a plurality of to-be-detected instances of which the topology structures need to be detected are obtained from the obtained base tables of a plurality of instances, instance information of each instance is automatically searched, a new instance relationship table of each instance is generated, and finally, the new instance relationship table and the associated old instance relationship table of each instance are combined, so that active detection and update of the instance topology relationship are realized, manual repeatability of database operation and maintenance operations is avoided, and the efficiency of operation and maintenance management is improved.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 is a schematic illustration of a flow of an example topology detection method of an embodiment of the present application;
FIG. 2 is a schematic flow diagram of a method for probing an example topology according to yet another embodiment of the present application;
FIG. 3 is a block diagram of an application scenario according to an embodiment of the present application;
FIG. 4 is a flow diagram of an example topology detection of an embodiment of the present application;
FIG. 5 is a schematic structural diagram of a probing apparatus of an example topology of an embodiment of the present application;
fig. 6 is a schematic structural diagram of a computer system of a server according to an embodiment of the present application.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant application and are not limiting of the application. It should be noted that, for the convenience of description, only the portions relevant to the application are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
It will be appreciated that the method may be applied in an HA cluster system comprising a plurality of physical hosts, each having more than one virtual host running thereon. Various virtualization platforms, virtualization middleware and HA cluster software can be operated on each physical host. Different services, such as database service, network service, file transmission service, mail service, and the like, can be run on each virtual host. On one server, a plurality of different ports can be opened, and a plurality of service processes are run, namely a plurality of instances operate one or more databases.
Under the scene, when the database architecture is built in the initial stage, a basic table is built accordingly. The basic table records the instance information of all instances under the architecture. And, an instance relationship table for all current instances may be generated accordingly. The base table and the instance relationship table are stored in a database in a server for maintenance, or other databases. It is necessary for maintenance personnel to periodically check the master-slave copy relationships of all instances in the base table to ensure that the database is functioning properly. For example, the search command may be executed periodically at the server by a preset frequency. Or, in another case, when a server arranged in a certain machine room or an instance on the server fails, such as an accident in a region where a different machine room is located, the relationship of the instance changes. At this time, maintenance personnel are also required to check the failed examples and the relationship thereof according to the basic table. That is, the maintenance personnel can detect the corresponding failed part of the instances in the instance relation table, for example, the instances in the same machine room can be checked.
For convenience of understanding and explanation, the detection method, apparatus, server and storage medium of the example topology provided by the embodiments of the present application are described in detail below with reference to fig. 1 to 6.
Referring to fig. 1, fig. 1 is a flowchart illustrating a method for detecting topology according to an embodiment of the present disclosure.
As shown in fig. 1, the method may include:
s1, generating a base table of a plurality of instances.
S2, acquiring a plurality of examples to be detected in the basic table;
s3, traversing and searching the instance relationship of each instance in the multiple instances to be detected.
S4, a new instance relation table corresponding to the instance relation one by one is generated.
S5, merging and processing the new instance relation table and the old instance relation table associated with the new instance relation table.
Specifically, according to the method for detecting the instance topology provided by the embodiment of the application, firstly, a basic table can be imported by a maintainer according to instance information during initial construction. Or the data can be automatically collected in real time to generate a basic table comprising all the examples and the example information. A number of instances to be probed may then be retrieved from the base table. For example, a plurality of eligible instances may be obtained from the environmental information. The environment information may be, for example, identification information of the cluster or representation information of the computer room. According to the environment information obtaining example, for example, multiple examples of complete example information in the same machine room can be obtained. And further, the example relationship of each example to be detected can be actively searched through traversal, a new example relationship table of each example is generated according to the searched example relationship, and the old example relationship table of each example and the new example relationship table of the example are combined, so that the automatic detection of the example topology is completed. The merging process may be, for example, updating the connection relationship that has changed in the instance relationship table by means of comparison search or path search.
According to the method for detecting the instance topology, in the operation and maintenance management process of the database, the relation of the instance topology change caused by cluster change and HA change can be actively detected, relevant instance operation is carried out based on the changed relation, and the working efficiency of the operation and maintenance management of the database is effectively improved.
It can be understood that after the new instance relationship table is generated, when the database is maintained in the later period, the server can actively complete the detection of the instance having the master-slave relationship with the failed instance and update the detected instance relationship according to the new instance relationship table through a simple instruction.
An example topology detection method of another embodiment of the present application is explained below with reference to fig. 2. Fig. 2 illustrates an example topology detection method according to another embodiment provided in the present application. As shown in fig. 2, the method may include:
and S01, collecting instance information of a plurality of instances.
S02, generating a basic table based on the instance information.
Specifically, in an embodiment, a maintenance person may input all instances into a maintenance server according to a basic table of all instances created when the database is initially built, so as to complete collection of information of all instances by the maintenance server, and generate the basic table.
Preferably, a search command may be further set, that is, the acquisition instruction is loaded in the maintenance server, so that the maintenance server may automatically complete acquisition of information of all instances and automatically generate the base table when executing the acquisition command. For example, a base table of all instance information as shown in FIG. 1 may be automatically generated.
It is understood that the base table is automatically generated at the server, and may be stored in a database, which may be a relational database or a non-relational database.
And S03, acquiring a plurality of instances to be detected in the basic table.
Specifically, a plurality of instances to be detected can be determined according to the stored current instance relationship table in combination with the base table. For example, when an instance in a room fails, all instances in the same cluster as the instance need to be probed. In practice, it may be all instances in the same machine room. The instances under the cluster for which the instance information is complete can be viewed from the base table. For example, an instance including an instance name, an IP of a physical host where the instance is located, a vip, and a port may be obtained in the base table.
It is to be appreciated that after the instance information is obtained, the instance information can be stored in the name of the cluster. It can be understood that when the vip and the port information in a certain instance information coincide, for example, the vip and the port of the instance of slave3 are repeated with the vip and the port of other instances in the base table, it is described that the vip and the port of other instances may have changed based on the information obtained this time.
S04, searching the upper layer example of each example to be detected to obtain the searching result of the upper layer example, and acquiring the example information of the upper layer example in the basic table based on the searching result. And searching the lower-layer example of the upper-layer example to obtain the searching result of the lower-layer example, and acquiring the example information of the lower-layer example in the basic table based on the searching result.
Specifically, when detecting an upper-layer instance of the to-be-detected instance, connectivity of the to-be-detected instance may be first determined.
For example, it may be detected whether a physical host where the to-be-detected instance is located may log in, and the physical host may not be connected due to a network failure or downtime. It can then be checked whether the instance is alive and finally whether the instance can be connected. Such as whether the database is connectable through a heartbeat mechanism.
When the to-be-detected instance is connected, the cluster type to which the to-be-detected instance belongs can be judged. The cluster type may be: MGR clusters, M-S clusters, Mysql clusters based on SAN storage, etc.
For example, when the cluster type is M-S, a show slave status command may be executed to obtain the master instance of the to-be-probed instance, and obtain the lookup result of the vip and the port of the master instance. When the cluster class is MGR, a statement querying the cluster relationships may be executed to get the vip and port of the master's instance.
It can be understood that, when the cluster class is MGR, a pre-relationship judgment is needed to be added when the query of the cluster relationship is performed, that is, whether a special process is running is judged.
After the vip and the port of the main instance are searched, other instance information of the main instance can be searched in the basic table according to the searched vip and port.
Optionally, when the vip and the port of the main instance found by the lookup are not in the base table, that is, the lookup result of the search object is not in the base table, it indicates that the instance is a new finding of this lookup, and the vip and the port of the instance may be supplemented into the base table.
Further, when the vip and the port of the main instance are obtained through the show slave status command, the delay time between the to-be-detected instance and the main instance, that is, the delay time between the selected instance and the first instance, may also be obtained. Therefore, the problems that the master-slave instance is matched and the delay time cannot be determined are solved, and the determination of the data copying delay time of the master-slave instance is realized quickly.
It can be understood that after the main instance is found, the upper-layer instance of the instance to be detected can be further searched upwards by the above method.
After the upper-layer instance is searched, the lower-layer instance of the upper-layer instance can be automatically searched downwards. Likewise, different commands may be executed depending on the cluster type of the instance when looking up the underlying instance. For example, when the cluster type of the upper-layer instance is M-S, it may be determined whether all slave instance information below the upper-layer instance is complete according to the show slow hosts statement, and if so, the vip and the port of the slave instance may be directly obtained, and other instance information of the slave instance may be obtained from the base table.
If not, further searching is carried out by adopting the show processslist. It should be understood that the physical IP of the slave instance queried by the command showprocessslist is the instance physical IP, i.e., the physical IP has many slave instances hanging below it. Therefore, other instance information of the slave instance needs to be further confirmed from the base table.
After the slave instance is found, whether the master-slave relationship of the slave instance and the upper layer instance is matched needs to be detected. And executing a search command according to different cluster types of the slave instances, and searching the master instance directly connected to the upper layer of the slave instance upwards. Whether the master instance directly connected from the upper layer of the instance is matched with the master and slave of the upper layer of the instance can be judged according to the search result, namely whether the vip and the port of the master instance directly connected from the upper layer of the instance are the same as the vip and the port of the upper layer of the instance. If the two are the same, the master-slave copy relationship is met, otherwise, the master-slave copy relationship between the slave instance and the upper-layer instance is abnormal, and the new instance relationship table can be marked with ON _ OK.
In the process of server operation, due to network failure and other reasons, master-slave switching of the server may occur, so that the master-slave relationship of the instance changes. Through the matching of the master-slave relationship of the example, whether the current example master-slave relationship changes relative to the example master-slave relationship before the master-slave switching of the server can be determined.
And S05, generating a new instance relation table corresponding to the instance relations one by one.
Specifically, a new instance relationship table of the to-be-detected instance may be generated according to all the found instances related to the to-be-detected instance.
It will be appreciated that after the new instance relationship table is generated, it may be stored in a database.
And S06, merging and processing the new instance relation table and the old instance relation table associated with the new instance relation table.
Specifically, when merging the new and old instance relationship tables of the instances, the old instance relationship table may be read first, then the new and revised instance relationship tables are compared, the instance relationship in the old instance relationship table is added to the new instance relationship table, and the new instance relationship table is marked as disconnected, that is, the instance relationship is currently in a disconnected state. It will be appreciated that the instance relationship in the new instance relationship table is indicative of a newly generated instance relationship.
And S07, generating the HA cluster name and the application cluster name.
Specifically, after all the above example relationship tables are merged, the example in the same environment may be named as an HA cluster. And naming the instance in the whole instance relation table as the application cluster name.
It can be understood that after the HA cluster and the application cluster name are generated, the HA cluster and the application cluster name can be conveniently checked by a maintenance person, and the HA cluster and the application cluster name can detect instances under the same cluster name.
Further, to describe the example relationship detection process in the embodiment of the present application in detail, a specific process of upward and downward detection of the example topology provided in the embodiment of the present application is illustrated with reference to fig. 3 and fig. 4.
Fig. 3 shows an application scenario of the present application. For example, multiple instances may be preliminarily configured in two different rooms in the scenario, such as the room 1 in which the master1 is configured, the slave1 and the slave20 are configured, and the room 2 in which the slave2 is configured. Further, the lower layer of the instance of the slave1 initially sets the instance of the slave3 and the instance of the slave4, and the lower layer of the instance of the slave2 initially sets the instance of the slave 5. The lower layer of instances of slave3 sets instances of slave 7. The lower layer of instances of slave20 initially sets an instance of slave10 and an instance of slave 11. It can be understood that the above scenario is only an exemplary illustration, and the machine room division and layout of the specific example may be determined according to the actual situation, which is not limited in the present application.
Referring to fig. 4, fig. 4 is a schematic flow chart illustrating an example topology detection of the present application, including:
and S10, acquiring the examples of the slave3 and the examples of the slave20 of the to-be-detected examples meeting the conditions in the basic table.
After obtaining the multiple instances, the traversal can be completed by sequentially searching the topology of the instance of the slave3 and the topology of the instance of the slave20 upwards and downwards through executing the command.
Specifically, the connectivity of an instance of slave3 is first checked.
It can be understood that when the instance of the slave3 is found not to be connected, S40 may be performed to determine that the next instance is the selected instance, that is, to perform the probing of the topological relation of the instance of the next instance slave20, that is, to detect the connectivity of the instance of slave 20.
When detecting that the instances of the slave3 are connectable, the main instance of the slave3 may be searched upward, that is, the directly connected instance on the upper layer of the instance of the slave3 is determined to be a search object, the cluster type to which the instance of the slave3 belongs may be determined, and then S23 is executed.
S23, searching the instance of the slave1 directly connected to the upper layer of the instance of the slave3 according to the cluster type to which the instance of the slave3 belongs.
And S24, judging whether the search result is null or not.
It is understood that after the lookup command is executed, if part of the instance information of the instance of the slave1, i.e. the vip and the port, is found, it indicates that the main instance of the slave3 exists, i.e. the instance of the slave 1. At this point, other instance information for the instance of slave1 may be obtained from the base table. And, the master' S instance of slave1 may continue to be looked up, i.e., S25 is performed. If the upper-level instance of the instance of slave3 is not found, indicating that the instance of slave3 is the top instance, S26 is performed.
S25, searching the instance of the master directly connected to the upper layer of the instance of the slave1 according to the cluster type to which the instance of the slave1 belongs.
In particular, the connectivity of an instance of slave1 may be detected. If an instance of slave1 is not connected, S26 may be performed. Otherwise, the cluster type to which the instance of slave1 belongs is determined. And then searching the upper-layer directly-connected instance of the slave1 according to the cluster type to which the instance of the slave1 belongs. That is, the corresponding lookup command may be executed according to the different cluster types to which the instance of the slave1 belongs, and the upper-layer directly-connected instance of the slave1 is searched upward.
It is understood that, at this time, it may be further determined whether the search result is empty, that is, S250, if the search result is empty, it indicates that the instance of the slave1 is the top instance, and then the lower instance of the slave1 is searched downward, and S253 is performed. If the search result is returned, it indicates that the upper-level instance of the instance of slave1, such as the instance of master shown in fig. 1, is found. At this point, other information for the instance of the master may be looked up from the base table based on the vip and port returned.
Continuing, the connectivity of the instance of the master may be determined, i.e., executing S241, and if the instance of the master is connectable, as shown in fig. 1, the instance is the topmost instance, then the slave instance of the master, i.e., the instance of slave2, may be searched downward, and executing S242. And further judging the connectivity of the instance of the slave2, when the instance of the slave2 is connectable, the upper-layer directly-connected instance of the slave2 is searched upwards to judge whether the master-slave relationship between the upper-layer directly-connected instance of the slave2 and the instance of the master is matched. As shown in fig. 1, if there is a match, the slave instances of slave2, i.e., the instance of slave4 and the instance of slave5, may be searched continuously and step S244 is executed. At this time, if the instance of slave4 and the instance of slave5 are the endmost instances, then the lower-layer instance query of the instance of slave1 may be returned, and S253 is executed.
If the instance of master or instance of slave2 does not connect, then the lower level instance of the instance of slave1 may be looked down, performing S253. As shown in fig. 1, there may be an example of slave3 and an example of slave 4.
S253, searching the instance of the slave3 and the instance of the slave4 at the lower layer of the instance of the slave1 according to the cluster type to which the instance of the slave1 belongs.
Specifically, as shown in fig. 1, the lower-layer instances of the slave1, such as the instance of slave3 and the instance of slave4, may be searched downward according to the cluster type.
It can be understood that when different lookup commands are executed to lookup the instance of the slave3 and the instance of the slave4, there may still be different lookup results, i.e. if no instance of the slave3 and no instance of the slave4 are found, the instance of the slave1 is the endmost instance. At this time, all the selected instance relationships are searched, an instance relationship table of the instance may be generated according to the result of the search, and then the next instance relationship is searched, for example, the instance relationship of the slave20 is searched.
If the instances of the slave3 and the slave4 are found, the connectivity of the instances of the slave4 is judged. It will be appreciated that a lookup of the instance relationship of slave4 may be performed first. And judging the connectivity of the instance of the slave4, if the instance of the slave3 is not connectable, searching the lower-layer instance relationship of the instance of the slave 3526, and executing S26. If yes, judging the cluster type of the instance of the slave4, and searching the upper layer directly-connected instance of the slave4 upwards according to the cluster type of the instance of the slave 4.
It can be understood that, if the slave1 has only one slave instance, and the slave instance is found to be unconnected through the judgment, the lookup of the present instance relationship is ended, and the lookup of the next instance is entered, for example, the lookup of the instance relationship of the slave 20.
When looking up the instance relationship of the slave4, it is first necessary to check whether the master-slave relationship of the instance of the slave4 and the instance of the slave1 match. As shown in fig. 1, the lookup command may be executed to lookup the upper-layer directly-connected instance of the slave4 upward according to the different cluster types of the instances of the slave 4. Whether the master and slave of the instance of the slave4 are matched with the instance of the slave1 can be judged according to the search result, that is, whether the vip and the port of the upper layer direct-connected instance of the slave4 are the same as the vip and the port of the instance of the slave 1.
It is determined whether the master and slave of the instance of slave4 and the instance of slave1 match.
Further, if there is no match, the upper-layer instance that matches the slave-slave match with the instance of slave4, i.e. the instance of slave2, is also detected, e.g. the connectivity of the instance of slave2 is determined, i.e. S243. When the slave copy relationship is connectable, further searching for the master instance of the slave2, such as the master instance, until the top instance is found, then searching downwards, and ending the search for the instance relationship of the slave4 until the end instance, that is, the instance of the slave5, then performing matching of the master-slave copy relationship of the other slave instances of the slave1, such as judging the matching of the master-slave copy relationship of the instance of the slave3, and executing S26.
It can be understood that, when the instance of the slave2 is not connectable, the master-slave copy relationship of the other slave instances of the slave1 is directly matched, for example, the master-slave relationship of the instance of the slave3 is judged to be matched, and S26 is executed.
It will be appreciated that if the vip and port of slave1 are returned by the lookup statement, it is said that the instance of slave4 matches the instance of slave 1. At this point, the lower level instance of slave4 may continue to be looked down. Further determining whether the result is empty, as shown in fig. 1, if the lower layer of the slave4 has no instance, that is, the returned result is empty, then a lookup of the lower layer instance of the slave3 may be performed, that is, S26 is performed.
It can be understood that since the upper directly connected instance of the slave3 is found to be the slave1 in the above step, the slave instance of the lower instance of the slave3 may be directly found downwards, and the step S26 is executed.
S26, look down the instance of the lower instance slave7 of the instance of slave 3.
Specifically, whether the search result is empty is judged. A determination is made as to whether the instance of slave7 matches the master-slave of the instance of slave 3. As shown in fig. 1, an instance such as slave7 can be found, and it can be understood that if the lower layer instance of the instance of slave3 is not found, the slave3 is illustrated as the endmost instance. The relationship lookup for the instance ends and S30 can be performed.
After the lower layer instance is found, the master-slave relationship between the instance of the slave7 and the instance of the slave3 can be judged, that is, the connectivity of the instance of the slave7 is detected, and when the connectivity is available, the upper layer directly-connected instance of the slave7 can be found upwards. And judging whether the upper-layer directly-connected instance is the instance of the slave3, if so, indicating that the master-slave relationship of the instance of the slave7 and the instance of the slave3 is matched, and continuing to probe the lower-layer instance of the slave7 downwards. If not, the upper-level directly-connected instance of the instance of slave7 may be probed up. As shown in fig. 1, it may be determined that the actual main instance of the slave7 is the instance of the slave11, and then the search may be continued with the instance of slave11 as a search object until all the found instances are disconnected or are the end instances, i.e., S27, the instances of slave11 at the upper layer of the slave7 are found up or down, and the instances of slave20 and the instances of slave10 are found up or down. The search of the instance relationship of the selected instance slave3 may be ended, and S30 is performed.
S30, generating a new instance relation table of the instance of the slave 3.
Specifically, a new instance relationship table of the instance of the slave3 may be generated according to all the found instances related to the instance of the slave 3. At this time, a query of the next instance relationship, such as the instance relationship of slave20, may be performed, i.e., S40 is executed.
It can be understood that, when the instance relationship of the slave7 is searched, the instance relationship of the slave20 is already searched in the above search process, so that the search of the instance relationship of the slave20 is skipped, the search of the next instance relationship is performed, and if all the instances are searched, S50 may be executed.
S50, merging the new instance relation table and the old instance relation table associated with the new instance relation table.
And S60, generating the HA cluster name and the application cluster name.
The example topology detection apparatus provided by the embodiment of the present application is illustrated in fig. 5, and as shown in fig. 5, the apparatus 500 may include:
a first generating module 510 for generating a base table of a plurality of instances;
an obtaining module 520, configured to obtain multiple to-be-detected instances in the base table;
a searching module 530, configured to search through an instance relationship of each instance in the multiple instances to be detected;
a second generating module 540, configured to generate a new instance relationship table corresponding to the instance relationship one to one;
and a merging module 550, configured to merge and process the new instance relationship table and the old instance relationship table associated therewith.
Preferably, in the example topology detection apparatus provided in this embodiment of the present application, the search module 530 includes:
a first searching unit 531, configured to search an upper-layer instance of each to-be-detected instance, obtain a search result of the upper-layer instance, and obtain instance information of the upper-layer instance in the base table based on the search result;
the second searching unit 532 is configured to search for the lower-layer instance of the upper-layer instance, obtain a search result of the lower-layer instance, and obtain instance information of the lower-layer instance in the base table based on the search result.
Preferably, in the apparatus for detecting an instance topology provided in the embodiment of the present application, the base table and/or the instance relationship table are stored in a database.
Preferably, in the example topology detection apparatus provided in this embodiment of the present application, the first generating module 510 includes:
an acquisition unit 511, configured to acquire instance information of a plurality of instances;
a generating unit 521, configured to generate the base table based on the instance information.
Preferably, the example topology detection apparatus provided in the embodiment of the present application, further includes:
and an adding module 560, configured to add the instance information of the instance to the base table when the found instance is not in the base table.
It is to be appreciated that embodiments of the application also provide a server including a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor being operable to execute the example topology detection method described above when executing the program.
Referring now to FIG. 6, shown is a block diagram of a computer system 600 suitable for use in implementing a server according to embodiments of the present application.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU)601 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data necessary for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 606 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage section 608 as necessary.
In particular, the processes described above with reference to fig. 1-3 may be implemented as computer software programs in accordance with the detection of the example topology disclosed herein. For example, a probing embodiment of an example topology of the present disclosure includes a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program comprising program code for performing the method of fig. 1-3. In such example topology detection embodiments, the computer program may be downloaded and installed from a network through the communication section 609 and/or installed from the removable medium 611.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to probe embodiments of various example topologies of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units or modules described in the embodiments of the present application may be implemented by software or hardware. The described units or modules may also be provided in a processor, and may be described as: a processor comprises a first generation module, an acquisition module, a search module, a second generation module and a merging module. The names of these units or modules do not in some cases form a limitation to the units or modules themselves, and for example, the obtaining module may also be described as "obtaining module for obtaining a plurality of instances to be detected in the base table".
As another aspect, the present application further provides a computer-readable storage medium, which may be the computer-readable storage medium included in the foregoing apparatus in the detection embodiment of the example topology; or it may be a separate computer readable storage medium not incorporated into the device. The computer readable storage medium stores one or more programs for use by one or more processors in performing the probing applied to the instance topology described herein.
To sum up, according to the method and the device for detecting an instance topology provided in the embodiments of the present application, after obtaining a plurality of instances to be detected whose topology structures need to be detected from the obtained base tables of the plurality of instances, the instance information of each instance is automatically searched, a new instance relationship table of each instance is generated, and finally the new instance relationship table and the associated old instance relationship table of each instance are combined, so that active detection and update of the instance topology relationship are realized, manual repeatability of database operation and maintenance operations is avoided, the efficiency of operation and maintenance management is improved, and instance operations, cluster changes and HA changes are realized.
The above description is only a preferred embodiment of the application and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the application referred to in the present application is not limited to the embodiments with a particular combination of the above-mentioned features, but also encompasses other embodiments with any combination of the above-mentioned features or their equivalents without departing from the scope of the application. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.
Claims (10)
1. A method for probing an instance topology, the method comprising:
generating a base table of a plurality of instances;
acquiring a plurality of instances to be detected in the basic table;
traversing and searching the instance relation of each instance in the multiple instances to be detected;
generating a new instance relation table corresponding to the instance relations one by one;
and merging and processing the new instance relation table and the old instance relation table associated with the new instance relation table.
2. The method for probing instance topology according to claim 1, wherein said traversing for finding an instance relationship of each instance of said plurality of instances to be probed comprises:
searching an upper-layer example of each example to be detected to obtain a searching result of the upper-layer example, and acquiring example information of the upper-layer example in the basic table based on the searching result;
and searching the lower-layer example of the upper-layer example to obtain a searching result of the lower-layer example, and acquiring the example information of the lower-layer example in the basic table based on the searching result.
3. The method for probing an instance topology according to claim 1, wherein said base table and/or said instance relationship table are stored in a database.
4. The instance topology detection method of claim 1, wherein the generating a base table of a plurality of instances comprises:
collecting instance information of a plurality of instances;
generating the base table based on the instance information.
5. The example topology detection method of any of claims 1-4, further comprising:
and if the searched example is not in the basic table, adding the example information of the example to the basic table.
6. An apparatus for instance topology discovery, the apparatus comprising:
the first generation module is used for generating a base table of a plurality of instances;
the acquisition module is used for acquiring a plurality of examples to be detected in the basic table;
the searching module is used for searching the example relation of each example in the plurality of examples to be detected in a traversing way;
the second generation module is used for generating a new instance relation table corresponding to the instance relations one by one;
and the merging module is used for merging and processing the new instance relation table and the old instance relation table associated with the new instance relation table.
7. The apparatus for instance topology detection according to claim 6, wherein said lookup module comprises:
the first searching unit is used for searching the upper-layer example of each example to be detected to obtain a searching result of the upper-layer example, and acquiring example information of the upper-layer example in the basic table based on the searching result;
and the second searching unit is used for searching the lower layer example of the upper layer example to obtain the searching result of the lower layer example, and acquiring the example information of the lower layer example in the basic table based on the searching result.
8. The apparatus for probing an instance topology according to claim 6, wherein said base table and/or said instance relationship table are stored in a database.
9. The apparatus for instance topology detection according to claim 6, wherein said first generation module comprises:
the acquisition unit is used for acquiring the instance information of a plurality of instances;
a generating unit configured to generate the base table based on the instance information.
10. The example topology detection device of any of claims 6-9, further comprising:
and the adding module is used for adding the example information of the example to the basic table when the searched example is not in the basic table.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811312995.XA CN111143319A (en) | 2018-11-06 | 2018-11-06 | Method and device for detecting instance topology |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811312995.XA CN111143319A (en) | 2018-11-06 | 2018-11-06 | Method and device for detecting instance topology |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111143319A true CN111143319A (en) | 2020-05-12 |
Family
ID=70515965
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811312995.XA Pending CN111143319A (en) | 2018-11-06 | 2018-11-06 | Method and device for detecting instance topology |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111143319A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111913706A (en) * | 2020-07-07 | 2020-11-10 | 国电南瑞科技股份有限公司 | Topology construction method of dispatching automation system, storage medium and computing equipment |
Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7701881B1 (en) * | 2004-07-17 | 2010-04-20 | Cisco Technology, Inc. | System and method for determining the mergeability of spanning tree instances |
CN102891765A (en) * | 2012-09-05 | 2013-01-23 | 曙光云计算技术有限公司 | SNMP (Simple Network Management Protocol) and HTML5 (Hypertext Markup Language 5)-based method for realizing web network topology |
CN103617242A (en) * | 2013-11-26 | 2014-03-05 | 曙光信息产业股份有限公司 | Method for showing topology of distributed file system |
CN104881733A (en) * | 2015-05-08 | 2015-09-02 | 南车青岛四方机车车辆股份有限公司 | Method and device for instantiating structure tree of high-speed train |
CN104978411A (en) * | 2015-06-23 | 2015-10-14 | 南车青岛四方机车车辆股份有限公司 | Train model development method and apparatus for high-speed train |
CN105306255A (en) * | 2015-09-21 | 2016-02-03 | 烽火通信科技股份有限公司 | System having large data size and multiple topological graph instances in telecommunication network management and method for managing a large data size and multiple topological graph instances in telecommunication network management |
CN105404956A (en) * | 2015-10-28 | 2016-03-16 | 南车青岛四方机车车辆股份有限公司 | Vehicle technical index acquisition method and device |
CN106789146A (en) * | 2016-04-15 | 2017-05-31 | 新华三技术有限公司 | A kind of topological preparation method and device |
CN107248065A (en) * | 2017-06-08 | 2017-10-13 | 中国建设银行股份有限公司 | Line reports table management method, system, device and storage medium |
CN108055207A (en) * | 2017-10-26 | 2018-05-18 | 北京天元创新科技有限公司 | A kind of network topology cognitive method and device |
CN108737179A (en) * | 2018-05-21 | 2018-11-02 | 北京顺丰同城科技有限公司 | Facility information processing method, device, terminal device and storage medium |
-
2018
- 2018-11-06 CN CN201811312995.XA patent/CN111143319A/en active Pending
Patent Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7701881B1 (en) * | 2004-07-17 | 2010-04-20 | Cisco Technology, Inc. | System and method for determining the mergeability of spanning tree instances |
CN102891765A (en) * | 2012-09-05 | 2013-01-23 | 曙光云计算技术有限公司 | SNMP (Simple Network Management Protocol) and HTML5 (Hypertext Markup Language 5)-based method for realizing web network topology |
CN103617242A (en) * | 2013-11-26 | 2014-03-05 | 曙光信息产业股份有限公司 | Method for showing topology of distributed file system |
CN104881733A (en) * | 2015-05-08 | 2015-09-02 | 南车青岛四方机车车辆股份有限公司 | Method and device for instantiating structure tree of high-speed train |
CN104978411A (en) * | 2015-06-23 | 2015-10-14 | 南车青岛四方机车车辆股份有限公司 | Train model development method and apparatus for high-speed train |
CN105306255A (en) * | 2015-09-21 | 2016-02-03 | 烽火通信科技股份有限公司 | System having large data size and multiple topological graph instances in telecommunication network management and method for managing a large data size and multiple topological graph instances in telecommunication network management |
CN105404956A (en) * | 2015-10-28 | 2016-03-16 | 南车青岛四方机车车辆股份有限公司 | Vehicle technical index acquisition method and device |
CN106789146A (en) * | 2016-04-15 | 2017-05-31 | 新华三技术有限公司 | A kind of topological preparation method and device |
CN107248065A (en) * | 2017-06-08 | 2017-10-13 | 中国建设银行股份有限公司 | Line reports table management method, system, device and storage medium |
CN108055207A (en) * | 2017-10-26 | 2018-05-18 | 北京天元创新科技有限公司 | A kind of network topology cognitive method and device |
CN108737179A (en) * | 2018-05-21 | 2018-11-02 | 北京顺丰同城科技有限公司 | Facility information processing method, device, terminal device and storage medium |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111913706A (en) * | 2020-07-07 | 2020-11-10 | 国电南瑞科技股份有限公司 | Topology construction method of dispatching automation system, storage medium and computing equipment |
CN111913706B (en) * | 2020-07-07 | 2022-07-01 | 国电南瑞科技股份有限公司 | Topology construction method of dispatching automation system, storage medium and computing equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8832130B2 (en) | System and method for implementing on demand cloud database | |
JP4410804B2 (en) | System management method, information processing apparatus and program in distributed network environment | |
US20160085829A1 (en) | Query method for a distributed database system and query apparatus | |
CN107222339B (en) | Graph database-based fault analysis method and device for power information communication system | |
CN113515499B (en) | Database service method and system | |
US7606813B1 (en) | Model consolidation in a database schema | |
CN101196840B (en) | System and method for configuring a data mirror | |
US20040172512A1 (en) | Method, apparatus, and computer readable medium for managing back-up | |
US9281992B2 (en) | Method and system for identifying storage device | |
KR102508817B1 (en) | High availability distribution intelligence system using message transmission bus | |
US20170371910A1 (en) | Real-time shard rebalancing for versioned entity repository | |
JP2022550049A (en) | Data indexing method in storage engine, data indexing device, computer device and computer program | |
US8934378B1 (en) | Resilient cache-based topology detection of a dynamic cluster | |
WO2016191995A1 (en) | Method and device for partitioning association table in distributed database | |
US20170099179A1 (en) | Failure isolation method and management server for failure isolation | |
CN108183971A (en) | A kind of node electoral machinery in distributed system | |
CN111917834A (en) | Data synchronization method and device, storage medium and computer equipment | |
CN106021068A (en) | Monitoring method for service interface and monitoring system | |
US9461884B2 (en) | Information management device and computer-readable medium recorded therein information management program | |
US10671470B2 (en) | Application performance management system with dynamic discovery and extension | |
GB2458342A (en) | Matching of records in federated databases | |
CN114791846A (en) | Method for realizing observability aiming at cloud native chaos engineering experiment | |
CN112749219A (en) | Data extraction method, data extraction device, electronic equipment, storage medium and program product | |
CN112579007A (en) | Method and device for acquiring full storage link and electronic equipment | |
CN111143319A (en) | Method and device for detecting instance topology |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20200512 |
|
RJ01 | Rejection of invention patent application after publication |