[Spacewalk-list] Keepalive for Database Connections?
Stefan Lasche
sela at mms-dresden.de
Thu Jun 13 08:48:03 UTC 2013
>
> Hi Stefan,
>
> you can create /etc/tnsname.ora with connect string you need.
> Then just change db_name in /etc/rhn/rhn.conf to the tnsname you've created
> (instead of default //host:port/name) and that's it :).
>
Thanks a lot Michael! That did the trick. The file is actually called /etc/tnsnames.ora and not /etc/tnsname.ora
Small difference, with big effects ;)
I wrote a small tutorial - just in case anyone else is interested:
How to implement Keepalive for Oracle Instant Client (for use in Spacewalk). Oracle Client will use the TCP Keepalive Feature of the Operating System (in my case Linux).
1) create /etc/tnsnames.ora by closely following the example in the "ENABLE" Section of the Oracle Docs: http://docs.oracle.com/cd/B28359_01/network.111/b28317/tnsnames.htm#CHDCDGCE
2) use Michael's magic and edit Spacewalk's /etc/rhn/rhn.conf. Change "db_name = //your_db_server_name/your_db "
into "db_name = net_service_name" (use the same net_service_name you used in your /etc/tnsnames.ora)
3) check the kernel's current keepalive values:
# sysctl -a | grep keepalive
net.ipv4.tcp_keepalive_time = 7200 # send the first keepalive after 3600 seconds (2h)
net.ipv4.tcp_keepalive_intvl = 75 # after the first keepalive, send keepalives every 75 seconds
net.ipv4.tcp_keepalive_probes = 9 # kill connection after 9 failed keepalives
4) Adjust the kernels Keepalive values to your needs:
# sysctl –w net.ipv4.tcp_keepalive_time=1800
# echo “net.ipv4.tcp_keepalive_time = 1800” >> /etc/sysctl.conf
5) restart Spacewalk
# /usr/sbin/spacewalk-service stop && /usr/sbin/spacewalk-service start
6) check if keepalive is now enabled for your database connections (use "netstat -tpno" and check the last two columns for the word "keepalive" and the corresponding timer values)
# netstat -tnpo
tcp 0 0 192.168.1.1:54729 192.168.2.2:1521 ESTABLISHED 26988/java keepalive (1530.03/0/0)
tcp 0 0 192.168.1.1:54718 192.168.2.2:1521 ESTABLISHED 26944/httpd keepalive (1522.62/0/0)
7) enjoy your space walk ;)
__
regards,
Stefan
More information about the Spacewalk-list
mailing list