5 CORE DUMP
Apex Liu edited this page 2017-06-23 22:30:36 +08:00
This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

服务需要长时间稳定运行但有时会发生崩溃的问题。为了能够快速定位崩溃的原因我们需要生成core dump文件以供分析。

对于TELEPORT的核心服务来说要在崩溃时生成Core Dump文件请SSH远程登录到teleport服务器上然后执行

$> su
$> /etc/init.d/teleport stop core
$> ulimit -c unlimited
$> /usr/local/teleport/bin/tp_core -d start

注意,请勿关闭此远程连接,直到崩溃发生!

命令解释:

  • su 以管理员身份登录因为运行服务需要root权限
  • /etc/init.d/teleport stop core 停止teleport核心服务
  • ulimit -c unlimited 临时打开系统的core dump功能使得程序崩溃时记录核心转储数据
  • /usr/local/teleport/bin/tp_core -d start 运行core服务程序但不是以守护进程的方式运行因此程序不会在后台运行可以在控制台上看到大量的日志输出需要一直保留这个远程登录连接不要退出。

然后像平常一样使用TELEPORT的各项功能直到发生崩溃。此时应该能够看到控制台上最后输出的是(core dumped),然后在 /usr/local/teleport/bin 目录下应该能够看到core.xxxx文件这个文件就是用来进行崩溃分析的core dump文件。