Skip to content
Snippets Groups Projects
Commit fa4f7611 authored by Jonathan Gazeley's avatar Jonathan Gazeley
Browse files

Add support to freeradius::sql to customise socket lifetimes

parent 92020da1
Branches
Tags
No related merge requests found
...@@ -328,6 +328,16 @@ you will see errors like "No connections available and at max connection limit". ...@@ -328,6 +328,16 @@ you will see errors like "No connections available and at max connection limit".
this to MORE than the number of threads means that there are more connections than necessary. this to MORE than the number of threads means that there are more connections than necessary.
Leave blank to set it to the same value as the number of threads. Leave blank to set it to the same value as the number of threads.
##### `lifetime`
Default: `0`. Lifetime of an SQL socket. If you are having network issues such as TCP sessions expiring, you may need to set the socket
lifetime. If set to non-zero, any open connections will be closed `$lifetime` seconds after they were first opened.
##### `max_queries`
Default: `0`. Maximum number of queries used by an SQL socket. If you are having issues with SQL sockets lasting "too long", you can
limit the number of queries performed over one socket. After `$max_qeuries`, the socket will be closed. Use 0 for "no limit".
##### `query_file` ##### `query_file`
Default: `sql/${database}/dialup.conf`. Relative path to the file which contains your SQL queries. By Default: `sql/${database}/dialup.conf`. Relative path to the file which contains your SQL queries. By
......
...@@ -7,6 +7,8 @@ define freeradius::sql ( ...@@ -7,6 +7,8 @@ define freeradius::sql (
$radius_db = 'radius', $radius_db = 'radius',
$num_sql_socks = '${thread[pool].max_servers}', $num_sql_socks = '${thread[pool].max_servers}',
$query_file = 'sql/${database}/dialup.conf', $query_file = 'sql/${database}/dialup.conf',
$lifetime = '0',
$max_queries = '0',
$ensure = present, $ensure = present,
) { ) {
$fr_package = $::freeradius::params::fr_package $fr_package = $::freeradius::params::fr_package
......
...@@ -92,13 +92,13 @@ sql { ...@@ -92,13 +92,13 @@ sql {
# such as TCP sessions expiring, you may need to set the socket # such as TCP sessions expiring, you may need to set the socket
# lifetime. If set to non-zero, any open connections will be # lifetime. If set to non-zero, any open connections will be
# closed "lifetime" seconds after they were first opened. # closed "lifetime" seconds after they were first opened.
lifetime = 0 lifetime = <%= @lifetime %>
# Maximum number of queries used by an SQL socket. If you are # Maximum number of queries used by an SQL socket. If you are
# having issues with SQL sockets lasting "too long", you can # having issues with SQL sockets lasting "too long", you can
# limit the number of queries performed over one socket. After # limit the number of queries performed over one socket. After
# "max_qeuries", the socket will be closed. Use 0 for "no limit". # "max_qeuries", the socket will be closed. Use 0 for "no limit".
max_queries = 0 max_queries = <%= @max_queries %>
# Set to 'yes' to read radius clients from the database ('nas' table) # Set to 'yes' to read radius clients from the database ('nas' table)
# Clients will ONLY be read on server startup. For performance # Clients will ONLY be read on server startup. For performance
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment