CN112346912A - Stateful service master and standby high availability system and method based on network file system - Google Patents

Stateful service master and standby high availability system and method based on network file system Download PDF

Info

Publication number
CN112346912A
CN112346912A CN202011384098.7A CN202011384098A CN112346912A CN 112346912 A CN112346912 A CN 112346912A CN 202011384098 A CN202011384098 A CN 202011384098A CN 112346912 A CN112346912 A CN 112346912A
Authority
CN
China
Prior art keywords
copy
standby
service
network file
file system
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
CN202011384098.7A
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.)
Chengdu Ghostcloud Technology Co ltd
Original Assignee
Chengdu Ghostcloud 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 Chengdu Ghostcloud Technology Co ltd filed Critical Chengdu Ghostcloud Technology Co ltd
Priority to CN202011384098.7A priority Critical patent/CN112346912A/en
Publication of CN112346912A publication Critical patent/CN112346912A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1458Management of the backup or restore process
    • G06F11/1464Management of the backup or restore process for networked environments
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/182Distributed file systems
    • 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention relates to the field of micro-service architecture, and provides a high availability system and a method for a stateful service master and standby based on a network file system. The system comprises: the system comprises a load balancing module and a network file system; the method comprises the following steps: preparing a network file system, and acquiring a storage area in the network file system for service mounting; storing the mounting network to a service data directory, and simultaneously starting a service primary copy and a standby copy; setting external traffic to be totally flowed into the main copy by using a load balancing module, and keeping the standby copy to have no traffic and no load; setting a load balancer strategy, and if the main copy is down, completely switching the residual traffic which does not flow into the main copy from all the external traffic to a standby copy; when the main copy is down, the residual traffic which does not flow into the main copy in all the external traffic is completely switched to the standby copy, and the data state of the main copy is kept unchanged. The invention can continue the key data when the copy switching occurs, and ensures that the service is not interrupted.

Description

