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

[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

--//没有改变.终于明白问题在哪里...
--//浪费一个上午的时间.............
--//总之,一些配置参数要生效,最好退出再从新登录。bash

相关文章
相关标签/搜索