Re: problem encounter when configure auto-failover for mysql (ChrisParker)
Hi Chris, I check out the latest CVS and tried, however the auto-failover still not working. I changed the part of the code to make it work, explicitly release a sql socket when a query fail, and get a new socket b4 every query execution. I wonder will this cause any performance issues, need your experty on this. Below is a portion of the rlm_sql.c code that I customized: (I append change at each line I customized) case PW_STATUS_START: if(sql_set_user(inst, request, sqlusername, 0) 0) return RLM_MODULE_FAIL; radius_xlat(querystr, MAX_QUERY_LEN, inst-config-accounting_start_query, request, NULL); query_log(inst, querystr); sqlsocket = sql_get_socket(inst); if (sqlsocket == NULL) return(RLM_MODULE_FAIL); //change if (querystr) { if ((inst-module-sql_query)(sqlsocket, inst-config, querystr) 0) { radlog(L_ERR, rlm_sql: Couldn't update SQL accounting for START packet - %s, (char *)(inst-module-sql_error)(sqlsocket, inst-config)); (inst-module-sql_finish_query)(sqlsocket, inst-config); //change sql_release_socket(inst, sqlsocket); //change radius_xlat(querystr, MAX_QUERY_LEN, inst-config-accounting_start_query_alt, request, NULL); query_log(inst, querystr); sqlsocket = sql_get_socket(inst); //change if (sqlsocket == NULL) //change return(RLM_MODULE_FAIL); //change if (querystr) { if ((inst-module-sql_query)(sqlsocket, inst-config, querystr) 0) { radlog(L_ERR, rlm_sql: Couldn't update SQL accounting START record - %s, (char*)(inst-module-sql_error)(sqlsocket, inst-config)); (inst-module-sql_finish_query)(sqlsocket, inst-config); //change sql_release_socket(inst, sqlsocket); //change return(RLM_MODULE_FAIL); //change } (inst-module-sql_finish_query)(sqlsocket, inst-config); } } (inst-module-sql_finish_query)(sqlsocket, inst-config); } break; //end of code thx -- Cheers, CM. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Re: problem encounter when configure auto-failover for mysql (Chris Parker)
CheongMeng [EMAIL PROTECTED] wrote: I check out the latest CVS and tried, however the auto-failover still not working. I changed the part of the code to make it work, explicitly release a sql socket when a query fail, and get a new socket b4 every query execution. I wonder will this cause any performance issues, need your experty on this. Yes, it will cause performance issues. Below is a portion of the rlm_sql.c code that I customized: (I append change at each line I customized) Uh, why do all that work? See 'doc/DIFFS' Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
problem encounter when configure auto-failover for mysql
Hi, I am using freeradius-0.5 and mysql 3.23.49. I tried to setup 2 accounting server for a radius server, ie: radius server A will always write accounting to mysql server B. when mysql server B down, radius server A should send accounting to its local mysql server. In my radiusd.conf : accounting { acct_unique attr_rewrite detail sql1 { fail = 1 notfound = 2 noop = return ok = return updated = return reject = return userlock = return invalid = return handled = return } sql2 { fail = 1 notfound = 2 noop = return ok = return updated = return reject = return userlock = return invalid = return handled = return } } I defined my sql1 and sql2 in the sql.conf as: sql1 = mysql server B sql2 = mysql server running at localhost. However, the failover didn't work when mysql server B down. Radius server didn't send accounting to the local mysql server. below is the error mesg I see when running the radius server in debug mode: rlm_sql: Reserving sql socket id: 4 rlm_sql: Couldn't update SQL accounting for START packet - Lost connection to MySQL server during query rlm_sql: Couldn't update SQLaccounting START record - MySQL server has gone away rlm_sql: Released sql socket id: 4 It failed even I use the redundant{} block in the radiusd.conf Can anyone kindly enlighten me? thx. -- Cheers, CM. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Re: problem encounter when configure auto-failover for mysql
At 04:54 PM 5/16/2002 +0800, CheongMeng wrote: Hi, I am using freeradius-0.5 and mysql 3.23.49. I tried to setup 2 accounting server for a radius server, ie: radius server A will always write accounting to mysql server B. when mysql server B down, radius server A should send accounting to its local mysql server. [ snip ] It failed even I use the redundant{} block in the radiusd.conf Can anyone kindly enlighten me? Upgrade to latest CVS version. Some of the return codes for failure states in the SQL module were not set properly so the behaviour was not what you'd expect. -Chris thx. -- Cheers, CM. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html -- \\\|||/// \ StarNet Inc. \ Chris Parker \ ~ ~ / \ WX *is* Wireless!\ Director, Engineering | |\ http://www.starnetwx.net \ (847) 963-0116 oOo---(_)---oOo--\-- \ Wholesale Internet Services - http://www.megapop.net - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Re: problem encounter when configure auto-failover for mysql
CheongMeng wrote: Hi, I am using freeradius-0.5 and mysql 3.23.49. I tried to setup 2 accounting server for a radius server, ie: radius server A will always write accounting to mysql server B. when mysql server B down, radius server A should send accounting to its local mysql server. i didn't know that failover is possible for accounting ... + -- DouRiX - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html