CentOS消息推送失败的原因与解决方案
一 常见原因概览
二 邮件推送 SMTP 失败排查与修复
systemctl status postfix 或 systemctl status sendmail;查看日志:/var/log/maillog 或 /var/log/mail.log,关注关键字 error/warning/fail。yum install mailx -yset from=xxx@qq.com
set smtp=smtps://smtp.qq.com:465
set smtp-auth-user=xxx@qq.com
set smtp-auth-password=你的授权码
set smtp-auth=login
set ssl-verify=ignore
set nss-config-dir=/root/.certs
mkdir -p /root/.certs
echo -n | openssl s_client -connect smtp.qq.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/qq.crt
certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.certs -i ~/.certs/qq.crt
certutil -A -n "GeoTrust Global CA" -t "C,," -d ~/.certs -i ~/.certs/qq.crt
certutil -A -n "GeoTrust CA - G3" -t "Pu,Pu,Pu" -d ~/.certs -i qq.crt
cd /root/.certs && certutil -L -d /root/.certs
echo "test" | mail -s "title" target@example.commyhostname = mail.example.com
mydomain = example.com
inet_interfaces = all
inet_protocols = ipv4
home_mailbox = Maildir/
smtpd_sasl_auth_enable = yes
smtpd_tls_cert_file = /etc/pki/tls/certs/localhost.crt
smtpd_tls_key_file = /etc/pki/tls/private/localhost.key
smtpd_use_tls = yes
telnet smtp.qq.com 465 或 openssl s_client -connect smtp.qq.com:465。三 Apple APNs 推送失败排查与修复
curl --http2 https://http2.pro 应显示 **HTTP/2` 支持。四 消息队列与应用层推送排查与修复
ipcs -q、ipcs -m;定位是否有阻塞/满队列与进程卡死。top/vmstat/iostat 检查 CPU/内存/磁盘 IO;磁盘满会导致队列/进程异常。yum clean all)、重启队列服务(如 RabbitMQ),必要时重启应用;建立监控与告警(队列长度、消费延迟、磁盘使用率)。五 快速排查清单
ping/telnet/openssl s_client;云上优先尝试 465/587。df -h、free -m、ipcs -q/m、systemctl status postfix/sendmail/rabbitmq。