The present disclosure relates to information technologies, and more particularly, to a method, an electronic device and a system for updating a client configuration in a distributed cache system.
Memcached (a distributed cache system) is a memory-based key-value (a distributed storage system) database, which is commonly used for constructing a high-performance and extensible distributed application system. The Memcached consists of a server cluster and a client. When the Memcached is used in each application server, the Memcached can be connected to a service node in the server cluster through the client to read or write data. The client specifically can be connected to a service node in the server cluster according to configuration information pre-configured in an application server. In a process of using the Memcached, an application server often needs to adjust the configuration information of the client according to a data size, a request concurrency volume and running conditions of each service node.
At present, when it is needed to adjust configuration information of a client, generally it is required to reedit a code of an application program corresponding to the client and restart an application server corresponding to the client after reediting the code to complete updating the configuration information of the client. However, a process of reediting a code is relatively complex and restarting an application server takes longer time, which causes a lower update efficiency of an existing client configuration and a poorer real-time update.
The present disclosure provides a method, an electronic device and a system for updating a client configuration in a distributed cache system to solve a problem that an existing client configuration is lower in update efficiency and poorer in real-time update.
In a first aspect, embodiments of the present disclosure provide a method for updating a client configuration in a distributed cache system, implemented by a server, including:
In a second aspect, embodiments of the present disclosure provide an electronic device, including: at least one processor; and a memory communicably connected with the at least one processor for storing instructions executable by the at least one processor, wherein execution of the instructions by the at least one processor causes the at least one processor to perform any methods for updating a client configuration in a distributed cache system mentioned by embodiments of the present disclosure.
In a third aspect, embodiments of the present disclosure provide an electronic device, including: at least one processor; and a memory communicably connected with the at least one processor for storing instructions executable by the at least one processor, wherein execution of the instructions by the at least one processor causes the at least one processor to:
One or more embodiments are illustrated by way of example, and not by limitation, in the figures of the accompanying drawings, wherein elements having the same reference numeral designations represent like elements throughout. The drawings are not to scale, unless otherwise disclosed.
To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure clearer, the following clearly and completely describes the technical solutions in the embodiments of the present disclosure with combination of the accompanying drawings in the embodiments of the present disclosure. Apparently, the described embodiments are some but not all of the embodiments of the present disclosure.
Embodiments of the present disclosure provide a method for updating a client configuration in a distributed cache system, as shown in
101: The configuration center server configures configuration identification information in the client.
Further, the client acquires configuration information corresponding to the configuration identification information from the configuration center server and connects with a service node indicated in the configuration information. The service node is a service node in the distributed cache system. The configuration center server specifically can be constructed through Zookeeper (a distributed application program coordination service of an open source code), which is not limited in the embodiments of the present disclosure. The configuration identification information is used for uniquely identifying configuration information, each piece of configuration identification information corresponds to one client, and the configuration center server saves configuration identification information corresponding to different clients and configuration information corresponding to each piece of configuration identification information. The configuration information can save configuration identification information, identification information of a service node, and functions that can be supported by a client or the like, for example, whether a client supports high availability and a format of communication between the client and a server, which is not limited in the embodiments of the present disclosure.
To the embodiments of the present disclosure, in order to ensure that the configuration information can be used by clients of different applications, a uniform format is stipulated for the configuration information, and a uniform resource identifier (URI) specification format can be used as a format of the configuration information. For example, a root path of all configuration information is /Memcached. In this case, when configuration identification information is test, the configuration information is stored under a path of /Memcached/test, and a content of the configuration information is as below:
Memcached ://127.0.0.1:6380,10.127.0.0.1:6381?failover=false&textmode=false, where Memcached:// is a protocol header of the configuration information, which indicates that the configuration information is applied to an Memcached client, 127.0.0.1:6380 and 10.127.0.0.1:6381 are service nodes of an Memcached server cluster to which the indicated client needs to be connected, each service node consists of an IP and a port, multiple nodes are separated by separators therebetween, here a comma is used as a separator, failover=false stipulates that the client does not need to support high availability, false indicates no need, true indicates need, extmode=false stipulates that the format of communication between the client and a server is a binary format, false indicates a binary format, and true indicates a text format.
It can be known from the foregoing configuration information having a URI specification format that in the embodiments of the present disclosure, a uniform configuration information format is employed to configure configuration information of different clients. In this way, compatibility of clients of different applications can be ensured. Meanwhile, the URI specification format is relatively simple in compiling, which can further improve an efficiency in updating a client configuration.
102: It is determined whether update exists in the configuration information.
To the embodiments of the present disclosure, Step 102 specifically can include: determining whether an update instruction corresponding to the configuration information is received. For example, when network maintenance personnel find that a fault exists in a service node in the configuration information, they can take the initiative to alter contents of the configuration information and send an update instruction to the configuration center server.
To the embodiments of the present disclosure, Step 102 specifically can further include: detecting whether an abnormality is present in status information corresponding to the service node indicated in the configuration information. For example, it is detected whether a service node goes wrong or whether a communications link corresponding to a service node goes wrong.
Further, it is confirmed that the update exists when the update instruction corresponding to the configuration information is received and/or an abnormality is present in the status information. To the embodiments of the present disclosure, when an abnormality is present in the status information corresponding to a service node, the configuration information is updated timely, which not only can improve an efficiency in updating a client configuration and ensure a real-time update, but also can improve an accuracy in updating configuration information.
103: Updated configuration information is sent to the client when the update exists.
Further, the client is allowed to connect with a service node indicated in the updated configuration information. To the embodiments of the present disclosure, specifically the updated configuration information can be sent to the client through a callback monitoring channel established for the client.
According to the method for updating a client configuration in a distributed cache system provided by the embodiments of the present disclosure, first of all, a configuration center server configures configuration identification information in a client so that the client acquires configuration information corresponding to the configuration identification information from the configuration center server and connects with a service node indicated in the configuration information, then determines whether update exists in the configuration information, and sends updated configuration information to the client when the update exists so that the client connects with a service node indicated in the updated configuration information. Compared with an existing technology in which when it is needed to adjust configuration information of a client, generally it is required to reedit a code of an application program corresponding to the client and restart an application server corresponding to the client after reediting the code to complete updating the configuration information of the client, in the embodiments of the present disclosure, a configuration center server detects in real time whether updated configuration information exists and pushes the updated configuration information to the client in real time, in this way, an efficiency in updating a client configuration can be improved and a real-time update can be ensured.
Corresponding to the foregoing method, embodiments of the present disclosure further provide a method for updating a client configuration in a distributed cache system, as shown in
201: The client acquires configuration information from a configuration center server according to configuration identification information configured in the configuration center server.
The configuration information carries service node information. The configuration identification information is used for uniquely identifying configuration information, each piece of configuration identification information corresponds to one client, and the configuration center server saves configuration identification information corresponding to different clients and configuration information corresponding to each piece of configuration identification information. The configuration information can save configuration identification information, identification information of a service node, and functions that can be supported by the client or the like, which are not limited in the embodiments of the present disclosure.
To the embodiments of the present disclosure, Step 201 specifically can include: establishing callback monitoring between the client and the configuration center server. The configuration information is acquired from the configuration center server by invoking the callback monitoring.
202: A connection with a service node corresponding to the service node information is established.
Before Step 202, the embodiments of the present disclosure further can include: detecting whether a format corresponding to the configuration information conforms to the URI specification format. In this case Step 202 specifically can include: establishing a connection with a service node corresponding to the service node information if the format conforms to the URI specification format. The configuration information is deleted if format does not conform to the URI specification format. Before establishing a connection with the service node corresponding to the service node information, by detecting whether a format corresponding to the configuration information conforms to the URI specification format, it can be ensured that the client can establish an effective connection according to the configuration information, thereby avoiding processing unrecognizable configuration information and avoiding waste of system resources.
203: Updated configuration information sent by the configuration center server is received when update exists in the configuration information.
Specifically, the pre-established callback monitoring can be invoked to receive the updated configuration information sent by the configuration center server.
204: A service node connection is performed according to a service node in the distributed cache system indicated in the updated configuration information.
It is to be noted that reference can be made to corresponding description in
According to another method for updating a client configuration in a distributed cache system provided by the embodiments of the present disclosure, first of all a client acquires configuration information from a configuration center server according to configuration identification information configured in the configuration center server, then establishes a connection with a service node corresponding to the service node information, receives updated configuration information sent by the configuration center server when update exists in the configuration information, and finally performs a service node connection according to a service node indicated in the updated configuration information. Compared with an existing technology in which when it is needed to adjust configuration information of a client, generally it is required to reedit a code of an application program corresponding to the client and restart an application server corresponding to the client after reediting the code to complete updating the configuration information of the client, in the embodiments of the present disclosure, a configuration center server detects in real time whether updated configuration information exists and pushes the updated configuration information to the client in real time, in this way, an efficiency in updating a client configuration can be improved and a real-time update can be ensured.
Further, as a concrete implementation of the method as shown in
The configuring unit 31 is configured to configure configuration identification information in a client so that the client acquires configuration information corresponding to the configuration identification information from the configuration center server and connects with a service node indicated in the configuration information.
The determining unit 32 is configured to determine whether update exists in the configuration information.
The sending unit 33 is configured to send updated configuration information to the client when update exists in the configuration information so that the client connects with a service node indicated in the updated configuration information.
The determining unit 32 is specifically configured to determine whether an update instruction corresponding to the configuration information is received, and/or detect whether an abnormality is present in status information corresponding to the service node indicated in the configuration information.
Further, the configuration center server further includes:
A format corresponding to the configuration information is a URI specification format.
It is to be noted that reference can be made to corresponding description in
The configuration center server provided by embodiments of the present disclosure first of all configures configuration identification information in a client so that the client acquires configuration information corresponding to the configuration identification information from the configuration center server and connects with a service node indicated in the configuration information, then determines whether update exists in the configuration information, and sends updated configuration information to the client when the update exists so that the client connects with a service node indicated in the updated configuration information. Compared with an existing technology in which when it is needed to adjust configuration information of a client, generally it is required to reedit a code of an application program corresponding to the client and restart an application server corresponding to the client after reediting the code to complete updating the configuration information of the client, in the embodiments of the present disclosure, a configuration center server detects in real time whether updated configuration information exists and pushes the updated configuration information to the client in real time, in this way, an efficiency in updating a client configuration can be improved and a real-time update can be ensured.
Further, as a concrete implementation of the method as shown in
The acquiring unit 41 is configured to acquire configuration information from a configuration center server according to configuration identification information configured in the configuration center server, where the configuration information carries service node information.
The establishing unit 42 is configured to establish a connection with a service node corresponding to the service node information.
The receiving unit 43 is configured to receive updated configuration information sent by the configuration center server when update exists in the configuration information.
The connecting unit 44 is configured to perform a service node connection according to a service node indicated in the updated configuration information.
Further, the client further includes a detecting unit 45.
The detecting unit 45 is configured to detect whether a format corresponding to the configuration information conforms to a URI specification format.
The connecting unit is specifically configured to establish a connection with a service node corresponding to the service node information when the format conforms to the URI specification format.
It is to be noted that reference can be made to corresponding description in
The client provided by embodiments of the present disclosure first of all acquires configuration information from a configuration center server according to configuration identification information configured in the configuration center server, then establishes a connection with a service node corresponding to the service node information, receives updated configuration information sent by the configuration center server when update exists in the configuration information, and finally performs a service node connection according to a service node indicated in the updated configuration information. Compared with an existing technology in which when it is needed to adjust configuration information of a client, generally it is required to reedit a code of an application program corresponding to the client and restart an application server corresponding to the client after reediting the code to complete updating the configuration information of the client, in the embodiments of the present disclosure, a configuration center server detects in real time whether updated configuration information exists and pushes the updated configuration information to the client in real time, in this way, an efficiency in updating a client configuration can be improved and a real-time update can be ensured.
Still further, as a concrete implementation of the method as shown in
The configuration center server 51 is configured to configure configuration identification information in the client.
The client 52 is configured to acquire configuration information corresponding to the configuration identification information from the configuration center server and connect with a service node indicated in the configuration information.
The configuration center server 51 is further configured to determine whether update exists in the configuration information and send updated configuration information to the client when update exists in the configuration information.
The client 52 is further configured to connect with a service node indicated in the updated configuration information.
It is to be noted that reference can be made to corresponding description in
According to the system for updating a client configuration in a distributed cache system provided by the embodiments of the present disclosure, first of all, a configuration center server configures configuration identification information in a client so that the client acquires configuration information corresponding to the configuration identification information from the configuration center server and connects with a service node indicated in the configuration information, then determines whether update exists in the configuration information, and sends updated configuration information to the client when the update exists so that the client connects with a service node indicated in the updated configuration information. Compared with an existing technology in which when it is needed to adjust configuration information of a client, generally it is required to reedit a code of an application program corresponding to the client and restart an application server corresponding to the client after reediting the code to complete updating the configuration information of the client, in the embodiments of the present disclosure, a configuration center server detects in real time whether updated configuration information exists and pushes the updated configuration information to the client in real time, in this way, an efficiency in updating a client configuration can be improved and a real-time update can be ensured.
It is to be noted that in allusion to the foregoing configuration center server, functions of each unit module used in the embodiments of the present disclosure can be implemented through a hardware processor.
Exemplarily, as shown in
In addition, when a logic instruction in the foregoing memory 63 can be implemented in the form of a software functional unit and is sold or used as an independent product, the logic instruction can be stored in a computer-readable storage medium. Based on such understanding, the essence of or a part of the technical solutions in the present disclosure (that is, the part making contributions over prior arts) may be embodied as software products. The computer software products may be stored in a storage medium including instructions which enable a computer device (for example, a personal computer, a server or a network device, and so on) to perform whole or a part of the steps in the methods according to various embodiments of the present disclosure. The above mentioned storage medium may include various mediums capable of storing program codes, for example, a USB flash drive, a mobile hard disk drive, a read only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and so on.
Further, an embodiment of the present disclosure further provides a non-transitory computer-readable storage medium storing executable instructions, which can be executed by an electronic device to perform any methods for updating a client configuration in a distributed cache system mentioned by embodiments of the present disclosure.
Device which is configured to perform the methods for updating a client configuration in a distributed cache system can also include: input unit 73 and output unit 74.
Processor 71, memory 72, input unit 73 and output unit 74 can be connected by BUS or other methods, and BUS connecting is showed in
Memory 72 can be used for storing non-transitory software program, non-transitory computer executable program and modules as a non-transitory computer-readable storage medium, such as corresponding program instructions/modules for the methods for updating a client configuration in a distributed cache system mentioned by embodiments of the present disclosure (such as shown in
Memory 72 can include program storage area and data storage area, thereby the operating system and applications required by at least one function can be stored in program storage area and data created by using the device for updating a client configuration in a distributed cache system can be stored in data storage area. Furthermore, memory 72 can include high speed Random-access memory (RAM) or non-volatile memory such as magnetic disk storage device, flash memory device or other non-volatile solid state storage devices. In some embodiments, memory 72 can include long-distance setup memories relative to processor 71, which can communicate with the device for updating a client configuration in a distributed cache system by networks. The examples of said networks are including but not limited to Internet, Intranet, LAN, mobile Internet and their combinations.
Input unit 73 can be used to receive inputted number, character information and key signals causing user configures and function controls of the device for updating a client configuration in a distributed cache system. Output unit 74 can include a display screen or a display device.
The said module or modules are stored in memory 72 and perform the methods for updating a client configuration in a distributed cache system when executed by one or more processors 71.
The said device can reach the corresponding advantages by including the function modules or performing the methods provided by embodiments of the present disclosure. Those methods can be referenced for technical details which may not be completely described in this embodiment.
Electronic devices in embodiments of the present disclosure can be existences with different types, which are including but not limited to:
(1) Mobile Internet devices: devices with mobile communication functions and providing voice or data communication services, which include smartphones (e.g. iPhone), multimedia phones, feature phones and low-cost phones.
(2) Super mobile personal computing devices: devices belong to category of personal computers but mobile internet function is provided, which include PAD, MID and UMPC devices, e.g. iPad.
(3) Portable recreational devices: devices with multimedia displaying or playing functions, which include audio or video players, handheld game players, e-book readers, intelligent toys and vehicle navigation devices.
(4) Servers: devices with computing functions, which are constructed by processors, hard disks, memories, system BUS, etc. For providing services with high reliabilities, servers always have higher requirements in processing ability, stability, reliability, security, expandability, manageability, etc., although they have a similar architecture with common computers.
(5) Other electronic devices with data interacting functions.
The embodiments of devices are described above only for illustrative purposes. Units described as separated portions may be or may not be physically separated, and the portions shown as respective units may be or may not be physical units, i.e., the portions may be located at one place, or may be distributed over a plurality of network units. A part or whole of the modules may be selected to realize the objectives of the embodiments of the present disclosure according to actual requirements.
In view of the above descriptions of embodiments, those skilled in this art can well understand that the embodiments can be realized by software plus necessary hardware platform, or may be realized by hardware. Based on such understanding, it can be seen that the essence of the technical solutions in the present disclosure (that is, the part making contributions over prior arts) may be embodied as software products. The computer software products may be stored in a computer readable storage medium including instructions, such as ROM/RAM, a magnetic disk, an optical disk, to enable a computer device (for example, a personal computer, a server or a network device, and so on) to perform the methods of all or a part of the embodiments.
It shall be noted that the above embodiments are disclosed to explain technical solutions of the present disclosure, but not for limiting purposes. While the present disclosure has been described in detail with reference to the above embodiments, those skilled in this art shall understand that the technical solutions in the above embodiments can be modified, or a part of technical features can be equivalently substituted, and such modifications or substitutions will not make the essence of the technical solutions depart from the spirit or scope of the technical solutions of various embodiments in the present disclosure.
Number | Date | Country | Kind |
---|---|---|---|
201510876151.8 | Dec 2015 | CN | national |
This application is a continuation of International Application No. PCT/CN2016/089477, filed on Jul. 8, 2016, which is based upon and claims priority to Chinese Patent Application No. 201510876151.8, filed on Dec. 2, 2015, the entire contents of all of which are incorporated herein by reference.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2016/089477 | Jul 2016 | US |
Child | 15246460 | US |