공유 메모리를 설정하고 사용 가능하게 만드는 방법은 무엇입니까?

공유 메모리를 설정하고 사용 가능하게 만드는 방법은 무엇입니까?

CentOS에서 Sybase ASE 12.5용 공유 메모리를 설정하려고 합니다. 내 서버에는 17G 메모리가 있는데, 14G(=17-1-2)를 Sybase에서 사용할 수 있도록 만들고 싶습니다. (os의 경우 1G, 램디스크의 경우 2G 14 = 17-1-2).

정보는 다음과 같습니다.

[sybase@myserver ASE-12_5]$ free -g
total used free shared buffers cached
Mem: 17 7 9 0 0 7
-/+ buffers/cache: 0 17
Swap: 3 0 3

2G 램디스크 설정이 있습니다.

[sybase@myserver ASE-12_5]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 12G 2.6G 8.8G 23% /
/dev/sda1 251M 19M 220M 8% /boot
none 8.7G 0 8.7G 0% /dev/shm ---what's this? is it related kernel.shmmax?
/dev/sdb1 30G 8.4G 20G 30% /home
tmpfs 2.1G 20M 2.1G 1% /db/tempdb -----this is ramdisk, what 's the difference between this and /dev/shm???

그런 다음 /ect/sysctl.conf를 다음과 같이 수정합니다.

[sybase@myserver ASE-12_5]$ cat /etc/sysctl.conf
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.
# Controls IP packet forwarding
net.ipv4.ip_forward = 0
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 1
# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1
# kernel.shmmax = 10737418240
kernel.shmmax= 14738890752 ------modify this to 13.7G
kernel.shmmni = 4096
kernel.shmall = 2097152

그런 다음 다음을 실행하십시오.

echo "kernel.shmmax=14738890752" >> /etc/sysctl.conf

그런 다음 CentOS를 재부팅하십시오.

그런 다음 sybase 최대 메모리를 7196724(2K)로 설정하려고 시도했지만 sybase를 시작할 수 없고 오류가 발생했습니다.

00:00000:00000:2014/04/02 16:50:26.92 kernel os_create_region: shmget(0xf402f74d): No space left on device
00:00000:00000:2014/04/02 16:50:26.92 kernel kbcreate: couldn't create kernel region.
00:00000:00000:2014/04/02 16:50:26.92 kernel kistartup: could not create shared memory

최대 메모리를 40000009(2k)=7.6G로 설정할 수만 있습니다.

이유가 확실하지 않습니다. 그러면 CentOS에서 공유 메모리를 설정하고 /etc/sysctl.conf에서 kernel.shmmax만 변경하는 것만으로는 충분하지 않습니까? 아니면 더 많은 작업을 수행해야 합니까?

또한 다음 출력에는 2행 미만이 없습니다 df -h.

none 8.7G 0 8.7G 0% /dev/shm ---what's this? is it related kernel.shmmax
tmpfs 2.1G 20M 2.1G 1% /db/tempdb -----this is ramdisk

이 문제를 해결하는 방법은 무엇입니까?

답변1

shmmax허용된 것 보다 더 큰 세그먼트를 할당하려고 하면 EINVAL (Invalid argument)결과가 나오지 않습니다. 커밋된 메모리 제한보다 더 많은 것을 할당하려고 하면 결과가 ENOSPC (No space left on device)나타납니다.

내가 기억하는 한 제한은 기본적으로 물리적 RAM의 절반에 총 ​​스왑 공간을 더한 값입니다. 이 명령을 사용하면 현재 값을 볼 수 있습니다.grep CommitLimit /proc/meminfo

파일 시스템 의 크기는 에 설명된 대로 마운트 옵션 tmpfs에 의해 제어됩니다 .sizeman mount

파일 /dev/shm시스템은 호출에 사용됩니다 shm_open. 이는 shmgetPosix 및 SysV에서 시작된 두 가지 다른 API 와 관련이 없습니다 .

관련 정보