In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "what are the common problems of Linux", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let Xiaobian take you to learn "What are the common problems of Linux"!
CPU and memory
CPU ( Central Processing Unit ) is a super-large-scale integrated circuit board, which is the core component of computer, bearing the main operation and control functions of computer, and is the final interpretation module and execution module of computer instructions.
We know that files have file names and data, which on Linux are divided into two parts: user data and metadata.
user data, i.e. file data blocks, where the true content of the file is recorded;
metadata, additional attributes of a file, such as file size, creation time, owner, etc.;
In Linux, the inode number in the metadata (inode is part of the file metadata but does not contain the file name, inode number is the inode number) is the unique identifier of the\file, not the file name. File name is only for the convenience of people's memory and use, the system or program through the inode number to find the correct file data block
In order to solve the problem of file sharing, Linux system introduces two kinds of links: hard link and soft link (also known as symbolic link). Linkage solves the problem of file sharing for Linux systems, and also brings benefits such as hiding file paths, increasing permissions security, and saving storage. If an inode number corresponds to multiple file names, these files are called hard links. In other words, a hard link is the use of multiple aliases for the same file.
Since hard links are files with the same inode number but different file names, hard links have the following characteristics:
The file has the same inode and data block;
Only existing files can be created;
Hard link creation across file systems is not possible;
Cannot create directories, only files;
Deleting a hard-linked file does not affect other files with the same inode number.
ln -s source dist #establish soft connection ln source dist #establish hard connection
Hard links: No different from regular files, inode points to blocks of the same file on hard disk. When hard linking is established, the linked file and the linked file must be located in the same file system, and hard links to directories cannot be established.
Soft link: Save the absolute path of the file it represents. It is another kind of file that has independent blocks on the hard disk and replaces its own path when accessed. (Simply understood as a common shortcut in Windows)
The reason why the kill process cannot be killed
A process has become a dead process, and when its parent process recycles it or kills it, it can not be seen in ps output;
The process is in kernel state, Linux process runs in kernel and user states, when the process enters kernel state, it will block all signals, including SIGKIL, so kill -9 becomes invalid at this time.
The role of swap partition
Swap partitions free up a portion of hard disk space for currently running programs when the system runs out of physical memory. The freed space may come from programs that have not operated for a long time, and the freed space is temporarily saved to the Swap partition, and when those programs are ready to run, the saved data is restored from the Swap partition to memory. For example, think of memory as a cup, the data generated by the program running as water into the cup, when we run too many programs, or the amount of data processed is too large, the cup slowly becomes full, resulting in multiplication, at this time if there is a swap partition, it is like pouring too much water into the swap partition.
Hard disk partition Primary partition + Extended partition All logical partitions are within the Extended partition;
Swap partition, that is, swap area, when the system is not enough physical memory, swap with Swap. Swap tuning is critical to the performance of Linux servers, especially Web servers. By tweaking Swap, you can sometimes bypass system performance bottlenecks and save on system upgrades.
There are two ways to create a Swap partition
Create new disk partition as swap partition
Using files as swap partitions
Swap Configuration Impact on Performance
Allocating too much Swap space wastes disk space, and allocating too little Swap space causes system errors
Swap space should be greater than or equal to the size of physical memory, the minimum should not be less than 64M, usually the size of Swap space should be 2-2.5 times the physical memory
If there are multiple Swap swap zones, the Swap space allocation will operate on all Swaps in a rotating manner, which will greatly balance the IO load and speed up the Swap swap. If there is only one switching area, all switching operations will make the switching area busy, leaving the system waiting most of the time and inefficient.
Linux command finds the 10 most visited ip in log file
Linux commands are as follows:
cat test.log|awk -F" " '{print $2}'|sort|uniq -c|sort -nrk 1 -t' '|awk -F" " '{print $2}'|head -10
Problem analysis:
cat *.log Print text to screen
Use awk to divide a row into columns using dividers. The first column is represented by $1, the second column is represented by $2, and so on. awk -F" "'{print $2} //indicates that a space is used as a divider to divide and print the second column
sort sort, the default is sorted according to ascii code
uniq -c counts the number of repetitions of adjacent lines, and the result is something like 3 127.13.13.13, the number of lines in which the preceding numeric code repeats sort| uniq -c //count duplicate rows
sort -n is sorted from small to large by numerical value, -r is reverse order, -t is specified partition symbol, -k is sorted by column sort -nrk 1 -t' '
Use awk to divide a row into columns using dividers. The first column is represented by $1, the second column by $2, and so on. awk -F" "{print $2}' //indicates that a space is used as a separator to divide and print the second column
head -n means take the first n heads-10
Linux Common Commands
iftop: linux network traffic view command
Top: View CPU
ps -le: View all running processes;ps aux| grep filter
tail -f: View logs
free: View memory
uptime: View system load
Top Details
System load (three numbers represent the average value of 1 minute, 5 minutes and 15 minutes respectively, the smaller the value, the lower the load)
Number column name meaning a PID process id b PPID parent process id c RUSER Real user name d UID process owner user id e USER process owner user name f GROUP process owner group name g TTY terminal name of the initiating process Processes that are not initiated from the terminal are displayed as? h PR priority i NI nice value. Negative values indicate high priority, positive values indicate low priority j P Last CPU used, meaningful only in multi-CPU environments k %CPU time used since last update l TIME Total CPU time used by processes in seconds m TIME+ Total CPU time used by processes in 1/100 of a second n %MEM process physical memory used percentage o Total virtual memory used by VIRT processes in kb VIRT=SWAP+RES p The size of virtual memory used by SWAP processes to be swapped out, in kb. q Size of unswapped physical memory used by RES processes, in kb. RES=CODE+DATA r CODE Size of physical memory occupied by executable code, unit kb s DATA Size of physical memory occupied by part other than executable code (data segment + stack), unit kb t SHR Shared memory size, unit kb u nFLT Number of page errors v nDRT Number of pages modified since last write. W S Process status. D= non-interruptible sleep state R= running S= sleep T= track/stop Z= zombie process x COMMAND command name/command line y WCHAN If the process is sleeping, the sleeping system function name z Flags task flag is displayed.
At this point, I believe that everyone has a deeper understanding of "what are the common problems of Linux", so you may wish to actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.