When a process panics, a core dump occurs and the system creates a core file. These files are intended for troubleshooting and to help diagnose faults.
In most Linux distributions, core file creation is generally disabled by default for normal users and daemon processes. However, Systems Administrators can configure core files to be enabled, specify hard and soft limits, and core file locations and name patterns. Couchbase Server honors these core file settings.
Setting up your system to retain core files varies a bit based on the operating system. However, you can consider the following general guidelines to preserve cores generated by Couchbase Server processes.
Ensure that the Couchbase user has a reasonable core file size limit.
Ensure that you have enough free space to accommodate for core files on disk, and that you have write access to the core file directory.
Consider modifying the core file pattern so you don’t get lots of core files.
Enabling core files on Linux varies slightly based on kernel version and distributor. To enable core files, perform the following steps:
Enable core dumps via sysctl settings using the parameter
This appends the PID to the generated core file, allowing multiple core dumps:
Depending on the kernel release, one of these two parameters must be set to two (2).
Another optional but useful parameter is:
kernel.core_pattern = /tmp/core-%e-%s-%u-%g-%p-%t
In general, these parameters should be set in the /etc/sysctl.conf file.
After modifying the parameters, execute the following command so that a reboot is not necessary:
/sbin/sysctl -p /etc/sysctl.conf
Generating usable core files on Ubintu requires disabling the apport process. This is probably not a big deal unless you want various crashes reported upstream to Ubuntu. To disable the apport process, edit the /etc/default/apport file to set enabled=0 and then reboot the system.
To enable core files, perform the following steps:
Create /etc/sysctl.d/46-couchbase-core.conf with the following contents:
kernel.core_uses_pid=1 fs.suid_dumpable=2 kernel.core_pattern=/opt/couchbase/data/tmp/core-%e-%s-%u-%g-%p-%t
Run the following command:
service procps start
Red Hat Enterprise Linux (RHEL)
On RHEL 6, run the following command and then reboot the system.
echo "DAEMON_COREFILE_LIMIT='unlimited'" >> /etc/sysconfig/init
Earlier RHEL derivative operating systems such as RHEL 4, RHEL 5, F7, and CentOS, need a modification to their startup scripts.
By default, these operating systems hard set the core size to zero in the /etc/profile file.
To fix this, edit the following line in the file /etc/profile from
ulimit -S -c 0 > /dev/null 2>&1 to
ulimit -S -c unlimited > /dev/null 2>&1.
Then reboot the system.
Mac OS X
Core dumps are disabled by default in Mac OS X.
To enable core dumps, a privileged user must edit the
/etc/hostconfig file to add the following line: