In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces how Linux modifies kernel parameters during the operation of the system. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.
Because the kernel parameter information of Linux is stored in memory, it can be modified directly by command, and the modification takes effect directly. However, when the system restarts, the originally set parameter values will be lost, and the system will automatically read the kernel parameters in the / etc/sysctl.conf file every time it starts, so it is a better choice to write the kernel parameter configuration to this file.
First open the / etc/sysctl.conf file and view the settings for the following two lines, here is:
Kernel.shmall = 2097152 kernel.shmmax = 4294967295 if the default configuration of the system is larger than the value given here, do not modify the original configuration. Also at the end of the / etc/sysctl.conf file, add the following:
Fs.file-max = 6553600 kernel.shmmni = 4096 kernel.sem = 1024 32000 100128 net.ipv4.ip_local_port_range = 1024 65000 net.core.rmem_default = 4194304 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 262144 "fs.file-max = 6553600" is actually obtained by "fs.file-max = 512 * PROCESSES". We specify that the value of PROCESSES is 12800, that is, "fs.file-max = 512 * 12800".
After the sysctl.conf file has been modified, execute "sysctl-p" to make the settings take effect.
The kernel parameters commonly used in [root@localhost ~] # sysctl-p have the following meanings.
Kernel.shmmax: represents the maximum value of a single shared memory segment, in bytes. This value is usually half of physical memory, but it doesn't matter if it is larger. Here, it is set to 4GB, that is, "4294967295max 1024max 1024q4G".
Kernel.shmmni: represents the minimum value of a single shared memory segment, usually 4kB, or 4096bit.
Kernel.shmall: represents the total amount of available shared memory in pages, which is equal to 4kB, or 4096 bytes, on a 32-bit system.
Fs.file-max: represents the maximum number of file handles. The file handle represents the number of files that can be opened on the Linux system.
Ip_local_port_range: indicates the range of the port, which is the specified content.
Kernel.sem: indicates the set semaphore, and the contents of these four parameters are fixed.
Net.core.rmem_default: the default value (in bytes) that represents the size of the receive socket buffer.
Net.core.rmem_max: represents the maximum size of the receive socket buffer in bytes
Net.core.wmem_default: the default value (in bytes) that represents the buffer size of the send socket.
Net.core.wmem_max: represents the maximum size of the send socket buffer in bytes.
Source: big exam
Add:
Most of the kernel parameters are stored in the / proc/sys directory and are designed to change while the system is running. Let's take turning on the ip forwarding function of the kernel as an example to illustrate two ways to modify kernel parameters while the system is running. IP forwarding refers to allowing the system to pass through the network for packets whose source and destination are not native. RedHat blocks this function by default, and it needs to be enabled when you need to use this machine as a router, NAT, and so on.
Method: modify the contents of kernel parameter files under / proc
Directly modify the kernel parameter ip_forward corresponding to the file / proc/sys/net/ipv4/ip_forward under / proc. View the contents of the ip_forward file with the following command:
# cat / proc/sys/net/ipv4/ip_forward
The default value of 0 for this file is to disable ip forwarding. If you change it to 1, you can enable ip forwarding. The modification command is as follows:
# echo 1 > / proc/sys/net/ipv4/ip_forward
The modification takes effect immediately, that is, the kernel has turned on ip forwarding. However, if the system is rebooted and then returned to the default value of 0, if you want to permanently open it, you need to modify the contents of the / etc/sysctl.conf file.
This is how Linux modifies kernel parameters while the system is running. I hope the above content can be of some help and learn more knowledge. If you think the article is good, you can share it for more people to see.
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.