CN117033088B - Resource scheduling method and device suitable for dual-computer hot standby and server system - Google Patents

Resource scheduling method and device suitable for dual-computer hot standby and server system Download PDF

Info

Publication number
CN117033088B
CN117033088B CN202311045494.0A CN202311045494A CN117033088B CN 117033088 B CN117033088 B CN 117033088B CN 202311045494 A CN202311045494 A CN 202311045494A CN 117033088 B CN117033088 B CN 117033088B
Authority
CN
China
Prior art keywords
server
user
slave
dual
slave server
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.)
Active
Application number
CN202311045494.0A
Other languages
Chinese (zh)
Other versions
CN117033088A (en
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.)
Guangdong Baolun Electronics Co ltd
Original Assignee
Guangdong Baolun Electronics 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 Guangdong Baolun Electronics Co ltd filed Critical Guangdong Baolun Electronics Co ltd
Priority to CN202311045494.0A priority Critical patent/CN117033088B/en
Publication of CN117033088A publication Critical patent/CN117033088A/en
Application granted granted Critical
Publication of CN117033088B publication Critical patent/CN117033088B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/16Error detection or correction of the data by redundancy in hardware
    • G06F11/1658Data re-synchronization of a redundant component, or initial sync of replacement, additional or spare unit
    • 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/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Quality & Reliability (AREA)
  • Hardware Redundancy (AREA)

Abstract

The invention discloses a resource scheduling method and device suitable for dual-computer hot standby and a server system, wherein the method comprises the following steps: responding to an access request of a user, and granting access rights to the user after the user passes the authentication; continuously sending broadcast information packets to the slave servers so as to synchronize data resources of the slave servers; when the broadcasting information packet is stopped being sent, setting the slave server as an updated master server through a survival detection mechanism; and receiving the updated broadcast information packet of the main server, and synchronizing data resources. By adopting the embodiment of the invention, the data synchronization and the server state monitoring are also realized by sending the broadcast information packet, and when the main server is down due to various reasons, the main server and the slave server can be switched in time through the survival detection mechanism, so that the slave server becomes a new main server in time and realizes the data resource synchronization again, and the flexibility of the data synchronization is improved.

Description

