Hi Matthew, Thank you for the information provided. I have tried it out and managed to set up RADIUS to write accounting packets to both MySQL and PostgreSQL Databases. However, with regards to having RADIUS restarting when these are unavailable, I am still getting the below messages in debug, even though I have set *start=0 *and it is now showing so. Is there maybe somewhere else that I have to change apart from /etc/raddb/mods-enabled/sql please? rlm_sql (sql_local): Attempting to connect to database "radius" rlm_sql (sql_local): Initialising connection pool pool { start = 0 min = 3 max = 32 spare = 10 uses = 0 lifetime = 0 cleanup_interval = 30 idle_timeout = 60 retry_delay = 30 spread = no } rlm_sql (sql_local): Processing generate_sql_clients rlm_sql (sql_local) in generate_sql_clients: query is SELECT id, nasname, shortname, type, secret, server FROM nas rlm_sql (sql_local): 0 of 0 connections in use. You may need to increase "spare" rlm_sql (sql_local): Opening additional connection (0), 1 of 32 pending slots used rlm_sql_mysql: Starting connect to MySQL server rlm_sql_mysql: Couldn't connect to MySQL server radius@localhost:radius rlm_sql_mysql: MySQL error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) rlm_sql_mysql: Socket destructor called, closing socket rlm_sql (sql_local): Opening connection failed (0) Failed to load clients from SQL /etc/raddb/mods-enabled/sql_local[27]: Instantiation failed for module "sql_local" Thanks again. Kind Regards, SG On Tue, Aug 2, 2022 at 12:07 PM Matthew Newton <mcn@freeradius.org> wrote:
On 02/08/2022 10:09, Sea Gull wrote:
I would like to set up RADIUS to send accounting packets to a local MySQL database and a remote PostgreSQL database. From the research that I did, this does not seem to be possible unless having them set redundant to each other. Is there a possible way to achieve this, please?
Copy the sql module instance (/etc/raddb/mods-enabled/sql). Call one (for example) sql_local and the other sql_remote, and configure them appropriately - the local one for the mysql instance and the remote one for the postgresql instance:
sql sql_local { ... }
sql sql_remote { ... }
then call them both - rather than
sql
do
sql_local sql_remote
I have started by setting up RADIUS to write accounting packets to the remote PostgreSQL, which was successful. However, I needed to test that if the remote database is unavailable, RADIUS will still start up. Unfortunately, although I did the change below, RADIUS will not start if the PostgreSQL database is not available. How is it possible to accomplish this, if not as shown below, please?
pool { # Connections to create during module instantiation. # If the server cannot create specified number of # connections during instantiation it will exit. # Set to 0 to allow the server to start without the # database being available. start = 0
You've not set that - or at least not in the correct place. The debug output still shows the pool with "start = 5". Make sure you edit the pool section in /etc/raddb/mods-enabled/sql.
-- Matthew - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html