Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the common problems of Linux operation and maintenance?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "what are the common problems of Linux operation and maintenance". The content is easy to understand and clear. I hope it can help you solve your doubts. Let the editor lead you to study and learn the article "what are the common problems of Linux operation and maintenance".

1.shell script does not execute

Question: one day, a colleague in R & D asked me to help him take a look at the shell script he wrote. I took a look, the script is very simple, there are no regular errors, reported ": bad interpreter: No such file or directory" error. As soon as I saw this mistake, I asked him if he wrote the script under windows and uploaded it to the linux server. Sure enough. Reason: in DOS/Windows, the newline character of the text file is rn, while in the nix system, it is n, so the edited text file in DOS/Windows is added to nix with an extra ^ M for each line. Solution: 1) re-write the script under linux; 2) vi:% s/r//g:% s / ^ M / / g (^ M input with Ctrl+v, Ctrl+m) attached: sh-x script file name, you can step through and echo the results, helping to troubleshoot complex script problems.

2.crontab output result control

Problem: / var/spool/clientmqueue directory occupies more than 100G reason: the program executed in cron has output, which will be sent to cron users in the form of mail, while sendmail does not start, so it produces those files in the / var/spool/clientmqueue directory, which may break the disk over time. Solution: 1) manually delete: ls | xargs rm-f; 2) completely solve: add > / dev/null 2 > & 1 after the automatic execution statement of cron.

3.telnet is slow / ssh is slow

Question: one day, a colleague in R & D said that accessing the 10.52memcached service at 10.50 was abnormal. Let's check to see if there is anything abnormal in the network / service / system. Check found that the system is normal, the service is normal, 10.50ping10.52 is also normal, but 10.50telnet10.52 is very slow. At the same time, it is found that the namesever of the machine does not work. Reason: because your PC doesn't do a reverse DNS lookup on your IP then … When you telnet/ftp into your linux box, it'll do a dns lookup on you . Solution: 1) modify / etc/hosts so that hostname corresponds to ip; 2) comment out nameserver in / etc/resolv.conf or find a "live" nameserver.

4.Read-only file system

Question: colleagues failed to build tables in mysql. The hints are as follows: mysql > create table wosontest (colddname1 char (1)); ERROR 1005 (HY000): Can't create table 'wosontest' (errno: 30) after checking mysql user rights and related directory permissions, there is no problem; prompt messages with perror 30 are: OS error code 30: Read-only file system possible reasons: 1) file system corruption; 2) disk is bad 3) incorrect configuration of fstab files, such as incorrect partition format (writing ntfs as fat), misspelling of configuration instructions, etc. Solution: 1) because it is a test machine, restart the machine and restore it; 2) it is said on the Internet that it can be solved with mount.

5. File deleted disk space did not release the problem: one day found that a certain machine df-h used disk space is 90 GB, while du-sh / * shows that all the used space adds up to only 30 GB, embarrassing. Reason: maybe someone directly uses rm to delete a file that is being written, causing the file to be deleted but the disk space not released to solve the problem: 1) it is the easiest to restart the system or restart related services. 2) kill the process / usr/sbin/lsof | grep deletedora 25575 data 33u REG 65 4294983680 / oradata/DATAPRE/UNDOTBS009.dbf (deleted) from the output of lsof, we can find that the process with a pid of 25575 holds the file / oradata/DATAPRE/UNDOTBS009.dbf opened with the file description number (fd) 33. After we have found this file, we can release the occupied space by ending the process: echo > / proc/25575/fd/333) deleting files being written generally uses cat / dev/null > file6.find files to improve performance: there are a large number of temporary files containing picture_* in the tmp directory, cleaning up the files before the day at 2:30 every night. Previously, I ran the following script under crontab, but found that the script was inefficient and the load soared each time it was executed, affecting other services. #! / bin/shfind / tmp-name "picture_*"-mtime + 1-exec rm-f {}; reason: there are a large number of files in the directory, and using find consumes resources. Solve: #! / bin/shcd / tmptime= `date-d "2 day ago"+% b% d" `ls-l | grep "picture" | grep "$time" | awk'{print $NF}'| xargs rm-rf7. Unable to get gateway mac address

Problem: from 2.14 to 3.65 (mapped address 2.141) the network is down, but from other machines on the third side to the 3.65 network OK. Reason: # arp Address HWtype HWaddress Flags Mask Iface 192.168.3.254 ether incomplet CM bond0 surface phenomenon is that the machine can not automatically obtain the gateway MAC address, the network engineer said that it is the problem of the network equipment, the specific is not clear. Solution: arp binding, arp-I bond0-s 192.168.3.254 00:00:5e:00:01:64

