Debian 8 openSIPS 在启动结束时 MySQL 退出之前启动,并出现 MySQL 错误

Debian 8 openSIPS 在启动结束时 MySQL 退出之前启动,并出现 MySQL 错误

我在 Debian 8.10 上安装并配置了带有 MySQL 的 openSIPS 2.3,但在启动时 openSIPS 无法启动,因为它在 MySQL 之前启动并且无法连接到数据库。系统启动后可以正常启动opensips。

我在 openSIPS 邮件列表上找到了一个看起来像解决方案的解决方案,但我仍然遇到相同的错误。

到目前为止我所做的是编辑/etc/init.d/opensisp初始化信息并将其更改为

### BEGIN INIT INFO
# Provides:          opensips
# Required-Start:    $syslog $network $local_fs $time
# Required-Stop:     $syslog $network $local_fs
# Should-Start:      mysql #added this
# Should-Stop:       mysql #and this
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start the OpenSIPS SIP server
# Description:       Start the OpenSIPS SIP server
### END INIT INFO 

比我运行insserv -v opensips并重新启动,但它相同的 opensisp 失败并出现无法连接到数据库错误

ERROR:db_mysql:db_mysql_connect: driver error(2002): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
ERROR:db_mysql:db_mysql_new_connection: initial connect failed

根据/ętc/rc?.dmysql应该在opensips之前启动,但事实并非如此,或者当opensips启动时mysql没有完全启动。

rc这是mysql 和 opensips的转储

lrwxrwxrwx 1 root root 15 febr  23 21:56 /etc/rc0.d/K02mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr  23 21:56 /etc/rc1.d/K02mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr  23 21:56 /etc/rc2.d/S03mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr  23 21:56 /etc/rc3.d/S03mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr  23 21:56 /etc/rc4.d/S03mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr  23 21:56 /etc/rc5.d/S03mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr  23 21:56 /etc/rc6.d/K02mysql -> ../init.d/mysql

############

lrwxrwxrwx 1 root root 18 febr  25 01:17 /etc/rc0.d/K01opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr  25 01:17 /etc/rc1.d/K01opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr  27 10:40 /etc/rc2.d/S04opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr  27 10:40 /etc/rc3.d/S04opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr  27 10:40 /etc/rc4.d/S04opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr  27 10:40 /etc/rc5.d/S04opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr  25 01:17 /etc/rc6.d/K01opensips -> ../init.d/opensips

如何强制 openSIPS 等待 mysql?

相关内容