Traditional Culture Encyclopedia - Traditional customs - What does php website operation and maintenance mainly do?

What does php website operation and maintenance mainly do?

What does an operation and maintenance engineer do?

Sum up two sentences

1. Ensure the long-term stable operation of business (such as website server, game server, etc. ).

2. Ensure data security and reliability (such as user name and password, game data, blog articles, transaction data, etc.). ).

From these two sentences, what the operation and maintenance engineer should learn is deduced.

(1) Ensure the long-term and stable operation of the business.

Users will complain if there is a slight mistake.

1. What does the enterprise run on?

Website servers are generally apache, nginx, tomcat, etc. But the real running process also needs Mysql database to store user passwords and so on. Many programs need php parsing, so deploying LNMP, LAMP (namely nginx, apache, mysql, php) environment is a necessary skill.

2. How can I know if there is any problem in the business in time?

This requires monitoring software to notify you by email or SMS, such as zabbix and nagios. To send e-mail to the police, you must have an e-mail program, sendmail or postfix.

3. I received an alarm at home, but the server is an intranet IP. How can I solve this problem?

Set up openvpn or pptp or openswan in the company, dial into the intranet through vpn at home, and solve the problem 24 hours a day ... Alas, there is no salary for getting up in the middle of the night to solve the problem.

Second, ensure the security and reliability of data.

A little mistake, the leader wants to have tea with you.

1. Sometimes it is necessary to manually change the contents of the database.

Therefore, it is necessary to understand the basic Mysql database add, delete, query and change commands.

2. What if the hardware of the database server is broken?

You need a backup library in case of emergency, so you need Mysql master-slave replication.

3. How should I restore the database?

Therefore, Mysql data needs to be prepared regularly in crond for recovery. If you want to recover to the specified point in time, you should also learn Mysql incremental backup and recovery.

4. What should I do if the picture uploaded by the user or the file server is broken?

Scheduled backup may not be enough, so you need to use rsync plus inotify for real-time backup. In this way, the main server crashes at any time, and all pictures can be backed up and restored.

5. Beware of hackers and increase server security?

Ssh cannot be easily accessed by outsiders, so only the company's IP or springboard IP access is allowed, which is controlled by iptables.

Third, great performance.

Small companies will be awesome one day, but if not, we can jump to big companies.

1. More and more users visit our website. What if the web server can't resist?

That requires multiple web servers, but how to balance the load among multiple servers requires nginx reverse proxy or LVS+keepalived or haproxy+heartbeat.

2. There are too many articles and comments registered by users. What if a database can't resist?

Database pressure can be divided into reading and writing. If you can't write down, you need to divide tables and databases into multiple servers. If the reading pressure is not enough, mysql-proxy can be used to separate reading from writing to share the reading pressure. A simpler and more convenient method is to put the contents of the database into memory, which uses memcache or redis.

3. What if N users upload and download files and the disk can't resist?

Make multiple disks into raid, or use distributed storage file systems such as MFS and GlusterFS to improve the reading and writing ability of disks.

There are many pictures on the website, and there are always users complaining that the website loads too slowly. What should I do?

At this time, you can cache the pictures on the website to the front of the website through squid or varnish to improve the access speed as much as possible. Of course, it is best to buy a commercial CDN to speed up.

5. Operators are a big problem. The bandwidth between them seems very small. Why is Unicom IP accessing our telecom website so slow?

At this time, you can use bind to build a DNS server, point the DNS records of the website to the self-built DNS server, and configure the parsing rules. After that, Unicom IP will be resolved to Unicom website, and telecom IP will be resolved to telecom website, and the experience will be much better.

Fourth, automation.

The ultimate goal: to run the machine to death and idle the dead.

1, the company bought 100 new servers, and the company actually has 1 mobile discs. When did this system come into being?

Use kickstart or cobbler to remotely install the system on the network.

2. Every installation needs to optimize a lot of content. What are the file descriptors, ports and software installations? Manual operation is not tiring.

Learning shell quickly will free up a lot of work.

3. After the system is installed, you need to enter a password when logging in. So many sets?

Use expect to automatically read the prompt for password and execute the command.

4. What should I do if I want to publish the new code to the online server in batches?

Use salt heaps, puppets or Ansbil. Absolutely cool.

Verb (short for verb) others

1. It takes five servers to build a complete test environment, and the company is poor, with only one idle server?

Learn xen or kvm or docker. Virtual multi-server can solve the resource problem. Docker is especially recommended. In the future, R&D staff will ask you to deploy a new environment and help him solve this problem in a few minutes.

2. The code control and authority control of R&D personnel must always be managed by operation and maintenance personnel.

Svn or git, there must be this.

Ending:

Now let's look back and think, what do operation and maintenance engineers usually do?

1, solve the alarm fault at any time.

2. Business plan update.

3. Write some scripts to monitor or complete other functions that can be completed automatically.

4. Improve the operation and maintenance framework, deploy some more convenient, reliable or better performance open source tools, and formulate operation and maintenance process specifications.

5. Do odd jobs, such as switching switches, installing systems and deploying new environments.