postfix邮件占用ubuntu服务器内存过多

postfix邮件占用ubuntu服务器内存过多

我遇到一个问题,邮件服务器总是崩溃。经过调查,我发现这是一个系统内存问题。服务器有 8GB 的​​ Ram,我将其增加到 16GB。现在情况好多了,但仍然消耗太多内存。

以下是我的服务器中的顶级进程:

top

top - 15:36:40 up  7:58,  1 user,  load average: 91.59, 92.19, 91.31
Tasks: 455 total,  92 running, 306 sleeping,   0 stopped,   0 zombie
%Cpu(s): 96.4 us,  1.0 sy,  0.0 ni,  0.0 id,  0.0 wa,  0.0 hi,  0.0 si,  2.6 st
KiB Mem : 16424716 total,  2802776 free, 12251708 used,  1370232 buff/cache
KiB Swap:   924356 total,   924356 free,        0 used.  3784484 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                                                                                
  964 clamav    20   0 1645784 1.273g  32748 S   0.0  8.1   4:18.12 clamd                                                                                                                                  
 1553 gdm       20   0 4443620 208048  95508 S   0.0  1.3   2:05.02 gnome-shell                                                                                                                            
 3413 amavis    20   0  356716 154252   9072 S   0.0  0.9   0:07.12 /usr/sbin/amavi                                                                                                                        
 3040 amavis    20   0  347712 149016  11156 S   0.0  0.9   0:08.39 /usr/sbin/amavi                                                                                                                        
 5892 root      20   0  370164 136068  25584 S   0.0  0.8   2:13.00 python                                                                                                                                 
 4493 root      20   0  370336 135972  25132 S   0.0  0.8   2:13.02 python                                                                                                                                 
 8301 root      20   0  368636 134792  25836 S   0.0  0.8   2:00.70 python                                                                                                                                 
 7144 root      20   0  368792 134440  25144 S   0.0  0.8   2:07.06 python                                                                                                                                 
 9649 root      20   0  368120 134328  25884 S   0.0  0.8   1:56.14 python                                                                                                                                 
10783 root      20   0  367268 133152  25420 S   0.0  0.8   1:53.38 python                                                                                                                                 
13154 root      20   0  367348 132748  25648 S   0.0  0.8   1:36.12 python                                                                                                                                 
11919 root      20   0  366560 132388  25444 S   0.0  0.8   1:43.54 python                                                                                                                                 
14346 root      20   0  367096 131868  25016 S   2.6  0.8   1:31.55 python                                                                                                                                 
19062 root      20   0  366328 131736  25652 S   0.3  0.8   1:19.97 python                                                                                                                                 
16717 root      20   0  365796 131604  25420 S   0.0  0.8   1:24.49 python                                                                                                                                 
17853 root      20   0  365536 131392  25472 S   0.0  0.8   1:21.33 python                                                                                                                                 
15498 root      20   0  365796 131320  25140 S   0.0  0.8   1:29.81 python                                                                                                                                 
20243 root      20   0  365284 131140  25460 S   0.0  0.8   1:19.88 python                                                                                                                                 
  279 root      19  -1  242048 130968 126460 S   0.3  0.8   1:15.33 systemd-journal                                                                                                                        
26318 root      20   0  364768 130960  25788 S   0.0  0.8   1:09.60 python                                                                                                                                 
32401 root      20   0  365308 130912  25832 S   0.0  0.8   0:59.69 python                                                                                                                                 
22580 root      20   0  366072 130868  25036 S   0.3  0.8   1:08.76 python                                                                                                                                 
21384 root      20   0  365020 130852  25444 S   0.0  0.8   1:17.45 python                                                                                                                                 
27530 root      20   0  364512 130736  25824 S   0.0  0.8   1:07.66 python                                                                                                                                 
28671 root      20   0  364508 130684  25772 S   0.0  0.8   1:04.15 python                                                                                                                                 
29843 root      20   0  364512 130672  25756 S   0.0  0.8   0:59.03 python                                                                                                                                 
25090 root      20   0  364768 130492  25320 S   0.0  0.8   1:05.57 python                                                                                                                                 
23942 root      20   0  364768 130296  25132 S   0.0  0.8   1:12.47 python                                                                                                                                 
 7924 root      20   0  365060 130240  25404 S   0.3  0.8   0:50.47 python                                                                                                                                 
 9111 root      20   0  364788 130236  25668 S   0.0  0.8   0:48.10 python                                                                                                                                 
