CN110851192A - Method and device for responding to configuration of degraded switch - Google Patents

Method and device for responding to configuration of degraded switch Download PDF

Info

Publication number
CN110851192A
CN110851192A CN201810842974.2A CN201810842974A CN110851192A CN 110851192 A CN110851192 A CN 110851192A CN 201810842974 A CN201810842974 A CN 201810842974A CN 110851192 A CN110851192 A CN 110851192A
Authority
CN
China
Prior art keywords
switch
configuration information
degradation
database table
cluster
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
CN201810842974.2A
Other languages
Chinese (zh)
Inventor
张平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201810842974.2A priority Critical patent/CN110851192A/en
Publication of CN110851192A publication Critical patent/CN110851192A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a method and a device for responding to configuration of a degradation switch, and relates to the technical field of computers. One embodiment of the method comprises: synchronizing the configuration information of the degradation switch stored in the database table to the storage nodes of the cluster and the local file of the application server; judging the states of a cluster switch, a database switch and a file switch, and reading configuration information of a degradation switch from a database table, a storage node of a cluster or a local file of an application server according to the states of the cluster switch, the database switch and the file switch; and executing a corresponding degradation scheme according to the degradation switch configuration information. This embodiment can solve the problem of not responding to the degradation scheme in time.

Description

Method and device for responding to configuration of degraded switch
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for responding to configuration of a degraded switch.
Background
At present, APP (Application, i.e. mobile phone software), PC (Personal Computer) web page or HTML5 (hypertext markup language) page are all interface services provided by a background system, and once a problem occurs at a certain function point of the background system, an emergency downgrading operation needs to be performed, such as a screen button, a change of a file, making a link non-clickable, and the like. The downgrade operations need to be defined in advance by the foreground developers, and are implemented by the back end. Currently, the demotion scheme is mostly stored by a database or other middleware cache.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
the high-flow and high-concurrency requests at the front end provide high requirements for rapid and effective degradation after problems occur, and once the storage of the degradation scheme has problems, such as too large access amount to a cache caused by hotspot data access, full storage of middleware, full database link number, overtime query and the like, the cache or the database cannot be accessed in time, so that the degradation scheme cannot be responded in time, and the use of a user is influenced.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for responding to configuration of a degradation switch, which can solve the problem that a degradation scheme cannot be responded in time.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a method of responding to a degraded switch configuration, including:
synchronizing the configuration information of the degradation switch stored in the database table to the storage nodes of the cluster and the local file of the application server;
judging the states of a cluster switch, a database switch and a file switch, and reading configuration information of a degradation switch from a database table, a storage node of a cluster or a local file of an application server according to the states of the cluster switch, the database switch and the file switch;
and executing a corresponding degradation scheme according to the degradation switch configuration information.
Optionally, synchronizing the downgrade switch configuration information stored in the database table to the storage nodes of the cluster and the application server local file includes:
when newly adding the configuration information of the degradation switch, writing the newly added configuration information of the degradation switch into a database table;
creating a storage node in the cluster according to the configuration information of the degradation switch in the database table, and storing the newly added configuration information of the degradation switch in the database table into the storage node;
and writing the newly added degradation switch configuration information in the database table into the local file of the application server according to the degradation switch configuration information in the database table.
Optionally, synchronizing the downgrade switch configuration information stored in the database table to the storage node of the cluster and the application server local file includes:
when the configuration information of the degradation switch is deleted, deleting the configuration information of the degradation switch from a database table;
deleting the storage nodes storing the configuration information of the degradation switches in the cluster according to the configuration information of the degradation switches in the database table;
and deleting the configuration information of the degradation switch from the local file of the application server according to the configuration information of the degradation switch in the database table.
Optionally, synchronizing the downgrade switch configuration information stored in the database table to the storage node of the cluster and the application server local file includes:
modifying the downgrade switch configuration information stored in the database table when the downgrade switch configuration information is modified;
modifying the configuration information of the degradation switches stored in the storage nodes of the cluster according to the configuration information of the degradation switches in the database table;
and modifying the configuration information of the degradation switch stored in the local file of the application server according to the configuration information of the degradation switch in the database table.
Optionally, after synchronizing the destaging switch configuration information stored in the database table to the storage node of the cluster and the application server local file, the method further includes:
loading the configuration information of the degradation switch stored in the local file of the application server into a local memory of the application server, and simultaneously loading the configuration information of the degradation switch stored in a database table into the local memory of the application server;
reading the configuration information of the downgrade switch from the database table, the storage node of the cluster or the local file of the application server, wherein the configuration information of the downgrade switch comprises the following steps:
and reading the configuration information of the degradation switch loaded into the local memory of the application server when the application is started or reading the configuration information of the degradation switch stored in the storage node of the cluster.
Further, according to another aspect of the embodiments of the present invention, there is provided an apparatus responsive to a degraded switch configuration, including:
the synchronization module is used for synchronizing the configuration information of the degradation switch stored in the database table to the storage nodes of the cluster and the local file of the application server;
the reading module is used for judging the states of the cluster switch, the database switch and the file switch and reading the configuration information of the degradation switch from the database table, the storage node of the cluster or the local file of the application server according to the states of the cluster switch, the database switch and the file switch;
and the response module is used for executing a corresponding degradation scheme according to the degradation switch configuration information.
Optionally, the synchronization module is configured to:
when newly adding the configuration information of the degradation switch, writing the newly added configuration information of the degradation switch into a database table;
creating a storage node in the cluster according to the configuration information of the degradation switch in the database table, and storing the newly added configuration information of the degradation switch in the database table into the storage node;
and writing the newly added degradation switch configuration information in the database table into the local file of the application server according to the degradation switch configuration information in the database table.
Optionally, the synchronization module is configured to:
when the configuration information of the degradation switch is deleted, deleting the configuration information of the degradation switch from a database table;
deleting the storage nodes storing the configuration information of the degradation switches in the cluster according to the configuration information of the degradation switches in the database table;
and deleting the configuration information of the degradation switch from the local file of the application server according to the configuration information of the degradation switch in the database table.
Optionally, the synchronization module is configured to:
modifying the downgrade switch configuration information stored in the database table when the downgrade switch configuration information is modified;
modifying the configuration information of the degradation switches stored in the storage nodes of the cluster according to the configuration information of the degradation switches in the database table;
and modifying the configuration information of the degradation switch stored in the local file of the application server according to the configuration information of the degradation switch in the database table.
Optionally, the synchronization module is further configured to: loading the configuration information of the degradation switch stored in the local file of the application server into a local memory of the application server, and simultaneously loading the configuration information of the degradation switch stored in a database table into the local memory of the application server;
the reading module is used for: and reading the configuration information of the degradation switch loaded into the local memory of the application server when the application is started or reading the configuration information of the degradation switch stored in the storage node of the cluster.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any of the embodiments described above.
According to another aspect of the embodiments of the present invention, there is also provided a computer readable medium, on which a computer program is stored, which when executed by a processor implements the method of any of the above embodiments.
One embodiment of the above invention has the following advantages or benefits: because the technical means of synchronizing the configuration information of the degradation switch stored in the database table to the storage nodes of the cluster and the local file of the application server and determining from which data the configuration information is read by the switch state is adopted, the technical problem that the degradation scheme cannot be responded in time is solved; the same three data are distributed and stored in a database table, a storage node of a cluster and a local file of an application server, and the configuration information of a degradation switch is determined from which data is read through the switch state. Thus, degraded switch configuration information can be quickly responded to in any traffic situation.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of a main flow of a method of responding to a degraded switch configuration according to an embodiment of the invention;
FIG. 2 is an overall framework diagram according to an embodiment of the invention;
FIG. 3 is a schematic diagram of a main flow of a method of responding to a degraded switch configuration according to one referenceable embodiment of the present invention;
FIG. 4 is a schematic diagram of the main blocks of an apparatus responsive to a degraded switch configuration, according to an embodiment of the invention;
FIG. 5 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 6 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic diagram of a main flow of a method of responding to a degraded switch configuration according to an embodiment of the present invention. As shown in fig. 1, as an embodiment of the present invention, the method for responding to a configuration of a degraded switch may include:
step 101, synchronizing the configuration information of the downgrade switch stored in the database table to the storage nodes of the cluster and the local file of the application server.
The method provided by the embodiment of the invention is that the configuration information of the degradation switch is respectively stored in the database table, the cluster and the local file of the application server, and data synchronization operation is carried out when the configuration information of the degradation switch is added, modified and deleted, so that the consistency of the three data is ensured.
Optionally, the cluster may be a distributed cluster, for example, a high-availability cluster such as a ZooKeeper (a distributed, open source distributed application coordination service, ZK for short) cluster, and the embodiment of the present invention synchronizes the configuration information of the degradation switch to the storage node of the ZK cluster. Alternatively, the database table may be a MySQL (relational database management System) database table. Alternatively, the local file may be an Xml (extensible markup language) file. As shown in fig. 2, which is an overall framework diagram according to the embodiment of the present invention, in step 101, the demotion switch configuration information in the MySQL database table is synchronized into the Xml files of the storage nodes and the application servers of the ZK cluster. It should be noted that each downgrade switch is configured with its own configuration information, and a database table and a local file store a plurality of downgrade switch configuration information, but one storage node in the cluster only stores the configuration information of one downgrade switch.
As shown in fig. 2, a configuration operation interface of the downgrade switch may be configured in the background, and a program reads the configuration information of the downgrade switch in a database table by default, so that the configuration information of the downgrade switch is displayed on the configuration operation interface of the downgrade switch, which is convenient for a user to search, modify, add, and delete the configuration information of the downgrade switch. The configuration information of each degradation switch is added, modified and deleted on the configuration operation interface of the degradation switch (for example, a certain degradation switch is added or deleted, the configuration information corresponding to a certain degradation switch is modified, and the like), so that the configuration information is updated.
Whether the application is started is monitored through the monitor, if the application is monitored to be started, a synchronization task is started, namely the configuration information of the degradation switch in the database table is read, and the configuration information of the degradation switch in the local file of the application server is updated by using an input-output stream technology, so that the initialization of the degradation switch is realized. Because the cluster is always online, the configuration information can be synchronized into the storage nodes of the cluster in real time after a user operates the downgrade switch, but the local file is localized and possibly inconsistent with the configuration information of the downgrade switch on the line, and for the sake of accuracy, the latest downgrade switch configuration information of the database is synchronized into the local file once after the application is started.
Because the on-line environment Xml file is inconsistent with the configuration information of the degradation switch in the local Xml file after the configuration information of the degradation switch is modified, the configuration information of the degradation switch in the MySQL database table needs to be synchronized into the local Xml file after the application is started, so that the configuration information in the Xml file is ensured to be consistent with the other two pieces of data.
Taking a newly added downgrade switch as an example, the step 101 may specifically include: when newly adding the configuration information of the degradation switch, writing the newly added configuration information of the degradation switch into a database table; creating a storage node in the cluster according to the configuration information of the degradation switch in the database table, and storing the newly added configuration information of the degradation switch in the database table into the storage node; and writing the newly added degradation switch configuration information in the database table into the local file of the application server according to the degradation switch configuration information in the database table.
The operation interface can be configured with a new downgrade switch, that is, new downgrade switch configuration information. The newly added configuration information of the degradation switch is firstly stored in a database table; then, creating a storage node in the cluster according to the newly added configuration information of the degradation switch in the database table, and storing the newly added configuration information of the degradation switch into the storage node; and finally, newly adding the configuration information of the degradation switch in the local file of the application server by using an input-output stream technology according to the newly added configuration information of the degradation switch in the database table.
Taking the delete downgrade switch as an example, the step 101 may specifically include: when the configuration information of the degradation switch is deleted, deleting the configuration information of the degradation switch from a database table; deleting the storage nodes storing the configuration information of the degradation switches in the cluster according to the configuration information of the degradation switches in the database table; and deleting the configuration information of the degradation switch from the local file of the application server according to the configuration information of the degradation switch in the database table.
The downgrade switch, that is, the downgrade switch configuration information, can be deleted through the downgrade switch configuration interface. Firstly, deleting the configuration information of the degradation switch from a database table; then deleting the storage nodes in the cluster according to the degraded switch configuration information deleted from the database table; and finally, deleting the configuration information of the degradation switch in the local file of the application server by using an input-output stream technology according to the configuration information of the degradation switch deleted in the database table.
Taking modifying the configuration information of the degradation switch as an example, the step 101 may specifically include: modifying the downgrade switch configuration information stored in the database table when the downgrade switch configuration information is modified; modifying the configuration information of the degradation switches stored in the storage nodes of the cluster according to the configuration information of the degradation switches in the database table; and modifying the configuration information of the degradation switch stored in the local file of the application server according to the configuration information of the degradation switch in the database table.
The configuration information of each degradation switch can be modified through a degradation switch configuration operation interface, and the modified degradation switch configuration information is firstly updated to the related degradation switch configuration information in the database table; then according to the updating result of the database table, synchronizing the modified configuration information of the degradation switch into the cluster, and modifying the configuration information of the degradation switch stored in the corresponding storage node; and finally, modifying the configuration information of the downgrade switch in the local file of the application server by using an input-output stream technology according to the modified configuration information of the downgrade switch in the database table.
In another embodiment of the present invention, after synchronizing the destage switch configuration information stored in the database table into the storage nodes of the cluster and the application server local file, the method may further comprise: and loading the configuration information of the degradation switch stored in the local file of the application server into the local memory of the application server, and simultaneously loading the configuration information of the degradation switch stored in the database table into the local memory of the application server. In the embodiment, the configuration information of the degradation switch stored in the local file of the application server is loaded into the local memory of the application server, so that the configuration information of the degradation switch can be quickly read after degradation; and loading the configuration information of the degradation switch stored in the database table into a local memory of the application server for rapidly reading the configuration information of the degradation switch after degradation. Therefore, the embodiment of the invention loads the configuration data of the downgrade switch in the database table and the local file into the local memory for interface access so as to support high concurrency and high-efficiency response.
It should be noted that, if the configuration information of the downgrade switch is modified, deleted, or added, the database table, the cluster nodes, and the configuration information in the local file are synchronized first, and then the configuration information of the downgrade switch in the local file and the database table is updated to the local memory synchronously, so as to ensure the reliability of the information in the local memory. In an embodiment of the present invention, the configuration information of the downgrade switches in the local file and the database table may be synchronously updated into the local memory at intervals (e.g., 1 minute or 3 minutes, etc.), so that the memory data accessed in step 102 is the latest.
And 102, judging the states of a cluster switch, a database switch and a file switch, and reading configuration information of a degradation switch from a database table, a storage node of a cluster or a local file of an application server according to the states of the cluster switch, the database switch and the file switch.
The states of the cluster switch, the database switch and the file switch can be modified through the data source switch configuration operation interface, for example, the cluster switch is turned on, and the other two switches are turned off; or the database switch is turned on, and the other two switches are turned off; or the file switch is turned on and the other two switches are turned off. If the cluster switch is turned on, degraded switch configuration information is read from the storage nodes of the cluster. Similarly, if the database switch is opened, reading the configuration of the degraded switch from the database table; and if the file switch is turned on, reading the configuration information of the degradation switch in the local file of the application server.
The embodiment of the invention configures the data source switch for reading the three data sets, and determines which data set is read according to the state of the data source switch. Wherein, the configuration information of the data source switch can be written in a local file (such as an Xml file) of the application server. In some embodiments of the present invention, the read priority of the triplicate data sets is as follows: cluster > database table > local file. Therefore, the states of the cluster switch, the database switch and the file switch can be judged by reading the configuration information of the data source switch, so as to determine from which data the configuration information of the degraded switch is read. It should be noted that the configuration information of the data source switch may be modified in the data source switch configuration operation interface, and the configuration information of the data source switch is modified to determine which switch is turned on, i.e. to determine from which data the configuration information of the degraded switch is read.
And when the system interface is inquired, reading the configuration information of the data source switch, and if the state of the cluster switch is on (other two switches are off), reading the configuration information of the down switch in the storage node of the cluster. And if the state of the database switch is determined to be on (other two switches are off) by reading the configuration information of the data source switch, reading the configuration information of the down switch in the database table. And if the state of the file switch is determined to be on (other two switches are off) by reading the configuration information of the data source switch, reading the configuration information of the down switch in the local file of the application server. For example, if the configuration information of the data source switch is 1, it indicates that the cluster switch is on (the other two switches are off), if the configuration information of the data source switch is 2, it indicates that the database switch is on (the other two switches are off), and if the configuration information of the data source switch is 3, it indicates that the file switch is on (the other two switches are off).
Since the local file and the configuration information of the degradation switch in the database table are updated to the local memory synchronously after the application is started, in this step, the configuration information of the degradation switch loaded to the local memory of the application server when the application is started or the configuration information of the degradation switch stored in the storage node of the cluster is read, and the database table and the local file of the application server are not read every time.
Therefore, the embodiment of the invention utilizes the high availability characteristic of the ZooKeeper cluster, simultaneously takes the MySQL database table as a degradation scheme and the Xml file as a background supporting scheme, and solves the problems that a service system excessively depends on single middleware storage or database storage, a complete degradation scheme is not available, and a switch cannot respond in time due to excessive flow.
And 103, executing a corresponding degradation scheme according to the configuration information of the degradation switch.
In this step, according to the configuration information of the degradation switch read in step 102, a corresponding degradation scheme, such as masking a button, changing a file, making a link non-clickable, etc., is executed in response to the request, as shown in fig. 2. One degradation scheme may be executed, or multiple degradation schemes may be executed simultaneously, which is not limited in this embodiment of the present invention.
According to the various embodiments, the technical scheme that the configuration information of the degradation switch stored in the database table is synchronized to the storage nodes of the cluster and the local file of the application server, and the configuration information is read from which data is determined according to the switch state is adopted, so that the problem that the degradation scheme cannot be responded in time is solved. That is to say, in the prior art, most of the degradation schemes are stored by a database or other middleware cache, and a problem that the degradation schemes cannot be responded in time is likely to occur. The invention stores the same three data in a database table, a storage node of a cluster and a local file of an application server in a distributed manner, and determines from which data the configuration information of a degradation switch is read through the switch state. Thus, degraded switch configuration information can be quickly responded to in any traffic situation.
Fig. 3 is a schematic diagram of a main flow of a method of responding to a degraded switch configuration according to one referential embodiment of the present invention, which may include:
step 301, synchronizing the configuration information of the degradation switch stored in the database table to the storage nodes of the cluster and the local file of the application server;
step 302, when the application is started, reading the configuration information of the degradation switch in the database table, and updating the configuration information of the degradation switch in the local file of the application server;
step 303, loading the configuration information of the degradation switch stored in the local file of the application server into the local memory of the application server, and simultaneously loading the configuration information of the degradation switch stored in the database table into the local memory of the application server;
step 304, if the configuration information of the degradation switch changes, such as addition, modification, deletion and the like, updating the configuration information of the degradation switch into a database table, and then synchronizing the configuration information of the degradation switch stored in the database table into the storage node of the cluster and the local file of the application server;
step 305, loading the configuration information of the degradation switch stored in the local file of the application server into the local memory of the application server at intervals, and loading the configuration information of the degradation switch stored in the database table into the local memory of the application server;
step 306, determining the switch state according to the configuration information of the data source switch, and reading the configuration information of the degradation switch loaded into the local memory of the application server when the application is started or reading the configuration information of the degradation switch stored in the storage node of the cluster.
In addition, in a reference embodiment of the present invention, the detailed implementation of the method for responding to the configuration of the degraded switch is described in detail in the above-mentioned method for responding to the configuration of the degraded switch, and therefore the repeated content will not be described again.
FIG. 4 is a schematic diagram of the main blocks of an apparatus responsive to a degraded switch configuration, according to an embodiment of the invention. As shown in fig. 4, the apparatus 400 for responding to a downgrade switch configuration includes a synchronization module 401, a read module 402, and a response module 403. The synchronization module 401 synchronizes the downgrade switch configuration information stored in the database table to the storage node of the cluster and the local file of the application server; the reading module 402 judges the states of the cluster switch, the database switch and the file switch, and reads the configuration information of the degradation switch from the database table, the storage node of the cluster or the local file of the application server according to the states of the cluster switch, the database switch and the file switch; the response module 403 executes a corresponding degradation scheme according to the degradation switch configuration information.
Optionally, when newly adding configuration information of a downgrade switch, the synchronization module 401 writes the newly added configuration information of the downgrade switch into a database table; creating a storage node in the cluster according to the configuration information of the degradation switch in the database table, and storing the newly added configuration information of the degradation switch in the database table into the storage node; and writing the newly added degradation switch configuration information in the database table into the local file of the application server according to the degradation switch configuration information in the database table.
Optionally, when deleting the configuration information of the downgrade switch, the synchronization module 401 deletes the configuration information of the downgrade switch from the database table; deleting the storage nodes storing the configuration information of the degradation switches in the cluster according to the configuration information of the degradation switches in the database table; and deleting the configuration information of the degradation switch from the local file of the application server according to the configuration information of the degradation switch in the database table.
Optionally, when modifying the downgrade switch configuration information, the synchronization module 401 modifies the downgrade switch configuration information stored in the database table; modifying the configuration information of the degradation switches stored in the storage nodes of the cluster according to the configuration information of the degradation switches in the database table; and modifying the configuration information of the degradation switch stored in the local file of the application server according to the configuration information of the degradation switch in the database table.
Optionally, the synchronization module 401 further loads the downgrade switch configuration information stored in the local file of the application server into the local memory of the application server, and simultaneously loads the downgrade switch configuration information stored in the database table into the local memory of the application server;
the reading module 402 reads the configuration information of the degradation switch loaded in the local memory of the application server when the application is started or reads the configuration information of the degradation switch stored in the storage node of the cluster.
According to the various embodiments, the technical scheme that the configuration information of the degradation switch stored in the database table is synchronized to the storage nodes of the cluster and the local file of the application server, and the configuration information is read from which data is determined according to the switch state is adopted, so that the problem that the degradation scheme cannot be responded in time is solved. That is to say, in the prior art, most of the degradation schemes are stored by a database or other middleware cache, and a problem that the degradation schemes cannot be responded in time is likely to occur. The invention stores the same three data in a database table, a storage node of a cluster and a local file of an application server in a distributed manner, and determines from which data the configuration information of a degradation switch is read through the switch state. Thus, degraded switch configuration information can be quickly responded to in any traffic situation.
It should be noted that, in the implementation of the apparatus for responding to a configuration of a degraded switch according to the present invention, the details of the method for responding to a configuration of a degraded switch are already described in detail above, and therefore, the repeated description is not repeated here.
Fig. 5 illustrates an exemplary system architecture 500 to which the method of responding to a degraded switch configuration or the method of responding to a degraded switch configuration of embodiments of the invention may be applied.
As shown in fig. 5, the system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505. The network 504 serves to provide a medium for communication links between the terminal devices 501, 502, 503 and the server 505. Network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 501, 502, 503 to interact with a server 505 over a network 504 to receive or send messages or the like. The terminal devices 501, 502, 503 may have installed thereon various communication client applications, such as shopping-like applications, web browser applications, search-like applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 501, 502, 503 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 505 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 501, 502, 503. The background management server may analyze and process the received data such as the product information query request, and feed back a processing result (for example, target push information and product information — only an example) to the terminal device.
It should be noted that the method for responding to the configuration of the downgrade switch provided by the embodiment of the present invention is generally executed in the server 505, and accordingly, the apparatus for responding to the configuration of the downgrade switch is generally disposed in the server 505.
It should be understood that the number of terminal devices, networks, and servers in fig. 5 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 6, a block diagram of a computer system 600 suitable for use with a terminal device implementing an embodiment of the invention is shown. The terminal device shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
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 605 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, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, 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 computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 601.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
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 various embodiments of the present invention. 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 or flowchart illustration, and combinations of blocks in the block diagrams 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 modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a synchronization module, a read module, and a response module, where the names of the modules do not in some cases constitute a limitation on the modules themselves.
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: synchronizing the configuration information of the degradation switch stored in the database table to the storage nodes of the cluster and the local file of the application server; judging the states of a cluster switch, a database switch and a file switch, and reading configuration information of a degradation switch from a database table, a storage node of a cluster or a local file of an application server according to the states of the cluster switch, the database switch and the file switch; and executing a corresponding degradation scheme according to the degradation switch configuration information.
According to the technical scheme of the embodiment of the invention, because the technical means of synchronizing the configuration information of the degradation switch stored in the database table to the storage nodes of the cluster and the local file of the application server and determining from which data the configuration information is read according to the switch state is adopted, the technical problem that the degradation scheme cannot be responded in time is solved; the same three data are distributed and stored in a database table, a storage node of a cluster and a local file of an application server, and the configuration information of a degradation switch is determined from which data is read through the switch state. Thus, degraded switch configuration information can be quickly responded to in any traffic situation.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (12)

