A kind of server key message timed backup method and device
Technical field
The present invention relates to server admin technical field, especially a kind of server key message timed backup method and dress
It sets.
Background technique
Currently, the maintenance work of server generally comprised timed backup this, but the service for enterprises
Device, there are no the universal methods and process of a kind of timed backup for taking into account practicability and safety.When backup information is stored in this
When ground physical machine, although protecting server key message to a certain extent, does not ensure that and restore clothes at the first time
The normal function of business device.
Summary of the invention
The object of the present invention is to provide a kind of server key message timed backup method and devices, for server key
Information back-up proposes a kind of practicable universal method and more complete normal process, reduces a large amount of standby of daily repeatability
Part occupies too many system resource and efficiency.
To achieve the above object, the present invention adopts the following technical solutions:
First aspect present invention provides a kind of server key message timed backup method, comprising the following steps:
Monitoring server third party's component ports flow information;
Sequence is updated to third party's component weights according to port flow information;
Strange land data redundancy backup is carried out to the file comprising key message.
With reference to first aspect, in a first possible implementation of that first aspect, described according to port flow information pair
Third party's component weights are updated sequence, specifically include:
Third party's component ports weight initial value is set;
It is periodically ranked up according to the flow sequence descending to port, updates corresponding weighted value;
Daily set time point is ranked up according to current third party component ports weighted value.
With reference to first aspect, in a second possible implementation of that first aspect, the periodicity is according to flow opposite end
The descending sequence of mouth is ranked up, and is updated corresponding weighted value, is specifically included:
When port flow is 0, weight is constant;To 1-3 components of flow sequence, weighted value increases separately 1;To flow
The component of sequence 4-6, weighted value increase separately 0.5;To 7-10 components of flow sequence, weighted value increases separately 0.3;It is right
Other port flows are not 0 component, and weight increases by 0.1.
With reference to first aspect, in first aspect in the third possible implementation, the described pair of text comprising key message
Part carries out strange land data redundancy backup and specifically includes:
Local directory is packed into the third party's component profile and same day log of customized quantity, in database
Hold, critical file directory content is packed into local directory, and generates compressed file;
Compressed file is passed through to particular account number respectively and is uploaded to two non-local physical machines;
Local backup file directory is emptied every other week.
With reference to first aspect, described to data-base content, crucial text in the 4th kind of possible implementation of first aspect
Part directory content is packed into local directory, specifically includes:
It checks server database log, if read operation only occurred, data-base content is not backed up, otherwise,
Data-base content is carried out to be packed into local directory;
Safety inspection is carried out to the critical file catalogue that the server user end same day uploads, is packed into local directory, if going out
Existing illegal file format stops backing up the catalogue.
Second aspect of the present invention provides a kind of server key message timed backup device, comprising:
Port flow monitoring modular, monitoring server third party's component ports flow information;
Weight update module is updated sequence to third party's component weights according to port flow information;
Redundancy backup module carries out strange land data redundancy backup to the file comprising key message.
The server key message timed backup device of second aspect of the present invention realizes first aspect and first aspect
Each implementation in method, and obtain identical effect.
The effect provided in summary of the invention is only the effect of embodiment, rather than invents all whole effects, above-mentioned
A technical solution in technical solution have the following advantages that or the utility model has the advantages that
The present invention also realizes data redundancy while local backup, to key message file, to further increase data
Safety and guarantee data integrality, prevent Single Point of Faliure.By increasing the mechanism of third party's component weights training, reduce
The too many system resource of a large amount of backups occupancy and efficiency of daily repeatability, only take preceding 10 or 15 module configuration information and ought be everyday
Will is backed up, and the time cost of backup is greatly saved, so that daily back-up job is more reasonable.The transmission mode of ftp, both
It ensure that the permission that can control upload user, the i.e. safety of data, be very easy to realize simultaneously as building ftp, guarantee
The efficiency that data upload.Daily timed backup, even more ensure that can in time orientation problem, solve the problems, such as, guarantee server
Normal operation.Realize taking into account for efficiency and safety.
Detailed description of the invention
Fig. 1 is the method for the present invention flow diagram;
Fig. 2 is two method flow diagram of the embodiment of the present invention;
Fig. 3 is three method flow diagram of the embodiment of the present invention;
Fig. 4 is schematic structural diagram of the device of the invention.
Specific embodiment
In order to clarify the technical characteristics of the invention, below by specific embodiment, and its attached drawing is combined, to this hair
It is bright to be described in detail.Following disclosure provides many different embodiments or example is used to realize different knots of the invention
Structure.In order to simplify disclosure of the invention, hereinafter the component of specific examples and setting are described.In addition, the present invention can be with
Repeat reference numerals and/or letter in different examples.This repetition is that for purposes of simplicity and clarity, itself is not indicated
Relationship between various embodiments and/or setting is discussed.It should be noted that illustrated component is not necessarily to scale in the accompanying drawings
It draws.Present invention omits the descriptions to known assemblies and treatment technology and process to avoid the present invention is unnecessarily limiting.
As shown in Figure 1, first aspect present invention provides a kind of server key message timed backup method, including following
Step:
S1, monitoring server third party's component ports flow information;
S2, sequence is updated to third party's component weights according to port flow information;
S3, strange land data redundancy backup is carried out to the file comprising key message.
In step S1, third party's component well known port and configuration file summarize:
HTTP (Apache/Nginx) default port number are as follows: 80;Configuration file: httpd.conf/nginx.conf
Tomcat default port number are as follows: 8080;Configuration file: server.xml, tomcat-users.xml, web.xml,
context.xml
Openssl default port number are as follows: 443;Configuration file: openssl.cnf
Mysql default port number are as follows: 3306;Configuration file: my.cnf
Oracle default port number are as follows: 1521;Configuration file: tnsnames.ora
DB2 default port number are as follows: 5000;Configuration file: (database parameter configuration file uses get db to SQLDBCONF
Cfg/update db cfg is read and modification data.)
PostgreSQL default port number are as follows: 5432;Configuration file: postgresql.conf
Rabbitmq default port number are as follows: 15672;Configuration file: rabbitmq.config
Openssh default port number are as follows: 22;Configuration file: sshd_config
Telnet default port number are as follows: 23;Configuration file :/etc/xinetd.d/telnet
Snmp default port number are as follows: UDP161;Configuration file: snmpd.conf
Kvm default port number are as follows: 7578/7582 (ssl);Configuration file :/etc/libvirt/qemu/
Port and third party's component can be added as needed.
As shown in Fig. 2, in step s 2, being updated sequence to third party's component weights according to port flow information, have
Body includes:
S21, third party's component ports weight initial value are set as 5;
S22, it is periodically ranked up according to the flow sequence descending to port, updates corresponding weighted value;
S23,3 points of daily morning be ranked up according to current third party component ports weighted value.
In step S22, periodically it is ranked up according to the flow sequence descending to port, updates corresponding weight number
Value, specifically includes:
When port flow is 0, weight is constant;To 1-3 components of flow sequence, weighted value increases separately 1;To flow
The component of sequence 4-6, weighted value increase separately 0.5;To 7-10 components of flow sequence, weighted value increases separately 0.3;It is right
Other port flows are not 0 component, and weight increases by 0.1.
As shown in figure 3, in step s3, carrying out strange land data redundancy backup to the file comprising key message and specifically wrapping
It includes:
S31, local directory bkup, logarithm are packed into third party's component profile of customized quantity and same day log
It is packed into local directory, and generates compressed file according to library content, critical file directory content.Compressed file is named as bkup%
Y%m%d.tar (%y%m%d is the date, and format is the date);
S32, it compressed file is passed through to particular account number is respectively uploaded to two non-local physical machines.Pass through specific ftp account
Number ftpuser1 is uploaded in bkup%y%m%d.tar to non-physical machine A;It is uploaded by specific ftp account ftpuser2
In bkup%y%m%d.tar to non-physical machine B;
S33, local backup file directory is emptied every other week.
In step S31, local directory is packed into data-base content, critical file directory content, is specifically included:
S311, it checks server database log, if read operation only occurred, data-base content is not backed up,
Otherwise, data-base content is carried out being packed into local directory;
S312, safety inspection is carried out to the critical file catalogue that the server user end same day uploads, is packed into local directory,
If there is illegal file format, stop backing up the catalogue.
As shown in figure 4, server key message timed backup device, comprising:
Port flow monitoring modular 11, monitoring server third party's component ports flow information;
Weight update module 12 is updated sequence to third party's component weights according to port flow information;
Redundancy backup module 13 carries out strange land data redundancy backup to the file comprising key message.
Above-mentioned, although the foregoing specific embodiments of the present invention is described with reference to the accompanying drawings, not protects model to the present invention
The limitation enclosed, those skilled in the art should understand that, based on the technical solutions of the present invention, those skilled in the art are not
Need to make the creative labor the various modifications or changes that can be made still within protection scope of the present invention.