CN108924772B - Short message sending method and device, computer equipment and storage medium - Google Patents

Short message sending method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN108924772B
CN108924772B CN201810869938.5A CN201810869938A CN108924772B CN 108924772 B CN108924772 B CN 108924772B CN 201810869938 A CN201810869938 A CN 201810869938A CN 108924772 B CN108924772 B CN 108924772B
Authority
CN
China
Prior art keywords
database
short message
server
data
access
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
CN201810869938.5A
Other languages
Chinese (zh)
Other versions
CN108924772A (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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201810869938.5A priority Critical patent/CN108924772B/en
Publication of CN108924772A publication Critical patent/CN108924772A/en
Application granted granted Critical
Publication of CN108924772B publication Critical patent/CN108924772B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/12Messaging; Mailboxes; Announcements
    • H04W4/14Short messaging services, e.g. short message services [SMS] or unstructured supplementary service data [USSD]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W24/00Supervisory, monitoring or testing arrangements
    • H04W24/04Arrangements for maintaining operational condition
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application relates to a short message sending method and device, computer equipment and a storage medium by utilizing a cache technology. The method comprises the following steps: the method comprises the steps of sending short message data to a first server, detecting whether a first database in the first server is in fault or not, wherein the first database is used for receiving the short message data sent by a short message gateway of the first server, when the first database in the first server is in fault, establishing connection with an access port of a second server, detecting a monitoring state of the first database in the first server, when the first database is monitored normally, detecting a fault type of the first database, and distributing the short message data to the second server through the access port according to the fault type so that the second database of the second server can receive the short message data. By adopting the method, the short message can be sent in time when the first server fails.

Description

Short message sending method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for sending digital short messages, a computer device, and a storage medium.
Background
With the increase of business of enterprises, the dependence on short message sending is increasing day by day. An enterprise sends a short message by adopting a short message platform, firstly, an edited short message is uploaded to a database of a server, then, short message data in the database is sent to a target client through a short message gateway, once the database fails, the short message cannot be sent to the target client in time, usually, a plurality of databases are deployed in the server, during work, only one database works, and once one database fails, other databases are selected to replace and complete a task of sending the short message, which is also called as high availability of the database. However, in some cases, the databases deployed in all nodes in the server may fail, and in this case, the short message of the enterprise may not be sent in time.
Disclosure of Invention
In view of the above, it is necessary to provide a short message sending method, an apparatus, a computer device and a storage medium, which can solve the problem that a short message cannot be sent in time due to a server failure.
A short message sending method comprises the following steps:
sending short message data to a first server;
detecting whether a first database in a first server fails, wherein the first database is used for receiving short message data sent by a short message gateway of the first server;
when a first database in a first server fails, establishing connection with an access port of a second server;
detecting a listening state of a first database in the first server;
when the monitoring of the first database is normal, detecting the fault type of the first database, and distributing the short message data to a second server through the access port according to the fault type so that the second database of the second server receives the short message data.
In one embodiment, the method further comprises the following steps: acquiring a log file of a first database in a first server, wherein the log file is used for recording the working state information of the first database; and obtaining the monitoring state of the first database according to the working state information output by the log file.
In one embodiment, the method further comprises the following steps: when the log file outputs abnormal working state information, switching an access port from a first server to a second server; and receiving the short message data through a second database of the second server.
In one embodiment, the method further comprises the following steps: sending continuous data access requests of a first database to a first server, and receiving feedback data of the first server responding to the data access requests; and determining the fault type of the first database according to the time interval for sending the data access request and receiving the feedback data.
In one embodiment, the fault types include: access exception, slow access, and normal access, further comprising: when the access is abnormal, all the short message data are sent to the second server through the access port; when the access is slow, distributing a part of the short message data to a second server through an access port; when the access is normal, whether short message data to be sent in the first database exceeds a threshold value is detected, and if yes, a part of the short message data is distributed to the second server through the access port.
In one embodiment, the second database comprises: the REDIS database, further comprising: acquiring a short message serial number, operator response data, a response data serial number and a short message status report in the REDIS database; taking the short message to be sent in the REDIS database as a value, taking the serial number of the short message as a key value, and storing the key-value in the REDIS database; the operator response data is used as a value, the short message serial number and the response data serial number are used as key values, and the key-value mode is stored in the REDIS database; and taking the short message status report as a value, taking the response data stream number as a key value, and storing the response data stream number in a REDIS database in a key-value mode.
In one embodiment, the first database comprises: the ORACLE database, further comprising: monitoring whether the fault of the ORACLE database is recovered; if yes, inquiring the short message serial number in the key value of the REDIS database, and synchronizing the short message to be sent in the REDIS database to the ORACLE database; inquiring the short message serial number and the response data serial number in the key value of the REDIS database, and synchronizing the operator response data in the REDIS database to the ORACLE database; and inquiring the serial number of the response data in the key value of the REDIS database, and synchronizing the short message status report in the REDIS database to the ORACLE database.
A short message sending device, the device comprising:
the detection module is used for sending short message data to the first server and detecting whether a first database in the first server breaks down, wherein the first database is used for receiving the short message data sent by a short message gateway of the first server;
the connection module is used for establishing connection with an access port of a second server when a first database in the first server fails;
the monitoring detection module is used for detecting the monitoring state of a first database in the first server;
and the sending module is used for detecting the fault type of the first database when the monitoring of the first database is normal, and distributing the short message data to a second server through the access port according to the fault type so as to enable the second database of the second server to receive the short message data.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
sending short message data to a first server;
detecting whether a first database in a first server fails, wherein the first database is used for receiving short message data sent by a short message gateway of the first server;
when a first database in a first server fails, establishing connection with an access port of a second server;
detecting a listening state of a first database in the first server;
when the monitoring of the first database is normal, detecting the fault type of the first database, and distributing the short message data to a second server through the access port according to the fault type so that the second database of the second server receives the short message data.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
sending short message data to a first server;
detecting whether a first database in a first server fails, wherein the first database is used for receiving short message data sent by a short message gateway of the first server;
when a first database in a first server fails, establishing connection with an access port of a second server;
detecting a listening state of a first database in the first server;
when the monitoring of the first database is normal, detecting the fault type of the first database, and distributing the short message data to a second server through the access port according to the fault type so that the second database of the second server receives the short message data.
When the terminal sends the short message data to the first server, whether the first database in the first server has a fault is detected, the first database is used for receiving the short message data sent by the short message gateway of the first server, when the fault of the first database in the first server is detected, connection between the first database and an access port of the second server is established, the monitoring state of the first database in the first server is detected, when the monitoring of the first server is normal, the fault type of the first database is detected, and the short message data is distributed to the second server through the access port according to the fault type, so that the second database of the second server receives the short message data. According to the embodiment of the invention, the fault type of the first database is judged by detecting the state of the first database in the first server, and the short message is sent by using the second server according to the fault type, so that the problem that the short message cannot be sent in time due to the fault of the server is solved.
Drawings
Fig. 1 is an application scenario diagram of a short message sending method in an embodiment;
fig. 2 is a schematic flow chart of a short message sending method in an embodiment;
FIG. 3 is a flow chart illustrating a short message sending step according to another embodiment;
FIG. 4 is a flowchart illustrating the steps of detecting a first database fault type in one embodiment;
FIG. 5 is a block diagram of an embodiment of a short message sending apparatus;
FIG. 6 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The short message sending method provided by the application can be applied to the application environment shown in fig. 1. The terminal 102 communicates with a first server 104 and a second server 106 via a network. The terminal 102 may be, but is not limited to, various personal computers, notebook computers, smart phones, and tablet computers, and the first server 104 and the second server 106 may be implemented by independent servers or a server cluster formed by a plurality of servers.
The first server 104 may include more than one database, the database includes a first database, and a node for deploying the database is set in the first server 104, so as to implement high availability of the database, and in this application scenario, the first database is a master database for implementing a data storage function of the first server 104. The corresponding second server 106 may include more than one database, the database includes a second database, and a node for deploying the database is provided in the second server 106, so as to achieve high availability of the database, and in this application scenario, the second database is a main database.
Further, the first server 104 and the second server 106 are both components of a short message platform, the short message platform further includes a short message gateway, when the short message platform works normally, the terminal 102 edits short message data, sends the short message data to the first server 104, stores the short message data through the first database, and the short message gateway takes out the short message data from the first database to send a short message.
Further, when a failure of the first database in the first server 104 is detected, the problem that the original database is high available and cannot be used for sending a short message is solved, at this time, the monitoring state of the first database in the first server 104 is detected, and specifically, the monitoring state of the first database can be detected to be normal monitoring or abnormal monitoring, and when the monitoring is abnormal, the first database cannot be accessed, so that the second server can be used for sending a short message instead of the first server, and when the monitoring is normal, an interface connection with the second server needs to be established, specifically, the short message platform can access the second database in the second server. And the second server shares the short message sending task to different degrees according to different fault types, so that the short message data can be sent in time.
In an embodiment, as shown in fig. 2, a method for sending a short message is provided, which is described by taking the method as an example applied to the terminal in fig. 1, and includes the following steps:
step 202, sending short message data to a first server, and detecting whether a first database in the first server fails, wherein the first database is used for receiving the short message data sent by a short message gateway of the first server.
When the terminal sends the short message data to the first server and detects a short message sending fault, whether the database in the first server has a fault or not is detected, wherein the fault is divided into a first database fault and all databases have faults, and when the first database has a fault, other databases can be selected as main databases through a high availability function, so that the fault of the first server is repaired. However, when all databases fail, the database cannot be repaired by the high availability function, and at this time, the monitoring state of the first database in the first server needs to be detected.
Step 204, when the first database in the first server fails, establishing a connection with an access port of the second server.
In the step, the terminal establishes access connection with a second server to indicate that the short message data in the terminal can be sent to the second server.
When the first server is normal and does not participate in the task of sending the short message, the second server establishes port connection between the terminal and the second server when monitoring that the first database in the first server is in fault, the port connection indicates that the short message data in the terminal can be sent to the second server, and the short message data is stored in the second database.
Step 206, a listening status of a first database in a first server is detected.
The snoop status is divided into snoop normal and snoop abnormal, and in general, the snoop status is the basis for whether the database is available, for example: when the first database monitors the abnormity, the first database can be judged to be unavailable; when the first database is monitored normally, the first database is judged to be accessible and does not indicate that no fault exists.
Further, a monitoring process may be set in the server, for example, the monitoring process is set in the first server, the monitoring process outputs the real-time monitoring working state of the server through a log file, and the monitoring state of the database may be obtained by looking up the log file.
It should be noted that the first database is a main database of the first server, and when the first server works normally, the first server is responsible for the task of sending the short message, so that the first database corresponds to the short message gateway of the first server.
And 208, when the monitoring of the first database is normal, detecting the fault type of the first database, and distributing the short message data to the second server through the access port according to the fault type so that the second database of the second server receives the short message data.
The embodiment of the invention comprises a plurality of fault types, the fault types can be determined according to the influence of the fault on the short message sending speed, and the distribution amount of the short message data is different when the short message data is distributed according to different fault types.
It should be noted that, the distribution through the access port means that the short message data is sent to the first server, and also sent to the second server, and the short message data is sent through the first server and the second server.
According to the short message sending method, when the terminal sends short message data to the first server, whether a first database in the first server breaks down or not is detected, the first database is used for receiving the short message data sent by a short message gateway of the first server, when the first database in the first server breaks down, connection between the first database and an access port of the second server is established, the monitoring state of the first database in the first server is detected, when the first server monitors normally, the fault type of the first database is detected, and the short message data is distributed to the second server through the access port according to the fault type, so that the second database of the second server receives the short message data. According to the embodiment of the invention, the fault type of the first database is judged by detecting the state of the first database in the first server, and the short message is sent by using the second server according to the fault type, so that the problem that the short message cannot be sent in time due to the fault of the server is solved.
In an embodiment, a short message sending method in another embodiment is provided, as shown in fig. 3, specifically as follows:
step 302, sending short message data to the first server, and detecting whether the first database in the first server is in failure.
Step 304, when the first database in the first server fails, a connection with an access port of the second server is established.
Step 306, acquiring a log file of a first database in a first server, wherein the log file is used for recording the working state information of the first database; and obtaining the monitoring state of the first database according to the working state information output by the log file.
Furthermore, the first database corresponds to the short message gateway of the first server, and the short message gateway of the first server fetches and sends the data from the first database.
In another embodiment, the terminal issues an instruction for generating a task process to the first server, so that a monitoring process is generated in the first server, the monitoring process monitors the working state of the first database in real time, and then records the working state information of the first database in a log file.
Further, the listening state includes: and when the log file outputs the working state information of the first database to be normal, the monitoring of the first database is normal. When the working state information of the first database output by the log file is abnormal, the monitoring of the first database is abnormal at the moment.
Specifically, the monitoring process monitors the working state of the first database, and may send an access instruction to the first server, and if the feedback instruction cannot be received, it indicates that the first database cannot be accessed, and records that the working state of the first database is abnormal.
And 308, when the monitoring of the first database is normal, detecting the fault type of the first database, distributing the short message data to the second server through the access port according to the fault type, and receiving the short message data through the second database of the second server.
In the embodiment of the invention, whether the monitoring of the first database is normal is determined through the output result of the log file, and then the short message data can be distributed through the second server when the monitoring is detected to be normal.
In another embodiment, when monitoring abnormality is detected, that is, the log file outputs abnormal working state information, at this time, the first database cannot be accessed, and the short message gateway cannot take out the short message data from the first database, so that it is necessary to switch the access port from the first server to the second server, and to correspond the second database in the second server to the short message gateway of the first server.
Further, the output result of the log file may correspond to a switch program, the input of the switch program is the output of the log file, and when the log file outputs abnormal working state information, the switch program correspondingly executes a switching operation, specifically, the access interface of the short message gateway is switched from the first database to the second database, and the access interface is switched from the first database to the second database. Therefore, when the first database fails, the failure is automatically processed.
Due to the generation of the partial fault, the first database cannot be completely accessed, and the partial fault cannot be monitored through the monitoring process.
In an embodiment, for the above partial failure, a schematic flowchart of the step of detecting the failure type of the first database in an embodiment is provided, as shown in fig. 4, specifically as follows:
step 402, sending consecutive data access requests of the first database to the first server.
The terminal can send a first database data access request to the first server through the access port, and if the access is successful, feedback data sent by the first server is received.
Step 404, receiving feedback data of the first server responding to the data access request.
In one embodiment, the step of sending consecutive data access requests may be: and sending a first data access request to the first server, if the feedback data is received within the time threshold, sending a second data access request to the first server again, and if the feedback data is not received within the time threshold, sending a second database access request to the first server again, so as to send continuous data request instructions to the first server. The embodiment of the invention improves the detection accuracy by continuously sending the data request instruction.
Step 406, determining a failure type of the first database according to the time interval between sending the data access request and receiving the feedback data.
In an embodiment, if the feedback data is received within the time threshold, the time interval between sending the data access request and receiving the feedback data is recorded, and if the feedback data is not received within the time threshold, the time interval between sending the data access request and receiving the feedback data is recorded as the size of the time threshold.
In another embodiment, the failure type of the first database may be determined according to the time interval, and the failure type may be classified as access abnormal, access slow, and access normal. And if the received feedback data is in the normal time delay after the data access request is sent, judging that the fault type is normal access. When the time interval is smaller than the time threshold, judging that the access is slow; and judging that the access is abnormal when the time interval is equal to the time threshold.
Specifically, in order to improve the accuracy of the determination, the determination logic of the fault type is set to determine that the access is abnormal only if the time interval detected for a plurality of consecutive times is equal to the time threshold, and similarly, if the time interval detected for a plurality of consecutive times is equal to the time threshold, the access is slow.
In an embodiment, the short message data can be distributed to the first server and the second server through the access port according to the fault type in the following manner: when the access is abnormal, all the short message data are sent to the second server through the access port; when the access is slow, distributing a part of the short message data to a second server through an access port; when the access is normal, whether short message data to be sent in the first database exceeds a threshold value is detected, and if yes, a part of the short message data is distributed to the second server through the access port.
In this embodiment, different processing strategies may be correspondingly set by determining different fault types. When the first database fails, the sending rate of the short message is influenced, and the short message sending is influenced differently by the failures in different degrees. Therefore, by judging different types of faults, the corresponding fault processing strategy is set advantageously.
Specifically, when the access is abnormal, the short message data in the terminal cannot be sent to the first database, so that the short message data needs to be stored in the second database to realize the short message sending. When the access is slow, the speed of writing the short message data into the first database cannot meet the requirement of sending the short message, so that the second database is required to receive all the short message data sent by the terminal. And when the fault type is judged to be slow in access, after the port connection between the terminal and the second server needs to be established at the access port, distributing part of the short messages to the second database. When the fault type is judged to be access normal, the fault of short message sending is possibly temporary, at this time, whether short message data to be sent in the first database exceeds a threshold value needs to be considered, and if yes, a part of the short message data is distributed to the second server through the access port.
In this embodiment, when the access is normal, the failure reason may be caused by an excessively large amount of short message data in the first database, and therefore, the number of short message data to be sent in the first database needs to be detected, and when the number of short message data to be sent exceeds a threshold, the short message data can be shunted through the second database, so that the short message sending efficiency is improved, and the short message can be sent in time.
When the fault type is judged to be normal access, port connection between the first server and the second server can be established, and then short message data overflowing from the first database is synchronized into the second database, so that the first database is shunted.
In another embodiment, when the access is slow, a corresponding distribution policy may be set, and specifically, the distribution level is set correspondingly according to the length of the interval time.
Specifically, the time threshold is 10s, the allowed delay is 1s, and the interval time can be divided into three levels, namely (1, 4) low delay, (4, 7) medium delay and (7, 10) high delay, corresponding to the low delay, the distribution policy is set to distribute the short message data traffic in the access port to the second database according to 1/4, corresponding to the medium delay, the distribution strategy is set to be distributed to the second database according to 1/2 of short message data traffic in the access port, the distribution policy is set to distribute 3/4 according to the short message data traffic in the access port to the second database, corresponding to high latency, hi this embodiment, the threshold time, the allowed time delay and each interval time interval are all applied in a practical scene, in other application conditions, the setting can be performed according to actual requirements, and is not limited to the specifically set value in the embodiment.
In an embodiment, the first database may be an ORACLE database, the first server has a configuration environment of the ORACLE database deployed therein, the second database may be a REDIS database, and the second server has a configuration environment of the REDIS database deployed therein. The second server is independent of the first server. In one short message platform, the first server is a main server and is responsible for functions of sending, recording, inquiring and the like of short messages in the short message platform, and because the second server is independent of the first server, short messages sent by the second server, received records and the like need to be synchronized to the first server, so that data in the short message platform can be checked.
In one embodiment, in order to realize the short message search in the short message platform, the short message serial number, the operator response data, the response data serial number and the short message status report in the REDIS database can be acquired; taking the short message to be sent in the second short message database as a value, taking the short message serial number as a key value, and storing the short message serial number in the second database in a key-value mode; the operator response data is used as a value, the short message serial number and the response data serial number are used as key values, and the key-value mode is stored in a second database; and taking the short message status report as a value, taking the response data stream number as a key value, and storing the response data stream number in a second database in a key-value mode.
In this embodiment, the serial number of the short message refers to the unique number corresponding to each short message, the terminal automatically generates the serial number when outputting the short message, and the serial number of each short message is recorded in the second database. The operator response data represents data sent by the operator in response to the received short messages, correspondingly, the operator can feed back a serial number of the response data aiming at the operator response data, and in addition, the operator can feed back a short message status report aiming at each short message.
In an embodiment, the REDIS database may store data in a key-value storage manner, so that short message data input through an access port is obtained first, a short message serial number of each short message is obtained, the short message serial number is used as a key value, the short message data is stored as a value, when the short message is sent, the corresponding value is queried through the key value, thereby completing sending the short message, correspondingly, when operator response data of an operator is received, the short message serial number and the response data serial number are used as the key value, the operator response data is stored in the REDIS database as the value, when a short message status report fed back by the operator is received, the corresponding response data serial number is queried and the response data serial number is used as the key value, and the short message status report is stored in the REDIS database as the value.
Further, when the first database is recovered to be normal, the data in the REDIS database needs to be synchronized into the ORACLE database, and the data in the REDIS database can be correspondingly synchronized into the ORACLE database by querying the key value, where first, the data needing to be synchronized includes: short message data to be sent, operator response data, a short message status report and a user reply short message. For the synchronization of the short message data to be sent, the short message serial number in the key value can be inquired, and the synchronization of the short message data to be sent is carried out. For the synchronization of the operator response data, the short message serial number and the response data serial number in the key value can be inquired, the operator response data in the value can be inquired, and then the operator response data in the REDIS database can be synchronized into the ORACLE database. For the short message status report, the response data serial number in the key value can be inquired, the short message status report in the value is inquired, and then the short message status report in the REDIS database is synchronized to the ORACLE database. For the user reply short message, the short message can be directly synchronized from the REDIS database.
It should be understood that although the various steps in the flow charts of fig. 2-4 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2-4 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternating with other steps or at least some of the sub-steps or stages of other steps.
In one embodiment, as shown in fig. 5, there is provided a short message sending apparatus, including: a detection module 502, a connection module 504, a listening detection module 506, and a sending module 508, wherein:
the detection module 502 is configured to send short message data to the first server, and detect whether a first database in the first server fails, where the first database is configured to receive the short message data sent by the short message gateway of the first server.
A connection module 504, configured to establish a connection with an access port of a second server when the first database in the first server fails.
A snoop detection module 506, configured to detect a snoop status of the first database in the first server.
The sending module 508 is configured to detect a fault type of the first database when the first database is monitored normally, and distribute the short message data to the second server through the access port according to the fault type, so that the second database of the second server receives the short message data.
In one embodiment, the monitoring detection module 506 is further configured to obtain a log file of a first database in the first server, where the log file is used to record the working state information of the first database; and obtaining the monitoring state of the first database according to the working state information output by the log file.
In one embodiment, the monitoring detection module 506 is further configured to switch the access port from the first server to the second server when the log file outputs abnormal working state information; and receiving the short message data through a second database of the second server.
In one embodiment, the sending module 508 is further configured to send consecutive data access requests of the first database to the first server, and receive feedback data of the first server responding to the data access requests; and determining the fault type of the first database according to the time interval for sending the data access request and receiving the feedback data.
In one embodiment, the fault types include: the sending module 508 is further configured to send all the short message data to the second server through the access port when the access is abnormal; when the access is slow, distributing a part of the short message data to a second server through an access port; when the access is normal, whether short message data to be sent in the first database exceeds a threshold value is detected, and if yes, a part of the short message data is distributed to the second server through the access port.
In one embodiment, the second database comprises: the REDIS database also comprises a data synchronization module which is used for acquiring the short message serial number, the operator response data, the response data serial number and the short message status report in the REDIS database; taking the short message to be sent in the REDIS database as a value, taking the serial number of the short message as a key value, and storing the key-value in the REDIS database; the operator response data is used as a value, the short message serial number and the response data serial number are used as key values, and the key-value mode is stored in the REDIS database; and taking the short message status report as a value, taking the response data stream number as a key value, and storing the response data stream number in a REDIS database in a key-value mode.
In one embodiment, the first database comprises: the ORACLE database, the data synchronization module is also used for monitoring whether the fault of the ORACLE database is recovered; if yes, inquiring the short message serial number in the key value of the REDIS database, and synchronizing the short message to be sent in the REDIS database to the ORACLE database; inquiring the short message serial number and the response data serial number in the key value of the REDIS database, and synchronizing the operator response data in the REDIS database to the ORACLE database; and inquiring the serial number of the response data in the key value of the REDIS database, and synchronizing the short message status report in the REDIS database to the ORACLE database.
For specific limitations of the short message sending apparatus, reference may be made to the above limitations on the short message sending method, which is not described herein again. All modules in the short message sending device can be completely or partially realized through software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in fig. 6. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a short message sending method.
In one embodiment, a computer device is provided, comprising a memory storing a computer program and a processor implementing the steps of the above-described method embodiments when the processor executes the computer program.
In an embodiment, a computer-readable storage medium is provided, on which a computer program is stored, which computer program, when being executed by a processor, carries out the steps of the respective method embodiment as described above.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A short message sending method comprises the following steps:
sending short message data to a first server;
detecting whether a first database in a first server fails, wherein the first database is used for receiving short message data sent by a short message gateway of the first server;
when detecting that a first database in a first server fails, establishing connection with an access port of a second server;
detecting a listening state of a first database in the first server;
when the monitoring of the first database is detected to be normal, detecting the fault type of the first database, and distributing the short message data to a second server through the access port according to the fault type so that the second database of the second server receives the short message data;
the fault types include: abnormal access, slow access and normal access;
the distributing the short message data to a second server through an access port according to the fault type comprises the following steps:
when the access is abnormal, all the short message data are sent to the second server through the access port;
when the access is slow, distributing a part of the short message data to a second server through an access port;
when the access is normal, whether short message data to be sent in the first database exceeds a threshold value is detected, and if yes, a part of the short message data is distributed to the second server through the access port.
2. The method of claim 1, wherein detecting the listening status of the first database in the first server comprises:
acquiring a log file of a first database in a first server, wherein the log file is used for recording the working state information of the first database;
and obtaining the monitoring state of the first database according to the working state information output by the log file.
3. The method of claim 2, further comprising:
when the log file outputs abnormal working state information, switching an access port from a first server to a second server; and receiving the short message data through a second database of the second server.
4. The method of claim 1, wherein detecting the type of failure of the first database comprises:
sending continuous data access requests of a first database to a first server, and receiving feedback data of the first server responding to the data access requests;
and determining the fault type of the first database according to the time interval for sending the data access request and receiving the feedback data.
5. The method of claim 1, wherein the first database corresponds to a short message gateway of a first server, and the short message gateway of the first server fetches and sends the data from the first database.
6. The method according to any one of claims 1 to 5, wherein the second database comprises: a REDIS database;
the method further comprises the following steps:
acquiring a short message serial number, operator response data, a response data serial number and a short message status report in the REDIS database;
taking the short message to be sent in the REDIS database as a value, taking the serial number of the short message as a key value, and storing the key-value in the REDIS database;
the operator response data is used as a value, the short message serial number and the response data serial number are used as key values, and the key-value mode is stored in the REDIS database;
and taking the short message status report as a value, taking the response data stream number as a key value, and storing the response data stream number in a REDIS database in a key-value mode.
7. The method of claim 6, wherein the first database comprises: an ORACLE database; the method further comprises the following steps:
monitoring whether the fault of the ORACLE database is recovered;
if yes, inquiring the short message serial number in the key value of the REDIS database, and synchronizing the short message to be sent in the REDIS database to the ORACLE database;
inquiring the short message serial number and the response data serial number in the key value of the REDIS database, and synchronizing the operator response data in the REDIS database to the ORACLE database;
and inquiring the serial number of the response data in the key value of the REDIS database, and synchronizing the short message status report in the REDIS database to the ORACLE database.
8. A short message sending device, characterized in that the device comprises:
the detection module is used for sending short message data to the first server and detecting whether a first database in the first server breaks down, wherein the first database is used for receiving the short message data sent by a short message gateway of the first server;
the connection module is used for establishing connection with an access port of a second server when a first database in the first server fails;
the monitoring detection module is used for detecting the monitoring state of a first database in the first server;
the sending module is used for detecting the fault type of the first database when the monitoring of the first database is normal, and distributing the short message data to the second server through the access port according to the fault type so as to enable the second database of the second server to receive the short message data; the fault types include: abnormal access, slow access and normal access; the distributing the short message data to a second server through an access port according to the fault type comprises the following steps: when the access is abnormal, all the short message data are sent to the second server through the access port; when the access is slow, distributing a part of the short message data to a second server through an access port; when the access is normal, whether short message data to be sent in the first database exceeds a threshold value is detected, and if yes, a part of the short message data is distributed to the second server through the access port.
9. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN201810869938.5A 2018-08-02 2018-08-02 Short message sending method and device, computer equipment and storage medium Active CN108924772B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810869938.5A CN108924772B (en) 2018-08-02 2018-08-02 Short message sending method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810869938.5A CN108924772B (en) 2018-08-02 2018-08-02 Short message sending method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN108924772A CN108924772A (en) 2018-11-30
CN108924772B true CN108924772B (en) 2021-12-03

Family

ID=64393132

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810869938.5A Active CN108924772B (en) 2018-08-02 2018-08-02 Short message sending method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN108924772B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110955647A (en) * 2019-12-04 2020-04-03 世纪龙信息网络有限责任公司 Database assistance method, database assistance device, computer equipment and storage medium
CN112363865A (en) * 2020-10-19 2021-02-12 深圳云天励飞技术股份有限公司 Database fault recovery method and device and face image search system
CN114390454A (en) * 2020-10-22 2022-04-22 中兴通讯股份有限公司 Message transmission method, system, electronic device and storage medium

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN201497981U (en) * 2009-04-30 2010-06-02 升东网络科技发展(上海)有限公司 Database failure automatic detecting and shifting system
US9204269B1 (en) * 2012-07-02 2015-12-01 CSC Holdings, LLC Method and system for service continuity, network preference, and reporting logic with SMS services
CN103019875B (en) * 2012-12-19 2015-12-09 北京世纪家天下科技发展有限公司 The method of the two main transformation of a kind of fulfillment database and device
CN105554712B (en) * 2015-09-25 2019-04-12 宇龙计算机通信科技(深圳)有限公司 A kind of SMS processing method and user terminal
CN106126652B (en) * 2016-06-24 2019-03-15 武汉斗鱼网络科技有限公司 Mishap Database switching method and system for distributed experiment & measurement system
CN106294795A (en) * 2016-08-15 2017-01-04 合肥华凌股份有限公司 A kind of data base's changing method and system
CN108337275A (en) * 2017-01-19 2018-07-27 百度在线网络技术(北京)有限公司 Task distribution method, device and equipment for Distributor
CN107066354B (en) * 2017-04-18 2021-01-05 中国银联股份有限公司 Database switching method, master server and slave server
CN108234191A (en) * 2017-05-31 2018-06-29 深圳市创梦天地科技有限公司 The management method and device of cloud computing platform

Also Published As

Publication number Publication date
CN108924772A (en) 2018-11-30

Similar Documents

Publication Publication Date Title
CN109522287B (en) Monitoring method, system, equipment and medium for distributed file storage cluster
CN108924772B (en) Short message sending method and device, computer equipment and storage medium
CN108710673B (en) Method, system, computer device and storage medium for realizing high availability of database
EP3617886B1 (en) Hot backup system, hot backup method, and computer device
WO2020125389A1 (en) Image file acquisition method, apparatus, computer device and storage medium
CN108897638B (en) Data backup method and device, computer equipment and storage medium
CN108897658B (en) Method and device for monitoring master database, computer equipment and storage medium
CN108322533A (en) Configuration and synchronization method between distributed type assemblies node based on operation log
CN110995468A (en) System fault processing method, device, equipment and storage medium of system to be analyzed
CN108965383B (en) File synchronization method and device, computer equipment and storage medium
CN108388478B (en) Log data processing method and system
CN108834086B (en) Method and device for sending short message, computer equipment and storage medium
CN111818159A (en) Data processing node management method, device, equipment and storage medium
CN106452836B (en) main node setting method and device
CN109460252B (en) Configuration file processing method and device based on git and computer equipment
CN112866408B (en) Service switching method, device, equipment and storage medium in cluster
CN110674149B (en) Service data processing method and device, computer equipment and storage medium
CN111198921A (en) Database switching method and device, computer equipment and storage medium
CN115297124A (en) System operation and maintenance management method and device and electronic equipment
CN110149421B (en) Method, system and device for monitoring abnormity of domain name system and computer equipment
CN112070585A (en) Order state unified management method and device, computer equipment and storage medium
WO2024078015A1 (en) Fault injection method and apparatus based on mirror image pair, and device and storage medium
CN113439424B (en) Establishing a blockchain having blocks including an adjustable number of transaction blocks and a plurality of intermediate blocks
CN111934909B (en) Main-standby machine IP resource switching method, device, computer equipment and storage medium
CN111338848B (en) Failure application copy processing method and device, computer equipment and storage medium

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