IPCS共享内存相关Word下载.docx
- 文档编号:16444828
- 上传时间:2022-11-23
- 格式:DOCX
- 页数:13
- 大小:23.87KB
IPCS共享内存相关Word下载.docx
《IPCS共享内存相关Word下载.docx》由会员分享,可在线阅读,更多相关《IPCS共享内存相关Word下载.docx(13页珍藏版)》请在冰豆网上搜索。
kernel.shmall=268435200
3)使用ipcs命令
ipcs-l
------SharedMemoryLimits--------
maxnumberofsegments=4096
maxsegsize(kbytes)=4194303
maxtotalsharedmemory(kbytes)=1073740800
minsegsize(bytes)=1
------SemaphoreLimits--------
maxnumberofarrays=4096
maxsemaphoresperarray=250
maxsemaphoressystemwide=256000
maxopspersemopcall=4096
semaphoremaxvalue=32767
------Messages:
Limits--------
maxqueuessystemwide=16
maxsizeofmessage(bytes)=65536
defaultmaxsizeofqueue(bytes)=65536
3、如何修改这些值
1)直接修改文件内容
echo"
268435200"
>
/proc/sys/kernel/shmall
优点:
简直、直观、快捷,马上生效
缺点:
机器重启后修改丢失,又恢复成默认值
PS.可以在rc.local加入这种修改方式,这样机器迁移时,可以很直观得知道共享内存的值需要修改。
2)修改/etc/sysctl.conf文件
永久修改,重启不会丢失
需重启才会生效
ps.可通过/sbin/sysctl
-p命令使修改立即生效,而不需要重启
3)使用/sbin/sysctl命令
sysctl-wkernel.shmmni
会做数据有效性校验,安全可靠,且马上生效,重启不会丢失
在做机器迁移时,此种修改方法易被忽略
综上,建议使用第3种方式进行修改,且做好文档的管理工作,在明显位置记录此种修改。
4、其他一些问题:
1)如何查看本机的所有共享内存:
ipcs-m
输出内容为“key
shmid
owner
perms
bytes
nattch
status”
2)如何查看本机的所有信号量
ipcs-s
3)如何删除一个共享内存
ipcrm-M0x0000231d
4)如何删除一个信号量
ipcrm-S0x0000231d
5)如何知道一个共享内存被哪些进程使用了
#参数中SYSV后面的值为共享内存的KEY值
lsof|grep"
SYSV00002320"
6)进程加载共享内存失败怎么处理?
#首先确认共享内存有没有正确初始化
ipcs-m
-i0x00002600
#如果没有初始化,应该调用始始化程序进行初始化;
如果已经初始化可尝试,删除后重新初始化
ipcrm-M0x00002600
7)进程初始化共享内存或信号量失败怎么处理?
一般是由于超过了共享内存或信号量限制导致。
可通过ipcs-u查看当前的使用情况。
可通过以上第三步中介绍的方法进行修改。
8)如何删除系统中所有已不再使用的工享内存
ipcs-m|awk'
{if($6==0)print"
ipcrm-M"
$1}'
|sh
即第6个字段,nattach为零的共享内存即为没有进程使用的共享内存。
PS.如果是在现网进行操作一定要谨慎使用此命令,因为可能有的共享内存可能当前没有被使用,但是在其他时刻有可能会被继续使用
ipcs命令
ipcs-分析消息队列、共享内存和信号量
ipcs-reportstatusofinterprocesscommunicationfacilities
ipcsdisplayscertaininformationaboutactiveinterprocesscommunicationfacilities.Withnooptions,ipcsdisplaysinformationinshortformatforthemessagequeues,sharedmemorysegments,andsemaphoresthatarecurrentlyactiveinthesystem.
引用
它的语法:
ipcs[-mqs][-abcopt][-Ccore][-Nnamelist]
-m输出有关共享内存(sharedmemory)的信息
-q输出有关信息队列(messagequeue)的信息
-s输出信号量(semaphore)的信息
#ipcs-m
IPCstatusfromasof2007年04月10日星期二18时32分18秒CST
TIDKEYMODEOWNERGROUP
SharedMemory:
m00x50000d43--rw-r--r--rootroot
m5010x1e90c97c--rw-r-----oracledba
ipcrm-删除ipc(清除共享内存信息)
ipcrm-m|-q|-sshm_id
shm_id共享内存id
#ipcrm-m501
ipcs用于显示消息队列、共享内存、信号灯信息的
q显示消息队列
s显示信号灯
m显示共享内存
a详细信息
其打印出当前你的系统中处于活动状态的共享内存的信息。
对每一个资源,这个命令会显示:
TYPE 包括信息队列(q),共享内存段(m),或者信号灯(s)。
ID 资源条目的唯一的表示号
KEY 应用程序存取资源使用的参数。
MODE 存取模式和许可权限的标记
OWNERandGROUP 登录名和用户属主的组号,OnLine使用的所有的共享内存资源的属主的属主 为root和informix组。
OnLine共享内存使用的基本键值为0x52564801。
SERVERNUM的值乘上0X10000并且加上这个值就为共享内存的键值。
这就是,如果你的SERVERNUM的值为2,你的共享内存段的键值为0x52564801+(2*0x10000)=0x52584801。
如果SERVERNUM的值为6,产生的键值就为0x525c4801。
清除命令:
ipcs-s|grepnobody|perl-e'
while(<
STDIN>
){@a=split(/"
s+/);
print`ipcrmsem$a[1]`}'
然后启动Apache即可。
更深入的了解:
FixingApache"
Nospaceleftondevice:
Couldn'
tcreateacceptlock"
errors
ErrorMessage:
WhenstartingApache,IgetthiserrormessageinthemainApacheerror_log:
[emerg](28)Nospaceleftondevice:
tcreateacceptlock
[notice]suEXECmechanismenabled(wrapper:
/usr/sbin/suexec)
[notice]Digest:
generatingsecretfordigestauthentication...
done
[warn]pidfile/etc/httpd/run/httpd.pidoverwritten--UncleanshutdownofpreviousApacherun?
Firstoff,checktomakesurethatyoureallyaren'
toutofdiskspace,orhavehitaquotalimit.AnotherwaythatApachecancreatethe"
acceptlock"
iswithasemaphore.Asemaphoreisaninter-processcommunicationtoolthatisusedbyApachetocommunicatewithit'
schildprocesses.ThiserrormessagemaymeanthatApachecouldn'
tcreateanewsemaphore.
Checktoseehowmanysemaphoresarecurrentlyinuse.IfApacheisrunningcorrectly,youshouldseesomethinglikethis:
#ipcs-s
------SemaphoreArrays--------
keysemidownerpermsnsems
0x0000000068681743apache6001
0x0000000068714515apache6001
0x0000000068747291apache6001
IfApacheisstopped,andyoustillseethesesemaphores,thenyoucansafelykillthembyrunningthiscommandforeachsemaphoreid(inthesecondcolumn)
$ipcrm-s<
semid>
Todestroyallsemaphores,youcanrunthisfromthecommandline(with"
apache"
beingtheapache-user):
forsemidin`ipcs-s|grepnobody|cut-f2-d"
"
`;
doipcrm-s$semid;
Ifyouareoutofsemaphores
Ifyoucan'
tcreateanymoresemaphores:
Sometimesyoursystemmayneedtoincreasethenumberofsemaphoresthatareavailableonthesystem.Thisrequiresachangetoakernelparameter.Ifyouarerunningonavirtualserverandcannotmodifykernelparameters,youmayneedtoaskyourhostingprovidertochangethisparameterontheirhostserverToviewthecurrentparameters:
#ipcs-l
maxsegsize(kbytes)=32768
maxtotalsharedmemory(kbytes)=8388608
maxnumberofarrays=1024
maxopspersemopcall=32
maxqueuessystemwide=1024
maxsizeofmessage(bytes)=8192
defaultmaxsizeofqueue(bytes)=16384
Tochangetheseparameters,modifythefile/etc/sysctl.confandaddthefollowinglines:
kernel.msgmni=1024
kernel.sem=250256000321024
Thenloadthesesettingswiththecommand:
sysctl-p
YourApacheprocessshouldnowbeabletocreatetheneededsemaphoresandrunproperly
这里介绍下kernel.msgmni
/proc/sys/kernel/msgmni
该文件指定消息队列标识的最大数目,即系统范围内最大多少个消息队列。
缺省设置:
16
在root下用sysctlkernel.msgmni检查该参数,也可以在命令行下
sysctl
-w
kernel.msgmni=XXX重新设定。
manipcs:
ipcs
(1)
ipcs
(1)
NAME
ipcs-reportstatusofinterprocesscommunicationfacilities
SYNOPSIS
ipcs[-mqs][-abcopt][-Ccore][-Nnamelist]
DESCRIPTION
ipcsdisplayscertaininformationaboutactiveinterprocess
communicationfacilities.
Withnooptions,ipcsdisplaysinformation
inshortformatforthemessagequeues,sharedmemorysegments,and
semaphoresthatarecurrentlyactiveinthesystem.
Options
Thefollowingoptionsrestrictthedisplaytothecorresponding
facilities.
(none)
Thisisequivalentto-mqs.
-m
Displayinformationaboutactivesharedmemory
segments.
-q
Displayinformationaboutactivemessagequeues.
-s
Displayinformationaboutactivesemaphores.
Thefollowingoptionsaddcolumnsofdatatothedisplay.
See"
Column
Description"
below.
Displaydefaultcolumns:
forallfacilities:
T,
ID,KEY,MODE,OWNER,GROUP.
-a
Displayallcolumns,asappropriate.
Thisis
equivalentto-bcopt.
-b
Displaylargest-allowable-sizeinformation:
for
messagequeues:
QBYTES;
forsharedmemory
segments:
SEGSZ;
forsemaphores:
NSEMS.
-c
Displaycreator'
sloginnameandgroupname:
allfacilities:
CREATOR,CGROUP.
-o
Displayinformationonoutstandingusage:
CBYTES,QNUM;
NATTCH.
-p
Displayprocessnumberinformation:
formessage
queues:
LSPID,LRPID;
forsharedmemorysegments:
CPID,LPID.
-t
Displaytimeinformation:
CTIME;
formessagequeues:
STIME,RTIME;
Hewlett-PackardCompany
-1-
HP-UXRelease11i:
November2000
sharedmemorysegments:
ATIME,DTIME;
semaphores:
OTIME.
Thefollowingoptionsredefinethesourcesofinformation.
-Ccore
Usecoreinplaceof/dev/kmem.
corecanbea
corefileoradirectorycreatedbysavecrashor
savecore.
-Nnamelist
Usefilenamelistorthenamelistwithincorein
placeof/stand/vmunix.
Itopensacrashdumpfor
reading.Pleaserefertocr_open(3)formore
details.
ColumnDescriptions
Thecolumnheadingsandthe
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- IPCS 共享 内存 相关
![提示](https://static.bdocx.com/images/bang_tan.gif)