1. A method of responding to a degraded switch configuration, comprising:
synchronizing the configuration information of the degradation switch stored in the database table to the storage nodes of the cluster and the local file of the application server;
judging the states of a cluster switch, a database switch and a file switch, and reading configuration information of a degradation switch from a database table, a storage node of a cluster or a local file of an application server according to the states of the cluster switch, the database switch and the file switch;
and executing a corresponding degradation scheme according to the degradation switch configuration information.
2. The method of claim 1, wherein synchronizing destage switch configuration information stored in database tables into storage nodes of a cluster and application server local files comprises:
when newly adding the configuration information of the degradation switch, writing the newly added configuration information of the degradation switch into a database table;
creating a storage node in the cluster according to the configuration information of the degradation switch in the database table, and storing the newly added configuration information of the degradation switch in the database table into the storage node;
and writing the newly added degradation switch configuration information in the database table into the local file of the application server according to the degradation switch configuration information in the database table.
3. The method of claim 1, wherein synchronizing destage switch configuration information stored in database tables into storage nodes of a cluster and application server local files comprises:
when the configuration information of the degradation switch is deleted, deleting the configuration information of the degradation switch from a database table;
deleting the storage nodes storing the configuration information of the degradation switches in the cluster according to the configuration information of the degradation switches in the database table;
and deleting the configuration information of the degradation switch from the local file of the application server according to the configuration information of the degradation switch in the database table.
4. The method of claim 1, wherein synchronizing destage switch configuration information stored in database tables into storage nodes of a cluster and application server local files comprises:
modifying the downgrade switch configuration information stored in the database table when the downgrade switch configuration information is modified;
modifying the configuration information of the degradation switches stored in the storage nodes of the cluster according to the configuration information of the degradation switches in the database table;
and modifying the configuration information of the degradation switch stored in the local file of the application server according to the configuration information of the degradation switch in the database table.
5. The method of claim 1, further comprising, after synchronizing destage switch configuration information stored in database tables into storage nodes of the cluster and application server local files:
loading the configuration information of the degradation switch stored in the local file of the application server into a local memory of the application server, and simultaneously loading the configuration information of the degradation switch stored in a database table into the local memory of the application server;
reading the configuration information of the downgrade switch from the database table, the storage node of the cluster or the local file of the application server, wherein the configuration information of the downgrade switch comprises the following steps:
and reading the configuration information of the degradation switch loaded into the local memory of the application server when the application is started or reading the configuration information of the degradation switch stored in the storage node of the cluster.
6. An apparatus responsive to a degraded switch configuration, comprising:
the synchronization module is used for synchronizing the configuration information of the degradation switch stored in the database table to the storage nodes of the cluster and the local file of the application server;
the reading module is used for judging the states of the cluster switch, the database switch and the file switch and reading the configuration information of the degradation switch from the database table, the storage node of the cluster or the local file of the application server according to the states of the cluster switch, the database switch and the file switch;
and the response module is used for executing a corresponding degradation scheme according to the degradation switch configuration information.
7. The apparatus of claim 6, wherein the synchronization module is configured to:
when newly adding the configuration information of the degradation switch, writing the newly added configuration information of the degradation switch into a database table;
creating a storage node in the cluster according to the configuration information of the degradation switch in the database table, and storing the newly added configuration information of the degradation switch in the database table into the storage node;
and writing the newly added degradation switch configuration information in the database table into the local file of the application server according to the degradation switch configuration information in the database table.
8. The apparatus of claim 6, wherein the synchronization module is configured to:
when the configuration information of the degradation switch is deleted, deleting the configuration information of the degradation switch from a database table;
deleting the storage nodes storing the configuration information of the degradation switches in the cluster according to the configuration information of the degradation switches in the database table;
and deleting the configuration information of the degradation switch from the local file of the application server according to the configuration information of the degradation switch in the database table.
9. The apparatus of claim 6, wherein the synchronization module is configured to:
modifying the downgrade switch configuration information stored in the database table when the downgrade switch configuration information is modified;
modifying the configuration information of the degradation switches stored in the storage nodes of the cluster according to the configuration information of the degradation switches in the database table;
and modifying the configuration information of the degradation switch stored in the local file of the application server according to the configuration information of the degradation switch in the database table.
10. The apparatus of claim 9, wherein the synchronization module is further configured to: loading the configuration information of the degradation switch stored in the local file of the application server into a local memory of the application server, and simultaneously loading the configuration information of the degradation switch stored in a database table into the local memory of the application server;
the reading module is used for: and reading the configuration information of the degradation switch loaded into the local memory of the application server when the application is started or reading the configuration information of the degradation switch stored in the storage node of the cluster.
11. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-5.
12. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-5.
CN201810842974.2A 2018-07-27 2018-07-27 Method and device for responding to configuration of degraded switch Pending CN110851192A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810842974.2A CN110851192A (en) 2018-07-27 2018-07-27 Method and device for responding to configuration of degraded switch

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810842974.2A CN110851192A (en) 2018-07-27 2018-07-27 Method and device for responding to configuration of degraded switch