An example that the 8.http service cannot be started

Question: one day a colleague in R & D said that the front-end environment http of the website could not be started, so I went up to have a look. Report the following error: / etc/init.d/httpd start Starting httpd: [Sat Jan 29 17:49:00 2011] [warn] module antibot_module is already loaded, skipping Use proxy forward as remote ip: true. Antibot exclude pattern:. *. [(js | css | jpg | gif | png)] Antibot seed check pattern: login (98) Address already in use: make_sock: could not bind to address [:]: 7080 (98) Address already in use: make_sock: could not bind to address 0.0.0.0 no listening sockets available 7080 no listening sockets available, shutting down Unable to open log [FAILED] reason: 1) Port occupied: on the face of it, port 7080 is occupied, so netstat-npl | grep 7080 looked and found that 7080 was not occupied. 2) if the port is written repeatedly in the configuration file, if the Listen 7080 / etc/httpd/conf/http.conf / etc/httpd/conf.d/t.10086.cn.conf solution is written in the following two files: comment out / etc/httpd/conf.d/t.10086.cn.conf 's Listen 7080, restart, OK.

9.too many open file problem: report too many open file error solution: ultimate solution echo "> > / etc/security/limits.confecho" * soft nproc 65535 "> > / etc/security/limits.confecho" * hard nproc 65535 "> > / etc/security/limits.confecho" * soft nofile 65535 "> > / etc/security / limits.confecho "* hard nofile 65535" > > / etc/security/limits.confecho "> > / root/.bash_profileecho" ulimit-n 65535 "> > / root/.bash_profileecho" ulimit- u 65535 "> > / root/.bash_profile finally restart the machine or execute ulimit- u 655345 & & ulimit-n 6553510.ibdata1 and mysql-bin causing disk space problems

Problem: 2.51 disk space alarm, found that ibdata1 and mysql-bin logs take up too much space (in which ibdata1 exceeds 120G MySQL bin exceeds 80g) the reason: ibdata1 is a storage format, in the INNODB type data state, ibdata1 is used to store file data and indexes, while the table files in the folder of the library name are just structures. The innodb storage engine has two ways to manage tablespaces: 1) sharing tablespaces (which can be split into multiple small tablespace files), which is the method used by most of our databases at present. 2) independent tablespaces, each table has its own advantages and disadvantages for two kinds of management, as follows: ① shared tablespaces: advantages: tablespaces can be divided into multiple files and stored on different disks (tablespace file size is not limited by table size, a table can be distributed on asynchronous files). Disadvantages: all data and indexes are stored in one file, then as the data increases, there will be a large file. Although a large file can be divided into multiple small files, multiple tables and indexes are mixed and stored in the table space. In this way, there will be a lot of gaps in the table space after a large number of deletions are done on a table. In the case of shared tablespace management, once the tablespace is allocated, it cannot be retracted. When the operation table space of temporary indexing or creating a temporary table is expanded, there is no way to shrink that part of the space even by deleting the related table. ② independent tablespaces: set in the configuration file (my.cnf): innodb_file_per_table features: each table has its own independent tablespace; the data and indexes of each table will exist in its own tablespace. Advantages: the disk space corresponding to the tablespace can be reclaimed (the Drop table operation automatically reclaims the tablespace, if the table after deleting a large amount of data can use: alter table tbl_name engine=innodb; to retract the unused space. Disadvantages: if the single table increases too much, such as more than 100G, the performance will also be affected. In this case, files can be separated if shared tablespaces are used, but there is also a problem. If the scope of access is too large, it will also access multiple files, which will also be slow. If you use independent tablespaces, you can consider using partitioned tables to alleviate the problem to some extent. In addition, when independent tablespace mode is enabled, the setting of the innodb_open_files parameter needs to be adjusted reasonably. Solution: 1) the ibdata1 data is too large: you can only export the sql statement to build the database through dump, and then rebuild the method. 2) mysql-bin Log is too large: ① manually delete: delete a log: mysql > PURGE MASTER LOGS TO 'mysql-bin.010'; delete the log before a certain day: mysql > PURGE MASTER LOGS BEFORE' 2010-12-22 1300 mysql; ② sets the number of days that only N-day bin-log logs are saved in / etc/my.cnf expire_logs_days = 30 / / the number of days Binary Log automatically deletes

The above is all the contents of the article "what are the common problems of Linux operation and maintenance". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report