MongoDB Documentation, Release 3.0.4 Note: For non-Linux systems, values greater than or equal to 600 seconds (10 minutes) will be ignored by mongod and mongos . For Linux, values greater than 300 seconds (5 minutes) will be overridden on the mongod and mongos sockets with a maximum of 300 seconds. The value is measured in seconds. Or: Or: On Linux, mongod and mongos processes limit the keepalive to a maximum of 300 seconds (5 minutes) on their own sockets by overriding keepalive values greater than 5 minutes. These operations do not persist across system reboots. To persist the setting, add the following line to /etc/sysctl.conf : The above method for setting the TCP keepalive is not persistent; you will need to reset the value each time you reboot or restart a system. See your operating system’s documentation for instructions on setting the TCP keepalive value persistently. The registry value is not present by default. The system default, used if the value is absent, is 7200000 millisec- onds or 0x6ddd00 in hexadecimal. $^{30}$https://technet.microsoft.com/en-us/library/cc957549.aspx Chapter 11. Frequently Asked Questions 780 • To change the KeepAliveTime value, use the following command in an Administrator Command Prompt , where <value> is expressed in hexadecimal (e.g. 0x0124c0 is 120000): • To view the keep alive setting, issue the following command: • To change the net.inet.tcp.keepinit value, you can use the following command: • To view the keep alive setting, issue the following command: • To change the tcp_keepalive_time value, you can use one of the following command: • To view the keep alive setting, you can use one of the following commands: On Linux systems For OS X systems For Windows systems sysctl net.ipv4.tcp_keepalive_time cat /proc/sys/net/ipv4/tcp_keepalive_time sudo sysctl -w net.ipv4.tcp_keepalive_time=<value> echo <value> | sudo tee /proc/sys/net/ipv4/tcp_keepalive_time net.ipv4.tcp_keepalive_time = <value> sysctl net.inet.tcp.keepinit sysctl -w net.inet.tcp.keepinit=<value> reg query HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters /v KeepAliveTime reg add HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\ /v KeepAliveTime /d <value> Windows users should consider the Windows Server Technet Article on KeepAliveTime 30 for more information on setting keep alive for MongoDB deployments on Windows systems.