Stateful service master and standby high availability system and method based on network file system
Technical Field
The invention relates to the field of micro-service architecture, in particular to a high availability system and a method for a stateful service master and standby based on a network file system.
Background
The microservice architecture is a new technology for deploying applications and services in the cloud. Much of the debate around microservices is focused on whether containers or other technologies perform microservices well, and the red-hat says that the API should be the focus.
The microservice may run in its own program and communicate with the HTTP-type API through the lightweight device. The key is that the service can run in its own program. By this we can distinguish service exposure from microservice architecture (distributing an API in existing systems). In service publishing, many services may be restricted by internal independent processes. If any of the services requires some functionality to be added, the process must be narrowed. In the micro-service architecture, only the required functions need to be added in a specific certain service, and the architecture of the whole process is not influenced.
Moreover, the micro-service architecture basically supports the traditional multi-copy and traffic load balancing, fault fusing and other technologies. However, for stateful services, if one copy of a service fails to switch subsequent traffic to another copy or restart a new copy, critical data is likely to be lost, resulting in loss of service.
In the field of a high-availability service scheme, a traditional solution is a master-standby mode, and traffic is switched to a standby service after a master node is down, but in a stateful service, the scheme is limited by a service state, and if traffic switching is performed, part of state data, such as state data of a user session, is lost.
Disclosure of Invention
The invention aims to provide a network file system-based stateful service active/standby high-availability system and a method thereof, which can enable key data to be continued when copy switching occurs and ensure that services are not interrupted.
The invention solves the technical problem, and adopts the technical scheme that:
the invention firstly provides a stateful service master-standby high-availability system based on a network file system, which comprises the following steps:
and the load balancing module is used for setting all external traffic to be all flowed into the primary copy, keeping the standby copy to have no traffic and no load, and setting: if the main copy is down, completely switching the residual traffic which does not flow into the main copy from all the external traffic to the standby copy;
the network file system is used for providing a storage area used by the service mount and simultaneously starting the service primary copy and the standby copy when the network mount is stored in the service data directory; and the data of the primary copy and the standby copy are synchronously stored, and the data state of the primary copy is kept unchanged when the flow is switched from the primary copy to the standby copy.
Specifically, the network file system is an nfs network file system.
Specifically, the load balancing module is an IP virtual server.
Specifically, a docker containerization is used to run mysql as a service application.
In addition, the invention also provides a method for high availability of the active and standby stateful services based on the network file system, which is applied to the active and standby stateful services based on the network file system and comprises the following steps:
step 1, preparing a network file system, and acquiring a storage area in the network file system for service mounting;
step 2, storing the mounting network to a service data directory, and simultaneously starting a service primary copy and a standby copy;
step 3, using a load balancing module to set the external flow to be totally flowed into the main copy, and keeping the standby copy to have no flow and no load;
step 4, setting a load balancer strategy, and if the main copy is down, completely switching the residual traffic which does not flow into the main copy from all the external traffic to a standby copy;
and 5, when the main copy is down, completely switching the residual traffic which does not flow into the main copy from all the external traffic to the standby copy, and keeping the data state of the main copy unchanged.
Further, in step 1, the service is applicable to mysql, and to any service that has state and uses disk storage state.
Further, in step 2, the primary copy and the backup copy are respectively set on corresponding servers.
The invention has the advantages that through the network file system-based high availability system and the method for the active and standby state services, the active and standby copies use the same storage, the storage is distributed network storage, the active and standby copies share the same data, and after the flow is switched to standby, the original state data can be kept due to the existence of the data.
Drawings
Fig. 1 is a schematic diagram of a working principle of a stateful service active/standby high availability system based on a network file system in embodiment 1 of the present invention;
fig. 2 is a flowchart of a stateful service active/standby high availability system and method based on a network file system in embodiment 2 of the present invention.
Detailed Description
The technical solution of the present invention is described in detail below with reference to the accompanying drawings and embodiments.
Example 1
The present embodiment provides a network file system-based active/standby high-availability system with stateful services, whose working schematic diagram is shown in fig. 1, where the system includes: and the load balancing module is used for setting all external traffic to be all flowed into the primary copy, keeping the standby copy to have no traffic and no load, and setting: if the main copy is down, completely switching the residual traffic which does not flow into the main copy from all the external traffic to the standby copy; the network file system is used for providing a storage area used by the service mount and simultaneously starting the service primary copy and the standby copy when the network mount is stored in the service data directory; and the data of the primary copy and the standby copy are synchronously stored, and the data state of the primary copy is kept unchanged when the flow is switched from the primary copy to the standby copy.
In this embodiment, in order to facilitate distributed synchronous storage of the primary copy and the backup copy, the network file system may be an nfs network file system. To implement the load balancing function, the load balancing module may be an IP virtual server, where the virtual server is a highly scalable and highly available server built in a cluster of servers, the architecture of the server cluster is completely transparent to the user, and the user feels that it has only one high performance virtual server.
In this embodiment, docker containerization may be used to run mysql as a service application.
Example 2
This embodiment proposes a method for high availability of active/standby stateful services based on a network file system, which is applied to the system for high availability of active/standby stateful services based on a network file system proposed in embodiment 1, and a flowchart thereof is shown in fig. 2, where the method includes the following steps:
step 1, preparing a network file system, and acquiring a storage area in the network file system for service mounting;
step 2, storing the mounting network to a service data directory, and simultaneously starting a service primary copy and a standby copy;
step 3, using a load balancing module to set the external flow to be totally flowed into the main copy, and keeping the standby copy to have no flow and no load;
step 4, setting a load balancer strategy, and if the main copy is down, completely switching the residual traffic which does not flow into the main copy from all the external traffic to a standby copy;
step 5, when the main copy is down, completely switching the residual traffic which does not flow into the main copy from all the external traffic to the standby copy, and keeping the data state of the main copy unchanged; here, since the backup copy uses the same storage as the primary copy and is in a hot standby state, the state of the backup copy remains after the traffic is switched.
In the above method of this embodiment, in step 1, the service may be applicable to mysql, and to any service that has a state and uses a disk storage state, and the like; in step 2, the primary copy and the backup copy may be respectively set on corresponding servers.
Example 3
In the embodiment, an nfs network file system is used as distributed storage support, a docker containerization operation mysql is used as service application, ipvs is used as load balancing, and two hosts AB are used as main and standby servers.
In a specific application process, the method for high availability of the active and standby state services based on the network file system can comprise the following steps:
s1, the nfs file system creates a specific data storage directory/nfs/mysql.
S2, in the first directory mount step of the host A, loading the nfs directory to/data/mysql;
here, the master copy mysql was run using docker, docker run-itd-v/data/mysql,/var/lib/mysql: 5.7.
S3, in the first host B directory mounting step, nfs directory to/data/mysql;
at this point, the master copy mysql was run using docker, docker run-itd-v/data/mysql,/var/lib/mysql: 5.7.
And S4, setting a load balancer to transfer the traffic to the service on the host A, and setting a policy to switch the traffic to the service B if the host A goes down.
And S5, stopping the host A, switching all the discovered flow to the standby copy, and enabling the access service to normally provide the service and the same data as the main service.

Claims (7)

