sql + ippool + redundancy

Konstantin Chekushin koch2 at inbox.lv
Thu Feb 4 11:30:24 CET 2010


I just started to learn source code of rlm_sqlippool.c to make changes
for my issue. (I want to make sensitive return code from
sqlippool_command and check it in sqlippool_postauth and if something
goes wrong, then at once try to allocate next sql connection from the
pool until I'll get an error "cannot allocate sql connection" (if one
sql server is down) and return code RLM_MODULE_FAIL.)
 I'm not C guru, but there is a strange things in the code of this
module.
Let's look at the function "sqlippool_postauth". There is an
allocation of the socket in the begining (string 571), but release
only at the end (string 652). What will happans, if this procedure
will return value untill this string? For example, when IP address
could not be allocated? (string 648) Does it mean, that this module
will "freez" pool connection and this may be a course of the
unavailability of all sql connections?
 Quoting Konstantin Chekushin : Hi! I have a question about failover
configuration.
 I have freeradius + sqlippool module for ip-assigning. I have 2
databases for redundancy (described in sql1 and sql2).
 my file from enabled-server:
 server allauth {
         listen {
                
type = auth
                
ipaddr = *
                
port = 1812
         }
         authorize {
                
auth_log
                
update control {
                        
Pool-Name = 'main_pool'
                
}
                
redundant {
                        
# we need this only to get new Pool-name, if user exist in our defined
group.
                        
sql1
                        
sql2
                
}
                
update control {
                        
# any user must be accepted.
                        
Auth-Type = 'Accept'
                
}
         }
         post-auth {
                
redundant {
                        
sqlippool1 # this module use sql1 for assigning
                        
sqlippool2 # this module use sql2 for assigning, if first will fails.
                        
main_pool
                
}
                
reply_log
         }
 }
 I've run the freeradius, but when I turned off my first database
(sql1), my redundancy in post-auth return incorrect code:, sqlippool1
returns "noop", neither "fail".
 May be I've selected the wrong way to solve my task? Any comments are
welcome... How can I switch ip-assigning on sqlippool2, when sql1
(used by sqlippool1) doesn't work?
 some information from log:
 Wed Feb  3 15:36:29 2010 : Error: rlm_sql (sql1): Failed to
connect DB handle #1
 Wed Feb  3 15:36:29 2010 : Error: rlm_sql (sql1): reconnect
failed, database down?
 Wed Feb  3 15:36:29 2010 : Error: sqlippool_command: database
query error in: 'COMMIT'
 Wed Feb  3 15:36:29 2010 : Info: [sqlippool1]  
expand: SELECT id FROM radippool  WHERE
pool_name='%{control:Pool-Name}' LIMIT 1 -> SELECT id FROM
radippool  WHERE pool_name='main_pool' LIMIT 1
 Wed Feb  3 15:36:29 2010 : Error: rlm_sql_mysql: Socket not
connected
 Wed Feb  3 15:36:29 2010 : Debug: rlm_sql (sql1): Attempting to
connect rlm_sql_mysql #1
 Wed Feb  3 15:36:29 2010 : Info: rlm_sql_mysql: Starting connect
to MySQL server for #1
 Wed Feb  3 15:36:29 2010 : Error: rlm_sql_mysql: Couldn't
connect socket to MySQL server user at ip:dbname
 Wed Feb  3 15:36:29 2010 : Error: rlm_sql_mysql: Mysql error
'Lost connection to MySQL server at 'reading initial communication
packet', system error: 0'
 Wed Feb  3 15:36:29 2010 : Error: rlm_sql (sql1): Failed to
connect DB handle #1
 Wed Feb  3 15:36:29 2010 : Error: rlm_sql (sql1): reconnect
failed, database down?
 Wed Feb  3 15:36:29 2010 : Error: sqlippool_query1: database
query error
 Wed Feb  3 15:36:29 2010 : Debug: rlm_sql (sql1): Released sql
socket id: 1
 Wed Feb  3 15:36:29 2010 : Info: [sqlippool1] IP address could
not be allocated as no pool exists with that name.
 Wed Feb  3 15:36:29 2010 : Info: +++[sqlippool1] returns noop
 Wed Feb  3 15:36:29 2010 : Info: ++- policy redundant returns
noop 

Links:
------
[1] mailto:koch2 at inbox.lv
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20100204/470b26ce/attachment.html>


More information about the Freeradius-Users mailing list