freeradius连接mysql数据库慢

【环境说明】

 服务器版本         redHat5.3

 mysql版本         MySQL5.6.22

 freeradius版本   2.1.12

【问题描述】

  配置好freeradius的sql.conf中的数据库地址,以及登录用户名和密码后,使用“radiusd -X”调试模式启动radius,控制台一直在漫长的输出尝试连接mysql的日 志,如下所示:

2014-12-30 09:27:39 DEBUG sql.c 93 - [RLM_SQL] Starting 0
2014-12-30 09:27:39 INFO sql.c 54 - [RLM_SQL] Attempting to connect rlm_sql_mysql #0
2014-12-30 09:27:39 INFO sql_mysql.c 79 - [RLM_SQL_MYSQL] Starting connect to MySQL server for #0
2014-12-30 09:27:56 INFO sql.c 58 - [RLM_SQL] Connected new DB handle, #0
2014-12-30 09:27:56 DEBUG sql.c 93 - [RLM_SQL] Starting 1
2014-12-30 09:27:56 INFO sql.c 54 - [RLM_SQL] Attempting to connect rlm_sql_mysql #1
2014-12-30 09:27:56 INFO sql_mysql.c 79 - [RLM_SQL_MYSQL] Starting connect to MySQL server for #1
2014-12-30 09:28:12 INFO sql.c 58 - [RLM_SQL] Connected new DB handle, #1
2014-12-30 09:28:12 DEBUG sql.c 93 - [RLM_SQL] Starting 2
2014-12-30 09:28:12 INFO sql.c 54 - [RLM_SQL] Attempting to connect rlm_sql_mysql #2
2014-12-30 09:28:12 INFO sql_mysql.c 79 - [RLM_SQL_MYSQL] Starting connect to MySQL server for #2
2014-12-30 09:28:28 INFO sql.c 58 - [RLM_SQL] Connected new DB handle, #2
2014-12-30 09:28:28 DEBUG sql.c 93 - [RLM_SQL] Starting 3
2014-12-30 09:28:28 INFO sql.c 54 - [RLM_SQL] Attempting to connect rlm_sql_mysql #3
2014-12-30 09:28:28 INFO sql_mysql.c 79 - [RLM_SQL_MYSQL] Starting connect to MySQL server for #3
2014-12-30 09:28:44 INFO sql.c 58 - [RLM_SQL] Connected new DB handle, #3
2014-12-30 09:28:44 DEBUG sql.c 93 - [RLM_SQL] Starting 4
2014-12-30 09:28:44 INFO sql.c 54 - [RLM_SQL] Attempting to connect rlm_sql_mysql #4
2014-12-30 09:28:44 INFO sql_mysql.c 79 - [RLM_SQL_MYSQL] Starting connect to MySQL server for #4
2014-12-30 09:29:00 INFO sql.c 58 - [RLM_SQL] Connected new DB handle, #4
2014-12-30 09:29:00 DEBUG sql.c 93 - [RLM_SQL] Starting 5
2014-12-30 09:29:00 INFO sql.c 54 - [RLM_SQL] Attempting to connect rlm_sql_mysql #5
2014-12-30 09:29:00 INFO sql_mysql.c 79 - [RLM_SQL_MYSQL] Starting connect to MySQL server for #5
2014-12-30 09:29:17 INFO sql.c 58 - [RLM_SQL] Connected new DB handle, #5
2014-12-30 09:29:17 DEBUG sql.c 93 - [RLM_SQL] Starting 6
2014-12-30 09:29:17 INFO sql.c 54 - [RLM_SQL] Attempting to connect rlm_sql_mysql #6
2014-12-30 09:29:17 INFO sql_mysql.c 79 - [RLM_SQL_MYSQL] Starting connect to MySQL server for #6
2014-12-30 09:29:32 INFO sql.c 58 - [RLM_SQL] Connected new DB handle, #6
2014-12-30 09:29:32 DEBUG sql.c 93 - [RLM_SQL] Starting 7
2014-12-30 09:29:32 INFO sql.c 54 - [RLM_SQL] Attempting to connect rlm_sql_mysql #7
2014-12-30 09:29:32 INFO sql_mysql.c 79 - [RLM_SQL_MYSQL] Starting connect to MySQL server for #7
2014-12-30 09:29:48 INFO sql.c 58 - [RLM_SQL] Connected new DB handle, #7
2014-12-30 09:29:48 DEBUG sql.c 93 - [RLM_SQL] Starting 8
2014-12-30 09:29:48 INFO sql.c 54 - [RLM_SQL] Attempting to connect rlm_sql_mysql #8
2014-12-30 09:29:48 INFO sql_mysql.c 79 - [RLM_SQL_MYSQL] Starting connect to MySQL server for #8
2014-12-30 09:30:04 INFO sql.c 58 - [RLM_SQL] Connected new DB handle, #8
2014-12-30 09:30:04 DEBUG sql.c 93 - [RLM_SQL] Starting 9
2014-12-30 09:30:04 INFO sql.c 54 - [RLM_SQL] Attempting to connect rlm_sql_mysql #9
2014-12-30 09:30:04 INFO sql_mysql.c 79 - [RLM_SQL_MYSQL] Starting connect to MySQL server for #9
2014-12-30 09:30:21 INFO sql.c 58 - [RLM_SQL] Connected new DB handle, #9
2014-12-30 09:30:21 DEBUG sql.c 93 - [RLM_SQL] Starting 10
2014-12-30 09:30:21 INFO sql.c 54 - [RLM_SQL] Attempting to connect rlm_sql_mysql #10
2014-12-30 09:30:21 INFO sql_mysql.c 79 - [RLM_SQL_MYSQL] Starting connect to MySQL server for #10
2014-12-30 09:30:37 INFO sql.c 58 - [RLM_SQL] Connected new DB handle, #10

到99以后提示失败,经查阅相关资料,进行如下处理即解决问题

【解决办法】

 原理:关闭mysql服务器连接的域名解析

 步骤:

        1 vim /usr/my.cnf; mysql5.6.22版的配置文件在/usr/下,编辑my.cnf,在[mysqld]下增加一行“skip-name-resovle”,保存退出;

        2 重启mysql;

        3 重新启动radius;

 【可能存在问题】

        mysql客户端连接服务器时,服务器会对客户端进行反向域名解析,因此这个是耗时多的原因,取消域名解析以后,mysql的权限表(user表)中将不能再使用类似localhost之类的主机名,而必须使用ip地址。

---- <仅供参考> ----

posted on 2014-12-30 10:14  书心  阅读(615)  评论(0编辑  收藏  举报

导航