22928 root      20   0  364536 130160  25836 S   0.0  0.8   0:43.47 python                                                                                                                                 
31206 root      20   0  364256 130100  25460 S   0.3  0.8   0:59.90 python                                                                                                                                 
12915 root      20   0  364796 130000  25420 S   0.0  0.8   0:47.30 python                                                                                                                                 
21741 root      20   0  364536 129984  25656 S   0.0  0.8   0:43.85 python                                                                                                                                 
 6738 root      20   0  364004 129976  25852 S   0.0  0.8   0:51.10 python                                                                                                                                 
30436 root      20   0  364284 129956  25876 S   0.0  0.8   0:39.76 python                                                                                                                                 
 4116 root      20   0  363588 129940  25824 S   0.0  0.8   0:58.51 python                                                                                                                                 
26669 root      20   0  364280 129936  25856 S   0.0  0.8   0:39.85 python                                                                                                                                 
25399 root      20   0  364280 129884  25808 S   0.0  0.8   0:42.84 python                                                                                                                                 
 2866 root      20   0  364000 129864  25744 S   0.0  0.8   0:58.40 python                                                                                                                                 
 1283 root      20   0  364256 129836  25460 S   0.0  0.8   0:57.17 python                                                                                                                                 
29214 root      20   0  364276 129736  25656 S   0.0  0.8   0:39.39 python                                                                                                                                 
12123 root      20   0  364024 129712  25844 S   0.0  0.8   0:17.65 python                                                                                                                                 
32542 root      20   0  364032 129708  25840 S   0.0  0.8   0:22.26 python                                                                                                                                 
16486 root      20   0  364536 129640  25316 S   0.0  0.8   0:48.89 python                                                                                                                                 
29915 root      20   0  364024 129516  25656 S   0.3  0.8   0:22.66 python                                                                                                                                 
 5311 root      20   0  364000 129508  25388 S   0.0  0.8   0:54.04 python                                                                                                                                 
 9457 root      20   0  364020 129484  25620 S   0.0  0.8   0:17.12 python                                                                                                                                 
22049 root      20   0  364024 129480  25604 S   0.0  0.8   0:11.85 python                                                                                                                                 
20229 root      20   0  363488 129400  25776 S   0.0  0.8   0:42.52 python                                                                                                                                 
27892 root      20   0  363228 129324  25840 S   0.0  0.8   0:39.54 python                                                                                                                                 
11732 root      20   0  363744 129308  25428 S   0.0  0.8   0:46.03 python                                                                                                                                 
15344 root      20   0  363748 129284  25400 S   0.0  0.8   0:45.86 python                                                                                                                                 
14216 root      20   0  363740 129184  25320 S   0.0  0.8   0:46.72 python                                                                                                                                 

此外,postgredSql 达到 max_connections 然后由于来自 postfix 的请求过多而关闭。

以下是邮件的日志文件:

