For more information, see <G id = "1"> Linux Enterprise Application> Linux server application </G>. When important Web services work normally, a corresponding backup system must be established to ensure data security and non-interconnectivity. The accident mainly refers to power interruption, natural damage to server hardware, and crash of server system software, data loss or page information tampering caused by various forms of hacker attacks.
(400) {this. resized = true; this. width = 400; this. alt = 'click here to open new window';} "onmouseover =" if (this. resized) this. style. cursor = 'hand'; "onclick =" window. open ('HTTP: // server.chinabyte.com/imagelist/06/22/161d1t2ha7k4_s.JPG'); ">
, Server work allocation
Generally, data is manually copied to another server, or a special hardware backup system is purchased. Now we need a new backup system that can implement regular backup, enable the backup system in time when an accident occurs, and notify the administrator.
Our backup server is placed in another data center with at least a certain distance. the backup server also has an independent public IP address, which is used to form a separate LAN with other servers, they can access each other through lan ip addresses. In addition, we 'd better set up another server (referred to as the monitoring/allocation server below) so that it can determine the working status of other servers and promptly switch the user's access to the target address to start the backup service task.
The second is the operating system and corresponding settings. To ensure security and prevent hackers from exploiting the same system vulnerabilities, it is best to install the third system for the server in addition to timely patching. Generally, the server uses Windows 2000 or Linux, so we can install Windows 2003 for the backup server. At the same time, do not forget to set a complex and long system password. Then we map the hard disk of the Web server to this machine through the lan ip address, so that we can easily back up data through the program.
To save resources, we can centralize multiple services on one backup server for backup, but this requires that the performance of this server be reliable and highly secure, installing anti-virus software and hardware firewalls is also necessary.
Next, we will configure the backup and monitoring/distribution servers in detail.
Backup
Previously, we have mapped the hard disk of the Web server to the backup server, so that the backup work can proceed smoothly. You only need to use any programming language to compile a small program for regular execution, copy the Web page files, script files, image resources, and database files in the source folder to the corresponding local folder.
Scheduled copy can be executed in the early morning when the traffic volume is small to reduce the impact on the service. In addition, you can also use the method of monitoring file changes for backup, that is, to allow the program to scan the file modification time in the source folder at any time and copy the files if any change is found, this method enables real-time backup.
Note: At the same time of copying, check the validity of the file to avoid copying the page that has been tampered.
Build a Web service environment for backup servers
In order for the backup files to work in the original server fault era, we must build the same running environment on the backup server, such as installing IIS and the corresponding database. Because there are more than one Web server, the system may be different and the script files may be different, so we need to install the corresponding script parsing program.
Currently, PHP and other scripts running in Linux also have the Win32 version, which can be used directly with IIS. If the Administrator is not familiar with it, you can also install the Win32 version of Apache.
Note: Do not use the same port for different server software to avoid conflicts.
The installed services do not need to be run at ordinary times to prevent file copy errors. We can start them through a program when necessary.
Monitor server operation status
We use monitoring/allocation servers to monitor the running of Web Services, including backup servers, and detect hardware faults, system faults, database errors, and malicious attacks. We need to determine in the prepared detection program separately, and the detection program regularly actively connects to the Web page. If a hardware fault occurs, such as a power failure, all the services will be stopped, so the connection request will not receive a response.
For system faults (including server software faults), the program will find slow responses or abnormal responses (for example, returning error messages not found on the page ). The Database Failure program will also fail to receive the response to the database request, which can be used for judgment. Hackers often only tamper with the content of the webpage (mainly the homepage of the website), so we cannot find Errors Based on the previous checks, after the previous checks are passed, the program needs to obtain the content of the page files on the homepage and key pages of the website, and then compare it with the locally saved files to determine the authenticity.
Automatic Switch and alarm when an accident occurs
To enable automatic failover when an accident occurs to start the backup service, we have installed the server software on the monitoring/allocation server and provided the virtual domain name resolution function (both Apache and IIS can achieve this ). In addition, the IP addresses of protected Web server domain names are resolved to the IP addresses of the monitoring/allocation servers by DNS. That is to say, no matter which domain name you type, the visitor will be resolved to the monitoring/allocation server, and then use its virtual domain name function for secondary allocation.
Domain names that are usually different from each other will be uploaded to a file in the corresponding folder, such as index.html. We can make this file only responsible for the redirection function. Write in the file as shown in the following figure. The IP address can be a Web server or a backup server, which depends on the detection program. We can learn how monitoring/allocating servers work.
(400) {this. resized = true; this. width = 400; this. alt = 'click here to open new window';} "onmouseover =" if (this. resized) this. style. cursor = 'hand'; "onclick =" window. open ('HTTP: // server.chinabyte.com/imagelist/06/22/s768acd304h3_s.JPG'); ">
, Monitoring/Allocating Server Working Principles
When an exception is detected, the system first sends a command to terminate the backup of the backup server and start the Web service and database of the backup server. Then, modify the IP address in the index.html file to point it to the backup server. Finally, an alert email is sent to the Administrator through the email server and an alert sound is sent through the speaker. When everything is done, visitors are not aware of the changes. That is to say, we have achieved timely backup and seamless switching through this system.
It is worth noting that in order to prevent the backup server from copying an error page, we should check before each backup starts. This can be achieved through the communication between the backup program and the Monitoring Program, and the two programs should also be directly made into system services.
Mutual server monitoring and auxiliary monitoring
From the above situation, in our entire system, the first access is to monitor/allocate servers. Although this server does not work much, if it cannot work normally (especially if the virtual domain name stops working), it will make all servers inaccessible. Therefore, it is necessary to use other servers to monitor the work of this server.
If problems are found, you also need to send alarm emails and alarm sounds. In addition, we can also use an ordinary PC in the Administrator's workplace to automatically test access to the Web service at any time. Once this auxiliary detector detects an exception, it also sends alerts to make our servers more secure.
Manual Maintenance
Although the automatic backup and monitoring system is available, the manual maintenance work of the Administrator is still indispensable. After the server runs for a period of time, it will generate some junk files, such as the Session and Temp files that are not cleared in time. At the same time, log files will occupy more and more hard disk space over time, so they must be cleaned up. At the same time, patch the server system in a timely manner, and upgrade the service software, virus database, and firewall is also essential.
With the development of the Internet and the popularization of network life, Web homepages and services have increasingly become the endorsement of a department or enterprise's network image. Therefore, their roles have become increasingly important, server security has to be paid unprecedented attention. The content of this article is a summary of the practical achievements and experience of the author's work in the network center of Nankai University, practice has proved that this system can well complete the tasks of backing up multiple Web service systems, thus ensuring the normal operation of important Web services to the maximum extent.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service