Publications (1)

Publication Number Publication Date
CN110851192A true CN110851192A (en) 2020-02-28

Family

ID=69594691

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810842974.2A Pending CN110851192A (en) 2018-07-27 2018-07-27 Method and device for responding to configuration of degraded switch

Country Status (1)

Country Link
CN (1) CN110851192A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111813568A (en) * 2020-05-25 2020-10-23 北京皮尔布莱尼软件有限公司 Service management system and method
CN111813568B (en) * 2020-05-25 2024-05-31 北京皮尔布莱尼软件有限公司 Service management system and method

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103647830A (en) * 2013-12-13 2014-03-19 浪潮电子信息产业股份有限公司 Dynamic management method for multilevel configuration files in cluster management system
US20150019494A1 (en) * 2013-07-11 2015-01-15 International Business Machines Corporation Speculative recovery using storage snapshot in a clustered database
CN107085580A (en) * 2016-02-16 2017-08-22 阿里巴巴集团控股有限公司 The method and client of client displayed page
CN107454138A (en) * 2017-06-19 2017-12-08 阿里巴巴集团控股有限公司 The implementation method and device that business degrades
CN107592219A (en) * 2017-09-04 2018-01-16 北京潘达互娱科技有限公司 Service degradation processing method and processing device
CN108156013A (en) * 2016-12-02 2018-06-12 阿里巴巴集团控股有限公司 A kind of Page Service disaster recovery method, device and electronic equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150019494A1 (en) * 2013-07-11 2015-01-15 International Business Machines Corporation Speculative recovery using storage snapshot in a clustered database
CN103647830A (en) * 2013-12-13 2014-03-19 浪潮电子信息产业股份有限公司 Dynamic management method for multilevel configuration files in cluster management system
CN107085580A (en) * 2016-02-16 2017-08-22 阿里巴巴集团控股有限公司 The method and client of client displayed page
CN108156013A (en) * 2016-12-02 2018-06-12 阿里巴巴集团控股有限公司 A kind of Page Service disaster recovery method, device and electronic equipment
CN107454138A (en) * 2017-06-19 2017-12-08 阿里巴巴集团控股有限公司 The implementation method and device that business degrades
CN107592219A (en) * 2017-09-04 2018-01-16 北京潘达互娱科技有限公司 Service degradation processing method and processing device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111813568A (en) * 2020-05-25 2020-10-23 北京皮尔布莱尼软件有限公司 Service management system and method
CN111813568B (en) * 2020-05-25 2024-05-31 北京皮尔布莱尼软件有限公司 Service management system and method