Resource scheduling method and device suitable for dual-computer hot standby and server system
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for scheduling resources suitable for dual-computer hot standby, and a server system.
Background
Under the condition of dual-machine hot standby in the current market, most of resource sharing is realized by adopting a shared disk mode. Most commonly, drdb (Distributed Replicated Block Device) components are arranged, during the use process, the system environment is generally assembled, purposeful disk division is carried out, drdb volumes for resource sharing are created, then mounting is carried out, a file system is configured, and data synchronization and sharing between the primary and the secondary are completed. When the method allocates the mount disk memory of the file system, a part of resources need to be separated independently, the requirement on server configuration is high, and the method is not flexible enough.
Disclosure of Invention
The invention provides a resource scheduling method and device suitable for dual-machine hot standby and a server system, which are used for solving the technical problem that the prior art cannot flexibly realize data synchronization.
In order to solve the above technical problems, an embodiment of the present invention provides a resource scheduling method applicable to dual hot standby, applied to a main server, including:
responding to an access request of a user, and granting access rights to the user after the user passes the authentication;
continuously sending broadcast information packets to a slave server so as to synchronize data resources of the slave server;
When the broadcasting information packet is stopped being sent, setting the slave server as an updated master server through a survival detection mechanism;
and receiving the updated broadcast information packet of the main server, and synchronizing data resources.
According to the invention, the data synchronization and the server state monitoring are realized by sending the broadcast information packet, and when the master server is down due to various reasons, the master server and the slave server can be switched in time through the survival detection mechanism, so that the slave server becomes a new master server in time and realizes the data resource synchronization again, and the flexibility of the data synchronization is improved.
Further, the continuously sending the broadcast information packet to the slave server to synchronize the data resources of the slave server includes:
based on mysql service and redisservice, sending broadcast information packets to the slave server according to a first preset time interval through ssh protocol so as to synchronize data resources of the slave server.
Further, when the broadcast packet is stopped being sent, setting the slave server as the updated master server through a survival detection mechanism, including:
when the broadcast information packet stops being sent and exceeds a second preset time interval, all services are closed;
And setting the slave server as an updated master server through a survival detection mechanism, so that the updated master server responds to the access request of the user.
The invention utilizes the survival detection mechanism to combine the time length of the interrupt transmission of the broadcast information packet, and switches the master server and the slave server when the master server is down, thereby realizing the data synchronization more flexibly.
Further, after closing all services when the broadcast packet is stopped to be transmitted for more than a second preset time interval, the method includes:
and writing and saving the content to be recorded into a system log according to the logger method.
Further, the master server and the slave server are both deployed with a keepalive component.
Further, the keep component is configured with a shell script;
The shell script records server resources, service control logic, server environment detection logic, logic for giving up the resources used by the current server and log recording logic.
According to the invention, the shell script written with various logics is configured in the keepalive component, so that the flexibility of the keepalive component is improved, and the flexible scheduling of resources in the dual-machine hot standby mode is realized.
Further, before the responding to the access request of the user and after the user passes the authentication, the method comprises the following steps:
checking whether ssh protocol is supported;
when the ssh protocol is not supported, installing an ssh protocol component;
and detecting the communication condition between the slave server and the ssh key.
Further, the installing ssh protocol component includes:
installing the ssh protocol component through an apt-get source under a ubuntu system; under contos system, the ssh protocol components are installed via yum.
On the other hand, the embodiment of the invention also provides a resource scheduling device suitable for dual-machine hot standby, which comprises the following steps: the system comprises a request response module, a first synchronization module, a node switching module and a second synchronization module;
The request response module is used for responding to an access request of a user and granting access rights to the user after the user passes the verification;
the first synchronization module is used for continuously sending a broadcast information packet to the slave server so as to synchronize data resources of the slave server;
the node switching module is used for setting the slave server as an updated master server through a survival detection mechanism when the transmission of the broadcast information packet is stopped;
and the second synchronization module is used for receiving the updated broadcast information packet of the main server and synchronizing data resources.
According to the invention, the data synchronization and the server state monitoring are realized by sending the broadcast information packet, and when the master server is down due to various reasons, the master server and the slave server can be switched in time through the survival detection mechanism, so that the slave server becomes a new master server in time and realizes the data resource synchronization again, and the flexibility of the data synchronization is improved.
In another aspect, an embodiment of the present invention further provides a server system, including: a master server and a slave server; the main server is used for executing the resource scheduling method suitable for the dual-machine hot standby according to the embodiment of the invention.
Drawings
FIG. 1 is a schematic flow chart of a resource scheduling method suitable for dual-machine hot standby provided by the invention;
FIG. 2 is a schematic flow chart of another resource scheduling method suitable for dual hot standby according to the present invention;
fig. 3 is a schematic structural diagram of an embodiment of a resource scheduling device suitable for dual-standby according to the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1, a flow chart of a resource scheduling method suitable for dual hot standby provided by the invention is applied to a main server, and includes steps 101-104:
Step 101: and responding to the access request of the user, and granting access rights to the user after the user passes the authentication.
In this embodiment, the granting of the access rights to the user may be achieved by activating vip; referring to fig. 2, another flow chart of the resource scheduling method suitable for dual-machine hot standby provided by the invention is shown, wherein the server 1 is a master server in the embodiment, the server 2 is a slave server in the embodiment, the user is activated vip after the master server is started, i.e. the service is started to provide access, and after the master server and the slave server are replaced, the updated master server also executes the vip activating operation to the user. When the local service is started, the data synchronization service of the local is started first to close the data synchronization service of other nodes, so that the situation that the application cannot access due to disorder of data is prevented.
Step 102: broadcast packets are continuously sent to the slave servers to synchronize the data resources of the slave servers.
In this embodiment, step 102 includes: based on mysql service and redisservice, sending broadcast information packets to the slave server according to a first preset time interval through ssh protocol so as to synchronize data resources of the slave server.
Step 103: when the broadcast packet is stopped from being sent, the slave server is set as an updated master server through a survival detection mechanism.
In this embodiment, step 103 includes: when the broadcast information packet stops being sent and exceeds a second preset time interval, all services are closed; and setting the slave server as an updated master server through a survival detection mechanism, so that the updated master server responds to the access request of the user.
The invention utilizes the survival detection mechanism to combine the time length of the interrupt transmission of the broadcast information packet, and switches the master server and the slave server when the master server is down, thereby realizing the data synchronization more flexibly.
In this embodiment, after closing all services when the broadcast packet is stopped to be transmitted for more than a second preset time interval, the method includes: and writing and saving the content to be recorded into a system log according to the logger method. When a problem is found, each service of the node is rapidly closed, data writing is stopped, main and standby switching is performed, the problem is recorded, and subsequent maintenance and problem positioning of a server are facilitated, for example, a keep-alive default log is recorded in a/var/log/message; when the mysql port is detected to be inaccessible, a log needed by the user can be obtained and recorded in the customized detection logic. The logger method can be used to quickly write the log into/var/log/syslog. The logger method is a method provided by a linux self-contained log system, and when in use, for example: logger "content to be recorded".
Step 104: and receiving the updated broadcast information packet of the main server, and synchronizing data resources.
According to the invention, the data synchronization and the server state monitoring are realized by sending the broadcast information packet, and when the master server is down due to various reasons, the master server and the slave server can be switched in time through the survival detection mechanism, so that the slave server becomes a new master server in time and realizes the data resource synchronization again, and the flexibility of the data synchronization is improved.
In this embodiment, the master server and the slave server are both deployed with a keep component.
In this embodiment, the keep-alive component is configured with a shell script; the shell script records server resources, service control logic, server environment detection logic, logic for giving up the resources used by the current server and log recording logic.
According to the invention, the shell script written with various logics is configured in the keepalive component, so that the flexibility of the keepalive component is improved, and the flexible scheduling of resources in the dual-machine hot standby mode is realized. In addition, the concise grammar of shell language and huge built-in commands can help the user to conveniently realize the operation of linux, and the operation threshold is reduced.
In this embodiment, before the responding to the access request of the user and granting access rights to the user after the user passes the authentication, the method includes: checking whether ssh protocol is supported; when the ssh protocol is not supported, installing an ssh protocol component; and detecting the communication condition between the slave server and the ssh key.
In this embodiment, the slave server also checks whether ssh protocol is supported; when the ssh protocol is not supported, installing the ssh protocol component from the server; and detects a communication condition with the main server through the ssh key.
In this embodiment, the installing ssh protocol component includes: installing the ssh protocol component through an apt-get source under a ubuntu system; under contos system, the ssh protocol components are installed via yum.
In this embodiment, the configuration key is an encrypted communication manner, which is used to ensure the security and integrity of communication between two entities; in computer networks, the configuration and communication of keys is typically accomplished using public key encryption and private key decryption. Remote access to the target server is performed using ssh commands. For example, remote viewing of the running container in the ip 172.16.19.64 service can be achieved by entering the instruction ssh 172.16.19.64"docker ps".
Referring to fig. 3, a schematic structural diagram of an embodiment of a resource scheduling apparatus suitable for dual hot standby according to the present invention is shown, where the apparatus includes: a request response module 301, a first synchronization module 302, a node switching module 303 and a second synchronization module 304.
In this embodiment, the request response module 301 is configured to respond to an access request of a user, and grant access rights to the user after the user passes authentication.
In this embodiment, before the request response module 301, the method further includes: the device comprises a protocol checking module, a component mounting module and a communication detection module; the protocol checking module is used for checking whether ssh protocol is supported or not; the assembly installation module is used for installing the ssh protocol assembly when the ssh protocol is not supported; the communication detection module is used for detecting the communication condition between the ssh key and the slave server.
The first synchronization module 302 is configured to continuously send a broadcast packet to a slave server, so that the slave server performs data resource synchronization.
The node switching module 303 is configured to set the slave server as an updated master server through a survival detection mechanism when the broadcast packet is stopped being sent;
The second synchronization module 304 is configured to receive the updated broadcast packet of the primary server, and perform data resource synchronization.
According to the invention, the data synchronization and the server state monitoring are realized by sending the broadcast information packet, and when the master server is down due to various reasons, the master server and the slave server can be switched in time through the survival detection mechanism, so that the slave server becomes a new master server in time and realizes the data resource synchronization again, and the flexibility of the data synchronization is improved.
In another aspect, an embodiment of the present invention further provides a server system, including: a master server and a slave server; the main server is used for executing the resource scheduling method suitable for the dual-machine hot standby according to the embodiment of the invention.
The foregoing embodiments have been provided for the purpose of illustrating the general principles of the present invention, and are not to be construed as limiting the scope of the invention. It should be noted that any modifications, equivalent substitutions, improvements, etc. made by those skilled in the art without departing from the spirit and principles of the present invention are intended to be included in the scope of the present invention.

