Remembering the idea of database failure recovery in Web site

Source: Internet
Author: User

December 2014 13, received the user's complaint that the electronic mall first login, need to change the password to log in. When you hear this big brain, where to troubleshoot it:

1, definitely check the website access log, Access.log did not find a problem.

2, the user can not login, that must be the login site, check the log of this site to find that most of the information is online connection database failure. (Note: Because I am here on the line to restore the first time there is only one main library, and then built a master-slave synchronization, but has not been used from the library. See this error first I will switch to view from the library status from the library)

3, found from the library above an error is roughly mean: Update salt= ' o ' and password= "xxx", how there will be this operation.

4, asked the development who executed the statement, later someone responded that he operated this today. After the discovery of the statement error immediately after the stop, my first reaction is to skip this thing directly, should be able to recover, but later found that we are the master-slave library, we even the main library.

5, and have no clue, ask what the development salt is meant to say is a survival key serious, user registration password automatically generated this.

6. Try to count the salt to see how many bars, select count (*) where salt= ' 0 ' from XX. There have been more than 70,000, that is, so many users now password is not logged in, can only change the password to regenerate the key.

7, with the leader of the request is to business a change password regardless, or to return the original data, the leader said because the number of large as far as possible to the front of the data, today modified or new registered users do not have the tube.

8, the next is to think how to recover, I here is the scheduled task is 3 o'clock in the morning every day to start backing up the database. and tables.

Programme one:

To stop a library operation:

Because the amount of data is not very large, you can stop the database, and then 3 o'clock in the morning of all the data recovery. Then, based on the binary log file, the point in time before the programmer's operation is restored. Expected to complete within 2 hours.

Scenario Two:

Non-stop operation:

Import the backup table of 3 o'clock in the morning to another library first. Then, by means of update, Salt=0 's operations are replaced today with the original data. The condition is the case of an equal ID.

9: The leader says he can't stop the library. And we have to finish it in time. Not until tonight, okay. Only the second way, the developer who called the database executes the MySQL statement. Is roughly update databases1.table1,databases2,table2 set Salt=salt where databases1.id=databases2.id

10: After the successful implementation of certification no problem, call it off.

#过程当中遇到了许许多多问题, take one step at a time, because my database is expected to be strengthened, and the following statements are the help of developers. A little record, and then learn slowly.

This article is from the "Little Luo" blog, please be sure to keep this source http://xiaoluoge.blog.51cto.com/9141967/1589794

Remembering the idea of database failure recovery in Web site

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.