我摆弄了一下FreeRADIUS
,MySQL (MariaDB)
似乎 FreeRADIUS 服务在启动时无法正常启动。但它使用root
用户或调试模式 ( radiusd -X
) 启动正常,并且运行良好!调试模式没有显示任何错误。
systemctl
命令显示radiusdd.service启动失败。
/var/log/messages 输出:
Aug 21 15:52:29 nexus-test systemd: Starting The Apache HTTP Server...
Aug 21 15:52:29 nexus-test systemd: Starting MariaDB database server...
Aug 21 15:52:29 nexus-test systemd: Starting FreeRADIUS high performance RADIUS server....
Aug 21 15:52:29 nexus-test systemd: Started OpenSSH server daemon.
Aug 21 15:52:29 nexus-test mysqld_safe: 140821 15:52:29 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Aug 21 15:52:29 nexus-test mysqld_safe: 140821 15:52:29 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Aug 21 15:52:30 nexus-test systemd: Started Postfix Mail Transport Agent.
Aug 21 15:52:30 nexus-test avahi-daemon[604]: Registering new address record for fe80::250:56ff:fe85:e4af on eth0.*.
Aug 21 15:52:30 nexus-test systemd: radiusd.service: control process exited, code=exited status=1
Aug 21 15:52:30 nexus-test systemd: Failed to start FreeRADIUS high performance RADIUS server..
Aug 21 15:52:30 nexus-test systemd: Unit radiusd.service entered failed state.
Aug 21 15:52:31 nexus-test kdumpctl: kexec: loaded kdump kernel
Aug 21 15:52:31 nexus-test kdumpctl: Starting kdump: [OK]
Aug 21 15:52:31 nexus-test systemd: Started Crash recovery kernel arming.
Aug 21 15:52:31 nexus-test systemd: Started The Apache HTTP Server.
Aug 21 15:52:31 nexus-test systemd: Started MariaDB database server.
/var/log/radius/radius.log 输出:
Thu Aug 21 15:24:16 2014 : Info: rlm_sql (sql): Driver rlm_sql_mysql (module rlm_sql_mysql) loaded and linked
Thu Aug 21 15:24:16 2014 : Info: rlm_sql (sql): Attempting to connect to database "radius"
Thu Aug 21 15:24:16 2014 : Info: rlm_sql (sql): Opening additional connection (0)
Thu Aug 21 15:24:16 2014 : Error: rlm_sql_mysql: Couldn't connect socket to MySQL server radius@localhost:radius
Thu Aug 21 15:24:16 2014 : Error: rlm_sql_mysql: Mysql error 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
Thu Aug 21 15:24:16 2014 : Error: rlm_sql (sql): Opening connection failed (0)
Thu Aug 21 15:24:16 2014 : Error: /etc/raddb/mods-enabled/sql[47]: Instantiation failed for module "sql"
看到此问题后,我尝试复制该问题,终止mariadb.service
并再次开始运行调试模式。它又出现了与 中相同的问题radius.log
。
我尝试禁用iptables
并firewalld
重新启动,但没有成功:
systemctl disable iptables
systemctl disable firewalld
因此,问题可能出在进程启动顺序或某种延迟上。也许 FreeRADIUS 的 SQL 模块无法连接到尚未启动的 MariaDB?如果是,我该如何修复?
在 RHEL/CENTOS 的早期版本中,我知道您可以很容易地在 rc.d 之类的东西中看到服务启动顺序,现在我不知道了。我对 Centos 7 引入的这种花哨的“systemd”、“systemctl”、“firewalld”东西还不熟悉,所以很抱歉我有点困惑。还有这个新FreeRADIUS 3
结构...
附言:MariaDB 在启动时启用,FR DB 配置中的凭据正确
一点更新:
cat /etc/systemd/system/multi-user.target.wants/radiusd.service输出:
[Unit]
Description=FreeRADIUS high performance RADIUS server.
After=syslog.target network.target
[Service]
Type=forking
PIDFile=/var/run/radiusd/radiusd.pid
ExecStartPre=-/bin/chown -R radiusd.radiusd /var/run/radiusd
ExecStartPre=/usr/sbin/radiusd -C
ExecStart=/usr/sbin/radiusd -d /etc/raddb
ExecReload=/usr/sbin/radiusd -C
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target
答案1
谢谢,dawud
你把我推向了正确的方向。我现在要做的就是radiusd.service
在之后开始mariadb.service
。
我启动vim
并在部分/etc/systemd/system/multi-user.target.wants/radiusd.service
中添加了一行:[Unit]
After=mariadb.service
所以它看起来像这样:
[Unit]
Description=FreeRADIUS high performance RADIUS server.
After=syslog.target network.target
After=mariadb.service
重新启动后,FreeRADIUS 启动正常。
还此资源对我有点帮助。
答案2
您已设置 FreeRADIUS 以连接到本地 MySQL 服务器,但该服务器未运行。请启动服务器并重试。