Claims (8)

1. The resource scheduling method suitable for the dual-computer hot standby is applied to a main server and is characterized by comprising the following steps of:
responding to an access request of a user, and granting access rights to the user after the user passes the authentication;
The access permission granted by the user is realized by activating the vip, the vip is activated for the user after the main server is started, the vip of other nodes is closed at the same time when the vip is activated by the local server, and when the local service is completely started, the data synchronization service of the local server is started first, and the data synchronization service of other nodes is closed;
Continuously transmitting broadcast information packets to a slave server so as to synchronize data resources of the slave server, wherein the method comprises the following steps:
Based on mysql service and redisservice, sending a broadcast information packet to the slave server according to a first preset time interval through ssh protocol so as to synchronize data resources of the slave server;
when the broadcasting information packet is stopped being sent, setting the slave server as an updated master server through a survival detection mechanism, comprising:
when the broadcast information packet stops being sent and exceeds a second preset time interval, all services are closed;
Setting the slave server as an updated master server through a survival detection mechanism, so that the updated master server responds to an access request of a user;
After the master server and the slave server are replaced, the updated master server executes the vip activating operation to the user;
and receiving the updated broadcast information packet of the main server, and synchronizing data resources.
2. The resource scheduling method for dual standby according to claim 1, wherein after said turning off all services when the transmission of the broadcast packet is stopped beyond the second preset time interval, comprising:
and writing and saving the content to be recorded into a system log according to the logger method.
3. The resource scheduling method suitable for dual hot standby according to any one of claims 1-2, wherein the master server and the slave server are both deployed with a keep component.
4. The resource scheduling method applicable to dual-engine hot standby according to claim 3, wherein the keep component is configured with shell scripts;
The shell script records server resources, service control logic, server environment detection logic, logic for giving up the resources used by the current server and log recording logic.
5. The resource scheduling method applicable to dual-standby according to claim 1, wherein the method comprises, before the user is granted access right after the user passes authentication in response to the access request of the user:
checking whether ssh protocol is supported;
when the ssh protocol is not supported, installing an ssh protocol component;
and detecting the communication condition between the slave server and the ssh key.
6. The resource scheduling method applicable to dual hot standby of claim 5, wherein the installing ssh protocol component comprises:
installing the ssh protocol component through an apt-get source under a ubuntu system; under contos system, the ssh protocol components are installed via yum.
7. A resource scheduling device suitable for dual hot standby, comprising: the system comprises a request response module, a first synchronization module, a node switching module and a second synchronization module;
The request response module is used for responding to an access request of a user and granting access rights to the user after the user passes the verification;
The access permission granted by the user is realized by activating the vip, the vip is activated for the user after the main server is started, the vip of other nodes is closed at the same time when the vip is activated by the local server, and when the local service is completely started, the data synchronization service of the local server is started first, and the data synchronization service of other nodes is closed;
the first synchronization module is configured to continuously send a broadcast packet to a slave server, so that the slave server performs data resource synchronization, and includes:
Based on mysql service and redisservice, sending a broadcast information packet to the slave server according to a first preset time interval through ssh protocol so as to synchronize data resources of the slave server;
The node switching module is configured to set the slave server as an updated master server through a survival detection mechanism when transmission of the broadcast packet is stopped, and includes:
when the broadcast information packet stops being sent and exceeds a second preset time interval, all services are closed;
Setting the slave server as an updated master server through a survival detection mechanism, so that the updated master server responds to an access request of a user;
After the master server and the slave server are replaced, the updated master server executes the vip activating operation to the user;
and the second synchronization module is used for receiving the updated broadcast information packet of the main server and synchronizing data resources.
8. A server system, comprising: a master server and a slave server; the method for scheduling resources for dual-standby according to any one of claims 1 to 6 is performed by the main server.
CN202311045494.0A 2023-08-17 2023-08-17 Resource scheduling method and device suitable for dual-computer hot standby and server system Active CN117033088B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311045494.0A CN117033088B (en) 2023-08-17 2023-08-17 Resource scheduling method and device suitable for dual-computer hot standby and server system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311045494.0A CN117033088B (en) 2023-08-17 2023-08-17 Resource scheduling method and device suitable for dual-computer hot standby and server system

