[20190523]修改参数后一些细节注意2.txt

来源:这里教程网 时间:2026-03-03 13:47:25 作者:

[20190523]修改参数后一些细节注意2.txt --//上午想模拟链接遇到的情况,链接http://blog.itpub.net/267265/viewspace-2645262/ --//就是修改参数后没有退出oracle参数导致修改参数无效的情况,可是在我的测试环境根本无法模拟出来,只好找另外1台从来没有配置 --//hugepages的机器说明问题. --//但是我的测试环境问题到底在哪里呢?最终确定问题在哪里,做一个记录: 1.环境: # cat /proc/version Linux version 2.6.39-300.26.1.el5uek (mockbuild@ca-build56.us.oracle.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-52)) #1 SMP Thu Jan 3 18:31:38 PST 2013 # grep memlock /etc/security/limits.conf #        - memlock - max locked-in-memory address space (KB) #*   soft  memlock  53248 #*   hard  memlock  53248 --//我已经注解memlock配置. # ps -ef | egrep "bas[h]" | grep "roo[t]" root     51091 51089  0 11:22 pts/0    00:00:00 -bash --//进程号=51091 # cat /proc/51091/limits  | egrep "Limit|locked memory" Limit                     Soft Limit           Hard Limit           Units Max locked memory         54525952000          54525952000          bytes --//奇怪我已经注解,为什么memlock已经设置并且参数设置还很大呢?登录oracle用户也是一样. --//54525952000/2048/1024 = 26000, 奇怪这个参数配置来之哪里呢? --//使用grep探查看看. # grep -r 26000 /etc/security/* # grep 26000 /etc/*                    */ /etc/services:quake             26000/tcp /etc/services:quake             26000/udp /etc/sysctl.conf:#vm.nr_hugepages = 26000 --//很明显我以前修改过vm.nr_hugepages参数.但是现在已经注解了.应该不会生效啊. 2.我试着修改/etc/security/limits.conf,取消注解: # grep memlock /etc/security/limits.conf #        - memlock - max locked-in-memory address space (KB) *   soft  memlock  53248 *   hard  memlock  53248 --//重新登录查看: # ps -ef | egrep "bas[h]" | grep "roo[t]" root     52151 52149  4 11:51 pts/0    00:00:00 -bash # cat /proc/52151/limits |egrep "Limit|locked memory" Limit                     Soft Limit           Hard Limit           Units Max locked memory         54525952             54525952             bytes --//54525952 /1024 = 53248 --//可以发现我修改参数是生效的.那么注解后,这个参数来自哪里呢? 3.自己回想肯定我以前修改/etc/sysctl.conf文件配置有关: vm.nr_hugepages = 26000 --//噢我远程登录一定使用putty,服务器一定启动sshd进程,也许当时sshd进程继承这些参数配置. # ps -ef | grep ssh[d] root      5702     1  0 Mar14 ?        00:00:00 /usr/sbin/sshd root     52149  5702  0 11:51 ?        00:00:00 sshd: root@pts/0 # cat /proc/5702/limits | egrep "Limit|locked memory" Limit                     Soft Limit           Hard Limit           Units Max locked memory         54525952000          54525952000          bytes --//这样就能对上了.我远程登录,这样实际上登录用户就继承了sshd的一些参数,如果我没有设置,这些参数不会被重置. --//一个很简单认证就是重启sshd服务. # service sshd restart Stopping sshd:                                             [  OK  ] Starting sshd:                                             [  OK  ] # ps -ef | grep ssh[d] root     52265     1  0 12:01 ?        00:00:00 /usr/sbin/sshd root     52268 52265  0 12:01 ?        00:00:00 sshd: root@pts/0 # cat /proc/52265/limits | egrep "Limit|locked memory" Limit                     Soft Limit           Hard Limit           Units Max locked memory         54525952             54525952             bytes --//即使我注解/etc/security/limits.conf相关参数,登录root用户也可以发现这些参数不会改变.重新登录: # ps -ef | grep bas[h] |grep root root     52322 52320  1 12:03 pts/0    00:00:00 -bash # cat /proc/52322/limits | egrep "Limit|locked memory" Limit                     Soft Limit           Hard Limit           Units Max locked memory         54525952             54525952             bytes --//没有改变.终于明白问题在哪里... --//浪费一个上午的时间............. --//总之,一些配置参数要生效,最好退出再重新登陆。

相关推荐