High availability database cluster method based on invisible watermark
By adopting a combination method of PXC cluster, haproxy load balancing and keepalived services in the database, the problem of insufficient stability and reliability of existing databases under high load is solved, and strong data consistency and high performance are achieved, avoiding the shortage of single-node databases.
Patent Information
- Application Number
- CN202111128414.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-26
- Publication Date
- 2025-06-06
- Estimated Expiration
- 2041-09-26
AI Technical Summary
When existing databases process large amounts of copyrighted images and monitoring terminal data, they lack stability and reliability, which affects the embedding of invisible watermarks and the high availability of data.
Using a high-availability database method based on PXC cluster, load balancing is achieved by creating PXC containers, using haproxy containers, and using keepalived services to configure the running status of multiple haproxy containers to ensure that data replication is bidirectional and evenly distributed requests to avoid the shortage of single-node databases.
It achieves strong data consistency, low load and good performance of each node, avoids the system unavailability problem caused by the downtime of a single node database, and improves the stability and reliability of the database.
Smart Images

Figure CN113867949B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data storage, and in particular to a high-availability database cluster method based on invisible watermark. Background Art
[0002] Invisible watermarks are information added to files that is not easily perceived by human senses, so as to protect the ownership of files or embedded information. At present, invisible watermarks are often used in copyright protection and information leakage tracing. Copyright protection, that is, adding invisible watermarks to images, can prove the copyright of the images for the author or authorized person of the images, and prevent the images from being illegally used without the author's authorization; prevent information leakage, that is, in files involving confidential information, different invisible watermarks are added to different visitors. If the images are leaked, the source of the leak can be found by analyzing the invisible watermarks. Due to the large amount of copyright and visitor information, they must be stored securely and reliably.
[0003] In the existing technology, there are many mature databases that can store data conveniently. Among them, the most commonly used is the single-node database, but the single-node database can no longer meet the requirements of high performance and high availability. Once the database goes down, the entire system cannot be used, resulting in the inability to add invisible watermarks normally, affecting the subsequent copyright confirmation and leakage tracing. In order to avoid the shortcomings of single-node databases, technologies such as splitting tables (splitting large tables into small tables), sub-libraries (putting tables in different databases), distribution (putting different databases in different servers), and caching (caching commonly used data) are generally used to improve database performance; use clusters: use database replication and other technologies to form clusters to achieve read-write separation; use backups: master-slave libraries, snapshots, hot backups, off-site backups, etc. to improve system availability. In actual use, when there are too many pictures to add copyright or too many terminals to be monitored, the stability and reliability of the database are always less than expected, which affects the embedding of invisible watermarks. Summary of the invention
[0004] The purpose of the present invention is to provide a high-availability database cluster method based on invisible watermark that can achieve high performance, high availability and high load to ensure the stability of the database.
[0005] To achieve the above purpose, the technical solution adopted by the present invention is: a high-availability database cluster method based on invisible watermark, comprising the following steps: S100, creating a PXC container, in which the PXC nodes in the PXC container map the data directory; S200, using two or more haproxy containers to respectively realize the load balancing of each PXC node; S300, using the keepalived service to configure the operating status of multiple haproxy containers as follows: one of them is working and the others are preparing.
[0006] Compared with the prior art, the present invention has the following technical effects: using a PXC cluster can ensure that data replication is bidirectional, and data written to any node will be synchronized to other nodes, ensuring strong consistency of data; through haproxy for load balancing, requests are evenly distributed to each node, and each node has a low load and good performance; at the same time, through the keepalived service, it is ensured that the front-end program uses a single IP and that the actual processing machines at the back end are multiple, avoiding the shortcomings of a single-node database. BRIEF DESCRIPTION OF THE DRAWINGS
[0007] Figure 1 It is a principle block diagram of the present invention;
[0008] Figure 2 It is a schematic diagram of the process of the present invention;
[0009] Figure 3 It is the keepalived service flow chart in the present invention. DETAILED DESCRIPTION
[0010] Combine the following Figures 1 to 3 , the present invention is further described in detail.
[0011] See also Figure 1 A high-availability database cluster method based on invisible watermark includes the following steps: S100, creating a PXC container, in which the PXC nodes in the PXC container map the data directory; S200, using two or more haproxy containers to respectively realize the load balancing of each PXC node; S300, using the keepalived service to configure the running status of multiple haproxy containers as follows: one of them is working, and the others are preparing. Using the PXC cluster can ensure that data replication is bidirectional. When data is written to any node, it will be synchronized to other nodes, ensuring strong consistency of data; through haproxy load balancing, requests are evenly distributed to each node, and each node has a low load and good performance; at the same time, the keepalived service ensures that the front-end program uses a single IP and that the actual processing machines at the back end are multiple, avoiding the shortcomings of a single-node database.
[0012] In actual application, multiple hosts can be selected, and a haproxy container is installed on each host, so as to avoid the deficiency of a single-node database. Since a PXC container needs to be installed on each host, in order to facilitate deployment, the present invention preferably includes a docker virtual machine, and the PXC container, the haproxy container, and the keepalived service are all installed in the virtual machine. All virtual instances created by the docker virtual machine share a Linux kernel, occupy less hardware resources, and belong to a lightweight virtual machine, which is very convenient for installing and deploying PXC containers, haproxy containers, and keepalived services.
[0013] See also Figure 2 , further, the step S100 includes the following steps: S101, installing the PXC image in the docker virtual machine, PXC has strong consistency, and each node has read and write permissions; S102, for security reasons, creating a docker internal network for the PXC cluster instance, which cannot be directly accessed from the outside, and using the docker port mapping mechanism to open ports to the outside, which can improve the security of the database, and the outside cannot directly access the docker internal network; S103, creating a docker volume, mapping the data directory for the PXC node in the PXC container; after the above preparations are completed, step S104 can be executed to pass running parameters to the PXC image to create a PXC container.
[0014] Further, the step S200 includes the following steps: S201, installing the haproxy image in the docker virtual machine, the haproxy image is stored in the docker warehouse, and only needs to be downloaded; S202, creating a haproxy configuration file, the downloaded and installed haproxy image file does not contain a configuration file, so a configuration file must be created before creating a container to achieve load balancing of the node; S203, creating a haproxy container by mapping and associating with the haproxy configuration file. In this way, the haproxy container can be easily installed, load balancing can be achieved for the PXC node, and the load of each PXC node is guaranteed to be low and the performance is good.
[0015] Furthermore, the step S300 includes the following steps: S301, install keepalived in the haproxy container. Keepalived must be installed in the container where haproxy is located, because KeepAlived does not provide any processing capabilities. In fact, the final processing can fall on the program that can process information. Therefore, we need to deploy keepalived and haproxy together, that is, keepalived is responsible for grabbing IP and receiving requests from the front end. After receiving the request, the system automatically distributes the request to haproxy on the same machine for processing; S302, configure the keepalived virtual IP. Multiple virtual IP addresses can be set, one per line. After the configuration is completed, start keepalived, and then the host machine can ping the virtual IP, so that it is convenient to use.
[0016] Furthermore, the above-mentioned PXC and haproxy can be replaced by programs with similar functions. A variety of preferred implementations are provided below for reference.
[0017] Specifically, the PXC is replaced by Replication. The data synchronization of Replication is one-way and uses asynchronous replication. The data consistency is not as good as PXC, but it can realize the function in this case.
[0018] Specifically, in step S200, the load balancing using haproxy is replaced by any one of Nginx, Apache, and LVS. Nginx is a lightweight Web server / reverse proxy server and email (IMAP / POP3) proxy server, issued under the BSD-like protocol, and is characterized by small memory usage and strong concurrency. mod_backhand is an Apache load balancing module, which defines the HTTP redirection of each request in a heterogeneous Apache server cluster, the processing of each request, and runs through a set of "candidate functions" to determine which server is the most suitable to respond, and then the request is proxied to the server. The LVS cluster adopts IP load balancing technology and content-based request distribution technology. The scheduler has a good throughput rate, and transfers requests to different servers for execution in a balanced manner. The scheduler automatically shields server failures, thereby forming a group of servers into a high-performance, highly available virtual server. The structure of the entire server cluster is transparent to the customer, and there is no need to modify the client and server programs. In actual use, users can choose different technologies for load balancing according to their needs.
Claims
1. A high-availability database cluster method based on invisible watermark, including a docker virtual machine, a PXC container, a haproxy container and a keepalived service are all installed in the virtual machine, Features: The steps include: S100, creating a PXC container, wherein the PXC node in the PXC container maps a data directory, specifically including: S101. Install the PXC image in the docker virtual machine; S102, create a docker internal network for the PXC cluster instance, and use the docker port mapping mechanism to open ports to the outside world; S103, mapping a data directory for a PXC node in a PXC container; S104, passing running parameters to the PXC image to create a PXC container; S200, use two or more haproxy containers to achieve load balancing for each PXC node, including: S201. Install the haproxy image in the docker virtual machine; S202, create a haproxy configuration file; S203, creating a haproxy container by mapping and associating to the haproxy configuration file; S300, use the keepalived service to configure the running status of multiple haproxy containers as follows: one of them is working, and the others are preparing, including: S301. Install keepalived in the haproxy container. S302. Configure the keepalived virtual IP.
2. The high-availability database cluster method based on invisible watermark as claimed in claim 1, Features: The PXC is replaced by Replication.
3. The high-availability database cluster method based on invisible watermark as claimed in claim 1, Features: In the step S200, the load balancing using haproxy is replaced by any one of Nginx, Apache, and LVS.
Citation Information
Patent Citations
Virtualized deployment mysql high-availability system
CN111427592A