Similar Documents

Publication Publication Date Title
CN110597595B (en) Method for providing multi-language information, method for configuring multi-language information, device, equipment and medium
CN109413127B (en) Data synchronization method and device
CN109245908B (en) Method and device for switching master cluster and slave cluster
CN110019263B (en) Information storage method and device
US9075722B2 (en) Clustered and highly-available wide-area write-through file system cache
CN107347093B (en) Configuration method and device for distributed server system
CN111290871A (en) Method and device for acquiring crash information of application program
CN115470432A (en) Page rendering method and device, electronic equipment and computer readable medium
CN110489158B (en) Method, device, medium and electronic equipment for optimizing code hosting platform
CN113190517B (en) Data integration method and device, electronic equipment and computer readable medium
CN112783887A (en) Data processing method and device based on data warehouse
CN110795135A (en) Method and device for realizing injection-resolution configuration
CN112463251A (en) Method and device for configuring hot publishing by uliweb framework
CN112115149A (en) Method and device for providing data
CN116226189A (en) Cache data query method, device, electronic equipment and computer readable medium
CN112711572B (en) Online capacity expansion method and device suitable for database and table division
CN110851192A (en) Method and device for responding to configuration of degraded switch
CN113742376A (en) Data synchronization method, first server and data synchronization system
CN113722007A (en) Configuration method, device and system of VPN branch equipment
CN113761075A (en) Method, device, equipment and computer readable medium for switching databases
CN111984686A (en) Data processing method and device
CN116360710B (en) Data storage method applied to server cluster, electronic device and readable medium
CN112214500A (en) Data comparison method and device, electronic equipment and storage medium
CN113127416A (en) Data query method and device
CN112861030B (en) CDN refreshing method and device, cache server and storage medium

Legal Events

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