Method, device and readable storage medium for memcached cluster data reading and writing
A technology for data reading and writing, data writing, applied in the field of communication, can solve problems such as maintenance difficulties and no communication mechanism between nodes
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0046] This embodiment provides a method for reading and writing data in a memcached cluster, such as figure 1 As shown, the method includes S11-S12:
[0047] S11. When writing data to the cluster, write the data to the cluster based on a preset strategy;
[0048] S12. When reading data from the cluster, read data from the cluster based on a preset strategy.
[0049] In the embodiment of the present invention, by writing data to or reading data from the cluster based on a preset strategy, it is possible to overcome the problem that the nodes in the memcached cluster do not have any communication mechanism, maintenance difficulties, and can effectively reduce the number of customers The complexity of the end logic.
[0050] In an optional embodiment, the preset strategy includes: obtaining the number of the storage node according to the key value of the data and the number of storage nodes in the cluster.
[0051] Optionally, the above method further includes, when it is determined that...
Embodiment 2
[0063] This embodiment specifically describes the method of the foregoing embodiment.
[0064] memcached is a high-performance distributed memory object caching system. There are multiple storage nodes in the memcached system; this application adds multiple proxy nodes mproxy between the front-end and the memcached system; the proxy node mproxy can uniformly manage the back-end memcached nodes, Provide backup function and automatic data synchronization function after the downtime node is restored; the front-end node uses the keepalived+haproxy high-availability architecture.
[0065] In this example, before using the memcached cluster high availability method, the following deployments are required:
[0066] (1) Role division and numbering;
[0067] Divide the roles of the cache nodes in the memcached system into storage nodes and backup nodes; after the roles are divided, number the nodes in the memcached system;
[0068] In this example, such as figure 2 As shown, the memcached syst...
Embodiment 3
[0092] This embodiment provides a device for reading and writing data in a memcached cluster. The description in the above method embodiment is also applicable to this embodiment. image 3 As shown, the device includes a writing module 31 and a reading module 32:
[0093] The writing module 31 is used to write data to the cluster based on a preset strategy when writing data to the cluster;
[0094] The reading module 32 is used for reading data from the cluster based on a preset strategy when reading data from the cluster.
[0095] In an optional embodiment, the preset strategy includes: obtaining the number of the storage node according to the key value of the data and the number of storage nodes in the cluster.
[0096] Optionally, the above device further includes a judgment module 33,
[0097] When the judgment module 33 judges that the storage node corresponding to the number is working normally,
[0098] The writing module 31 writes data to the cluster based on a preset strategy, ...
PUM
Login to View More Abstract
Description
Claims
Application Information
Login to View More 


