OCM_Session7_4_修改内核配置文件/etc/sysctl.conf

时间:2022-02-11 12:29:06

 

四、修改内核配置文件--两个节点都要执行   这个在OCM环境已经配置好
参考官方文档:http://docs.oracle.com/cd/B19306_01/install.102/b14203/prelinux.htm

To view the current value specified for these kernel parameters, and to change them if necessary, follow these steps:

  1. Enter the commands shown in the following table to view the current values of the kernel parameters:

    Note:

    Make a note of the current values and identify any values that you must change.
    Parameter Command
    semmsl, semmns, semopm, and semmni # /sbin/sysctl -a | grep sem

    This command displays the value of the semaphore parameters in the order listed.

    shmall, shmmax, and shmmni # /sbin/sysctl -a | grep shm
    file-max # /sbin/sysctl -a | grep file-max
    ip_local_port_range # /sbin/sysctl -a | grep ip_local_port_range

    This command displays a range of port numbers.

    rmem_default, rmem_max, wmem_default, and wmem_max # /sbin/sysctl -a | grep net.core

  2. If the value of any kernel parameter is different from the recommended value, then complete the following process:

    Using any text editor, create or edit the /etc/sysctl.conf file, and add or edit lines similar to the following:

    Note:

    Include lines only for the kernel parameter values that you want to change. For the semaphore parameters (kernel.sem), you must specify all four values. However, if any of the current system parameter values are greater than the recommended values, then keep using the larger values.
    kernel.shmall = 2097152 kernel.shmmax = 2147483648 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 fs.file-max = 65536 net.ipv4.ip_local_port_range = 1024 65000 net.core.rmem_default = 262144 net.core.rmem_max = 1048576 net.core.wmem_default = 262144 net.core.wmem_max = 1048576

    By specifying the values in the /etc/sysctl.conf file, they persist when you restart the system.

    On Red Hat systems, to have these changes take effect immediately so that you do not have to restart the system, enter the following command:

    /sbin/sysctl -p
  3. Repeat steps 1 and 2 on all other nodes in the cluster.

    On SUSE systems only, enter the following command to cause the system to read the /etc/sysctl.conf file when it restarts:

    # /sbin/chkconfig boot.sysctl on
  4. On SUSE Linux Enterprise Server 9.0 only, set the kernel parameter disable_cap_mlock as follows:

    disable_cap_mlock = 1
  5. After updating the values of kernel parameters in the /etc/sysctl.conf file, either restart the computer, or run the command sysctl -p to make the changes in the /etc/sysctl.conf file available in the active kernel memory.

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------

    我的修改如下: 

------------------------------------------------------------------------------------------ rac1节点
[root@rac1 ~]# cp /etc/sysctl.conf /etc/sysctl.conf.bak[root@rac1 ~]# vi /etc/sysctl.conf# Kernel sysctl configuration file for Oracle Enterprise Linux## For binary values, 0 is disabled, 1 is enabled.  See sysctl(8) and# sysctl.conf(5) for more details.
# Controls IP packet forwardingnet.ipv4.ip_forward = 0
# Controls source route verification# See /usr/share/doc/kernel-doc-*/Documentation/networking/ip-sysctl.txtnet.ipv4.conf.default.rp_filter = 2
# Do not accept source routingnet.ipv4.conf.default.accept_source_route = 0
# Controls the System Request debugging functionality of the kernelkernel.sysrq = 0
# Controls whether core dumps will append the PID to the core filename# Useful for debugging multi-threaded applicationskernel.core_uses_pid = 1
# Controls the use of TCP syncookiesnet.ipv4.tcp_syncookies = 1
# Controls the maximum size of a message, in byteskernel.msgmnb = 65536
# Controls the default maxmimum size of a mesage queuekernel.msgmax = 65536
# Controls the maximum shared segment size, in byteskernel.shmmax = 4294967295
# Controls the maximum number of shared memory segments, in pageskernel.shmall = 268435456
kernel.shmall = 2097152kernel.shmmax = 2147483648kernel.shmmni = 4096kernel.sem = 250 32000 100 128fs.file-max = 65536net.ipv4.ip_local_port_range = 1024 65000net.core.rmem_default = 262144net.core.rmem_max = 1048576net.core.wmem_default = 262144net.core.wmem_max = 1048576"/etc/sysctl.conf" 47L, 1361C written[root@rac1 ~]# sysctl -pnet.ipv4.ip_forward = 0net.ipv4.conf.default.rp_filter = 2net.ipv4.conf.default.accept_source_route = 0kernel.sysrq = 0kernel.core_uses_pid = 1net.ipv4.tcp_syncookies = 1kernel.msgmnb = 65536kernel.msgmax = 65536kernel.shmmax = 4294967295kernel.shmall = 268435456kernel.shmall = 2097152kernel.shmmax = 2147483648kernel.shmmni = 4096kernel.sem = 250 32000 100 128fs.file-max = 65536net.ipv4.ip_local_port_range = 1024 65000net.core.rmem_default = 262144net.core.rmem_max = 1048576net.core.wmem_default = 262144net.core.wmem_max = 1048576[root@rac1 ~]# 