Feb 18 14:17:19 mail postfix/smtp[29560]: D3D5E2466DA: to=<[email protected]>, relay=none, delay=0.11, delays=0.1/0.01/0/0, dsn=5.4.6, status=bounced (mail for mail.MyDomain.de loops back to myself)
Feb 18 14:17:19 mail postfix/qmgr[3350]: D3D5E2466DA: removed
Feb 18 14:18:14 mail dovecot: imap-login: Login: user=<[email protected]>, method=PLAIN, rip=80.144.15.182, lip=173.212.211.113, mpid=7829, TLS, session=<OAIlQ/n05+pQkA+2>
Feb 18 14:18:18 mail dovecot: imap-login: Login: user=<[email protected]>, method=PLAIN, rip=80.144.15.182, lip=173.212.211.113, mpid=7849, TLS, session=<bwdWQ/n06OpQkA+2>
Feb 18 14:18:20 mail dovecot: imap-login: Login: user=<[email protected]>, method=PLAIN, rip=80.144.15.182, lip=173.212.211.113, mpid=7870, TLS, session=<3kR5Q/n06+pQkA+2>
Feb 18 14:18:20 mail postfix/pickup[6431]: 4D4DD246690: uid=132 from=<opendkim>
Feb 18 14:18:20 mail postfix/cleanup[2707]: 4D4DD246690: message-id=<[email protected]>
Feb 18 14:18:20 mail opendkim[1289]: 4D4DD246690: no signing table match for '[email protected]'
Feb 18 14:18:20 mail opendkim[1289]: 4D4DD246690: no signature data
Feb 18 14:18:20 mail postfix/qmgr[3350]: 4D4DD246690: from=<[email protected]>, size=1286, nrcpt=1 (queue active)
Feb 18 14:18:21 mail postfix/pickup[6431]: 67DEC246691: uid=0 from=<root>
Feb 18 14:18:21 mail postfix/cleanup[5432]: 67DEC246691: message-id=<[email protected]>
Feb 18 14:18:21 mail opendkim[1289]: 67DEC246691: no signing table match for '[email protected]'
Feb 18 14:18:21 mail opendkim[1289]: 67DEC246691: no signature data
Feb 18 14:18:21 mail postfix/pickup[6431]: B5152246696: uid=1005 from=<vmail>
Feb 18 14:18:21 mail postfix/cleanup[32236]: B5152246696: message-id=<[email protected]>
Feb 18 14:18:23 mail opendkim[1289]: B5152246696: no signing table match for '[email protected]'
Feb 18 14:18:23 mail opendkim[1289]: B5152246696: no signature data
Feb 18 14:18:25 mail postfix/qmgr[3350]: B5152246696: from=<[email protected]>, size=1261, nrcpt=1 (queue active)
Feb 18 14:18:26 mail postfix/qmgr[3350]: 67DEC246691: from=<[email protected]>, size=1241, nrcpt=1 (queue active)
Feb 18 14:18:27 mail postfix/smtp[27388]: 4D4DD246690: to=<[email protected]>, orig_to=<opendkim>, relay=none, delay=6.7, delays=0.3/6.4/0.08/0, dsn=5.4.6, status=bounced (mail for mail.MyDomain.de loops back to myself)
Feb 18 14:18:27 mail postfix/smtp[29560]: B5152246696: to=<[email protected]>, orig_to=<vmail>, relay=none, delay=5.3, delays=3.4/1.9/0/0, dsn=5.4.6, status=bounced (mail for mail.MyDomain.de loops back to myself)
Feb 18 14:18:27 mail postfix/smtp[27388]: 67DEC246691: to=<[email protected]>, orig_to=<root>, relay=none, delay=5.7, delays=5.6/0.08/0/0, dsn=5.4.6, status=bounced (mail for mail.MyDomain.de loops back to myself)
Feb 18 14:18:27 mail postfix/cleanup[2707]: 23AE42466F3: message-id=<[email protected]>
Feb 18 14:18:27 mail postfix/cleanup[32236]: 397BB24670C: message-id=<[email protected]>
Feb 18 14:18:27 mail postfix/bounce[7904]: 67DEC246691: sender non-delivery notification: 397BB24670C
Feb 18 14:18:27 mail postfix/qmgr[3350]: 397BB24670C: from=<>, size=3318, nrcpt=1 (queue active)
Feb 18 14:18:27 mail postfix/bounce[7903]: B5152246696: sender non-delivery notification: 23AE42466F3
Feb 18 14:18:27 mail postfix/qmgr[3350]: 67DEC246691: removed
Feb 18 14:18:27 mail postfix/qmgr[3350]: B5152246696: removed
Feb 18 14:18:27 mail postfix/qmgr[3350]: 23AE42466F3: from=<>, size=3345, nrcpt=1 (queue active)
Feb 18 14:18:27 mail postfix/smtp[29560]: 397BB24670C: to=<[email protected]>, relay=none, delay=0.81, delays=0.1/0.7/0/0, dsn=5.4.6, status=bounced (mail for mail.MyDomain.de loops back to myself)
Feb 18 14:18:27 mail postfix/smtp[27388]: 23AE42466F3: to=<[email protected]>, relay=none, delay=0.81, delays=0.8/0.01/0/0, dsn=5.4.6, status=bounced (mail for mail.MyDomain.de loops back to myself)
Feb 18 14:18:27 mail postfix/qmgr[3350]: 397BB24670C: removed
Feb 18 14:18:27 mail postfix/qmgr[3350]: 23AE42466F3: removed
Feb 18 14:18:28 mail postfix/cleanup[5432]: 0C3EC2466A0: message-id=<[email protected]>
Feb 18 14:18:28 mail postfix/bounce[3449]: 4D4DD246690: sender non-delivery notification: 0C3EC2466A0
Feb 18 14:18:28 mail postfix/qmgr[3350]: 0C3EC2466A0: from=<>, size=3391, nrcpt=1 (queue active)
Feb 18 14:18:28 mail postfix/qmgr[3350]: 4D4DD246690: removed
Feb 18 14:18:28 mail postfix/smtp[7902]: 0C3EC2466A0: to=<[email protected]>, relay=none, delay=1.4, delays=1.3/0.09/0.01/0, dsn=5.4.6, status=bounced (mail for mail.MyDomain.de loops back to myself)
Feb 18 14:18:28 mail postfix/qmgr[3350]: 0C3EC2466A0: removed
Feb 18 14:19:14 mail postfix/pickup[6431]: AFA9B246690: uid=132 from=<opendkim>
Feb 18 14:19:14 mail postfix/cleanup[2707]: AFA9B246690: message-id=<[email protected]>
Feb 18 14:19:14 mail opendkim[1289]: AFA9B246690: no signing table match for '[email protected]'
Feb 18 14:19:14 mail opendkim[1289]: AFA9B246690: no signature data
Feb 18 14:19:14 mail postfix/qmgr[3350]: AFA9B246690: from=<[email protected]>, size=6085, nrcpt=1 (queue active)
Feb 18 14:19:14 mail postfix/pickup[6431]: C90C5246691: uid=1005 from=<vmail>
Feb 18 14:19:14 mail postfix/cleanup[32236]: C90C5246691: message-id=<[email protected]>
Feb 18 14:19:14 mail opendkim[1289]: C90C5246691: no signing table match for '[email protected]'
Feb 18 14:19:14 mail opendkim[1289]: C90C5246691: no signature data
Feb 18 14:19:14 mail postfix/proxymap[7906]: warning: connect to pgsql server 127.0.0.1: FATAL:  remaining connection slots are reserved for non-replication superuser connections?
Feb 18 14:19:14 mail postfix/trivial-rewrite[5409]: warning: virtual_alias_domains: proxy:pgsql:/etc/postfix/sql-domain-aliases.cf: table lookup problem
Feb 18 14:19:14 mail postfix/trivial-rewrite[5409]: warning: virtual_alias_domains lookup failure

如您所见,邮件至[电子邮件保护]以及来自[电子邮件保护][电子邮件保护]即使在我们什么都没做的时候,我们也在继续奔跑。

我想这就是原因。这正常吗?我该如何阻止它们?如您所见,postgredSql 因它们而停止,现在邮件服务器不再可访问。

我不知道如何处理这个问题,或者这只是正常现象。我会很高兴得到任何帮助!

相关内容