1. A stateful service master-standby high-availability system based on a network file system is characterized by comprising the following steps:
and the load balancing module is used for setting all external traffic to be all flowed into the primary copy, keeping the standby copy to have no traffic and no load, and setting: if the main copy is down, completely switching the residual traffic which does not flow into the main copy from all the external traffic to the standby copy;
the network file system is used for providing a storage area used by the service mount and simultaneously starting the service primary copy and the standby copy when the network mount is stored in the service data directory; and the data of the primary copy and the standby copy are synchronously stored, and the data state of the primary copy is kept unchanged when the flow is switched from the primary copy to the standby copy.
2. A network file system based stateful services master and standby high availability system according to claim 1, wherein the network file system is an nfs network file system.
3. The active/standby high availability system of stateful services based on a network file system according to claim 1, wherein the load balancing module is an IP virtual server.
4. The active-standby high-availability stateful services based on network file systems of claim 1, wherein a docker containerized running mysql is used as a service application.
5. A method for high availability of active/standby stateful services based on a network file system, applied to the system of any one of claims 1 to 4, is characterized in that the method comprises the following steps:
step 1, preparing a network file system, and acquiring a storage area in the network file system for service mounting;
step 2, storing the mounting network to a service data directory, and simultaneously starting a service primary copy and a standby copy;
step 3, using a load balancing module to set the external flow to be totally flowed into the main copy, and keeping the standby copy to have no flow and no load;
step 4, setting a load balancer strategy, and if the main copy is down, completely switching the residual traffic which does not flow into the main copy from all the external traffic to a standby copy;
and 5, when the main copy is down, completely switching the residual traffic which does not flow into the main copy from all the external traffic to the standby copy, and keeping the data state of the main copy unchanged.
6. The active/standby high availability method for stateful services based on network file system according to claim 5, wherein in step 1, the service is applicable to mysql and to any stateful and using disk storage state service.
7. The method according to claim 5, wherein in step 2, the primary copy and the backup copy are respectively disposed on corresponding servers.
CN202011384098.7A 2020-12-01 2020-12-01 Stateful service master and standby high availability system and method based on network file system Pending CN112346912A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011384098.7A CN112346912A (en) 2020-12-01 2020-12-01 Stateful service master and standby high availability system and method based on network file system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011384098.7A CN112346912A (en) 2020-12-01 2020-12-01 Stateful service master and standby high availability system and method based on network file system

Publications (1)

Publication Number Publication Date
CN112346912A true CN112346912A (en) 2021-02-09

Family

ID=74427878

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011384098.7A Pending CN112346912A (en) 2020-12-01 2020-12-01 Stateful service master and standby high availability system and method based on network file system

Country Status (1)

Country Link
CN (1) CN112346912A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113254536A (en) * 2021-06-09 2021-08-13 蚂蚁金服(杭州)网络技术有限公司 Database transaction processing method, system, electronic device and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105573867A (en) * 2015-12-30 2016-05-11 浪潮(北京)电子信息产业有限公司 Method and system for realizing high availability of MySQL
CN111522650A (en) * 2019-02-02 2020-08-11 阿里巴巴集团控股有限公司 Service request processing method and device of distributed system and electronic equipment

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105573867A (en) * 2015-12-30 2016-05-11 浪潮(北京)电子信息产业有限公司 Method and system for realizing high availability of MySQL
CN111522650A (en) * 2019-02-02 2020-08-11 阿里巴巴集团控股有限公司 Service request processing method and device of distributed system and electronic equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113254536A (en) * 2021-06-09 2021-08-13 蚂蚁金服(杭州)网络技术有限公司 Database transaction processing method, system, electronic device and storage medium

Similar Documents

Publication Publication Date Title
US10983880B2 (en) Role designation in a high availability node
US9185054B2 (en) System and method for providing zero buffer copying in a middleware machine environment
CA2512312C (en) Metadata based file switch and switched file system
US7237027B1 (en) Scalable storage system
US6421769B1 (en) Efficient memory management for channel drivers in next generation I/O system
JP2023532947A (en) Data transfer method, proxy server, storage medium and electronic device
US20080244552A1 (en) Upgrading services associated with high availability systems
US11218358B2 (en) Network connection and termination system
CN111131451A (en) Service processing system and service processing method
CA2847597A1 (en) Clustered client failover
CN109213571B (en) Memory sharing method, container management platform and computer readable storage medium
US10742489B2 (en) Validating network configuration using shadow databases
CN104270271A (en) Disaster tolerance backup system and method in internet application
CN111158949A (en) Configuration method, switching method and device of disaster recovery architecture, equipment and storage medium
CN111209260A (en) NFS cluster based on distributed storage and method for providing NFS service
US9049265B1 (en) Serving remote access to storage resources
CN113849136B (en) Automatic FC block storage processing method and system based on domestic platform
CN112346912A (en) Stateful service master and standby high availability system and method based on network file system
CN110704541A (en) High-availability distributed method and architecture for Redis cluster multi-data center
JP5945543B2 (en) System including middleware machine environment
US20030095501A1 (en) Apparatus and method for load balancing in systems having redundancy
KR101696911B1 (en) Distributed Database Apparatus and Method for Processing Stream Data Thereof
CN108932149B (en) Data transmission method and device
CN113704218B (en) Method and system for migrating data in container environment during running
US11272005B1 (en) Communicating state information in a distributed storage environment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210209