Publications (2)

Publication Number Publication Date
CN117033088A CN117033088A (en) 2023-11-10
CN117033088B true CN117033088B (en) 2024-05-03

Family

ID=88640888

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311045494.0A Active CN117033088B (en) 2023-08-17 2023-08-17 Resource scheduling method and device suitable for dual-computer hot standby and server system

Country Status (1)

Country Link
CN (1) CN117033088B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20030053902A (en) * 2001-12-24 2003-07-02 엘지전자 주식회사 System and method of duplexing database in private branch exchange and telecommunication system and synchronizing method of duplexed server
CN102868560A (en) * 2012-09-28 2013-01-09 南京恩瑞特实业有限公司 System and method for realizing hot standby of servers
CN103744809A (en) * 2013-12-23 2014-04-23 天泽信息产业股份有限公司 Method for dual-computer hot-standby of vehicle information management system on basis of VRRP
CN108390919A (en) * 2018-01-26 2018-08-10 昆明昆船逻根机场物流系统有限公司 A kind of message synchronization system and method for highly reliable two-node cluster hot backup
CN111352995A (en) * 2020-02-25 2020-06-30 中信银行股份有限公司 Server service method, system, device and storage medium based on database Neo4j
CN112860485A (en) * 2021-02-03 2021-05-28 北京北信源信息安全技术有限公司 Control method of dual-computer hot standby system based on keepalived
WO2023125946A1 (en) * 2021-12-31 2023-07-06 贵州白山云科技股份有限公司 User access request processing method and apparatus, device, medium, and product

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20030053902A (en) * 2001-12-24 2003-07-02 엘지전자 주식회사 System and method of duplexing database in private branch exchange and telecommunication system and synchronizing method of duplexed server
CN102868560A (en) * 2012-09-28 2013-01-09 南京恩瑞特实业有限公司 System and method for realizing hot standby of servers
CN103744809A (en) * 2013-12-23 2014-04-23 天泽信息产业股份有限公司 Method for dual-computer hot-standby of vehicle information management system on basis of VRRP
CN108390919A (en) * 2018-01-26 2018-08-10 昆明昆船逻根机场物流系统有限公司 A kind of message synchronization system and method for highly reliable two-node cluster hot backup
CN111352995A (en) * 2020-02-25 2020-06-30 中信银行股份有限公司 Server service method, system, device and storage medium based on database Neo4j
CN112860485A (en) * 2021-02-03 2021-05-28 北京北信源信息安全技术有限公司 Control method of dual-computer hot standby system based on keepalived
WO2023125946A1 (en) * 2021-12-31 2023-07-06 贵州白山云科技股份有限公司 User access request processing method and apparatus, device, medium, and product