-------------------------------------------------------------------------------------------------------------- rac2节点
[root@rac2 ~]# cp /etc/sysctl.conf /etc/sysctl.conf.bak[root@rac2 ~]# vi /etc/sysctl.conf# Kernel sysctl configuration file for Oracle Enterprise Linux## For binary values, 0 is disabled, 1 is enabled.  See sysctl(8) and# sysctl.conf(5) for more details.
# Controls IP packet forwardingnet.ipv4.ip_forward = 0
# Controls source route verification# See /usr/share/doc/kernel-doc-*/Documentation/networking/ip-sysctl.txtnet.ipv4.conf.default.rp_filter = 2
# Do not accept source routingnet.ipv4.conf.default.accept_source_route = 0
# Controls the System Request debugging functionality of the kernelkernel.sysrq = 0
# Controls whether core dumps will append the PID to the core filename# Useful for debugging multi-threaded applicationskernel.core_uses_pid = 1
# Controls the use of TCP syncookiesnet.ipv4.tcp_syncookies = 1
# Controls the maximum size of a message, in byteskernel.msgmnb = 65536
# Controls the default maxmimum size of a mesage queuekernel.msgmax = 65536
# Controls the maximum shared segment size, in byteskernel.shmmax = 4294967295
# Controls the maximum number of shared memory segments, in pageskernel.shmall = 268435456
kernel.shmall = 2097152kernel.shmmax = 2147483648kernel.shmmni = 4096kernel.sem = 250 32000 100 128fs.file-max = 65536net.ipv4.ip_local_port_range = 1024 65000net.core.rmem_default = 262144net.core.rmem_max = 1048576net.core.wmem_default = 262144net.core.wmem_max = 1048576"/etc/sysctl.conf" 47L, 1361C written[root@rac2 ~]# sysctl -pnet.ipv4.ip_forward = 0net.ipv4.conf.default.rp_filter = 2net.ipv4.conf.default.accept_source_route = 0kernel.sysrq = 0kernel.core_uses_pid = 1net.ipv4.tcp_syncookies = 1kernel.msgmnb = 65536kernel.msgmax = 65536kernel.shmmax = 4294967295kernel.shmall = 268435456kernel.shmall = 2097152kernel.shmmax = 2147483648kernel.shmmni = 4096kernel.sem = 250 32000 100 128fs.file-max = 65536net.ipv4.ip_local_port_range = 1024 65000net.core.rmem_default = 262144net.core.rmem_max = 1048576net.core.wmem_default = 262144net.core.wmem_max = 1048576[root@rac2 ~]# 

-----------------------------------------------------------------------------------------------------