# echo "ulimit -c 1024" >> /etc/profile
然后退出重新登录
# ulimit -a
core file size (blocks, -c) 1024
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 128434
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 65535
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 128434
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
# ulimit -c unlimited
# echo 1 > /proc/sys/kernel/core_uses_pid
# echo "~/ceph/core-%e-%p-%t" > /proc/sys/kernel/core_pattern
通过上述方法设置了core dump的限制和规则后,就可以生成linux程序的core dump了
ceph-run /usr/bin/ceph-osd --cluster=ceph -i 0 -f &
# ps ax | grep -w ceph
...
94899 ? S 0:00 /bin/sh /usr/bin/ceph-run /usr/bin/ceph-osd --cluster=ceph -i 0 -f
96306 ? Sl 0:01 /usr/bin/ceph-osd --cluster=ceph -i 0 -f
- 通过kill触发ceph daemon的core dump
kill -3 96306 / kill -4 96306
然后在之前配置的core dump目录下就能看到生成的core dump file,比如:~/ceph/core-ceph-osd-96306-1450097306
gdb /usr/bin/ceph-osd ~/ceph/core-ceph-osd-96306-1450097306