Also Published As

Publication number Publication date
CN117033088A (en) 2023-11-10

Similar Documents

Publication Publication Date Title
US11611568B2 (en) Communication protocols over internet protocol (IP) networks
US10992784B2 (en) Communication protocols over internet protocol (IP) networks
US11936786B2 (en) Secure enrolment of security device for communication with security server
US8683033B2 (en) Apparatus, system, and method for server failover to standby server during broadcast storm or denial-of-service attack
TW201802703A (en) Data transmission system, method and device
US20230117962A1 (en) Executable policy declarations for network security
CN101322379A (en) Method and apparatus for providing secure remote access to enterprise networks
US11817971B2 (en) System and method for VNF termination management
CN110462600B (en) System, method and apparatus for networked media distribution
US20140032620A1 (en) Method of sharing data in a home network and apparatus implementing the method
CN117033088B (en) Resource scheduling method and device suitable for dual-computer hot standby and server system
CN115664989A (en) Monitoring system and method of cloud desktop
KR101881061B1 (en) 2-way communication apparatus capable of changing communication mode and method thereof
CN107800715B (en) portal authentication method and access equipment
CN116319274A (en) Method for realizing hot standby of distributed system capable of acquiring current main node
WO2022173244A1 (en) Apparatus and method for high availability of virtual network function
TWI656769B (en) Method for performing wake-up management, and associated apparatus
KR20190106257A (en) Method and Apparatus for Providing Redundancy Service of Network Video Recorder using Cloud
US20080155097A1 (en) Centralized processing system for connect homes devices
US8233386B2 (en) Device that uses parameters to provide multi-channel serial data transmissions and method thereof
WO2023184263A1 (en) Method and apparatus for establishing user datagram protocol (udp) transmission channel
US11916928B2 (en) Communication protocols over internet protocol (IP) networks
US11595248B2 (en) Scalable notification delivery for networked computing environments
KR102041793B1 (en) Push to talk service management system and method for handling faults using duplexing
US11962657B2 (en) Service reachability detection

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
GR01 Patent grant
GR01 Patent grant