我正在运行AWS EC2实例常规的amazon linux风格。它目前正在运行Magento 2,并且只有1GB的ram,因为它只是一个测试服务器(一年免费!)。它似乎每晚都崩溃,我必须重新启动实例才能恢复SSH。检查var / log / messages显示OOM杀手可能正在消灭我的ssh。出于某种原因,php和crond出现了很多次。有人能指出我正确的调试方向,以缩小这些PHP和Crond进程的来源。以下是来自消息日志的剪辑:
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55106.923629] Mem-Info:
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55106.924640] active_anon:115361 inactive_anon:115370 isolated_anon:0
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55106.924640] active_file:708 inactive_file:495 isolated_file:0
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55106.924640] unevictable:0 dirty:0 writeback:0 unstable:0
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55106.924640] slab_reclaimable:2568 slab_unreclaimable:4748
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55106.924640] mapped:879 shmem:1 pagetables:9876 bounce:0
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55106.924640] free:1961 free_pcp:13 free_cma:0
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55106.938433] Node 0 DMA free:3972kB min:60kB low:72kB high:88kB active_anon:4832kB inactive_anon:4844kB active_file:96kB inactive_file:408kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:15988kB managed:15904kB mlocked:0kB dirty:0kB writeback:0kB mapped:28kB shmem:0kB slab_reclaimable:244kB slab_unreclaimable:372kB kernel_stack:240kB pagetables:680kB unstable:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:3212 all_unreclaimable? yes
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55106.957415] lowmem_reserve[]: 0 976 976 976
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55106.959655] Node 0 DMA32 free:3872kB min:3828kB low:4784kB high:5740kB active_anon:456612kB inactive_anon:456636kB active_file:2736kB inactive_file:1572kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:1032192kB managed:1003540kB mlocked:0kB dirty:0kB writeback:0kB mapped:3488kB shmem:4kB slab_reclaimable:10028kB slab_unreclaimable:18620kB kernel_stack:3712kB pagetables:38824kB unstable:0kB bounce:0kB free_pcp:52kB local_pcp:52kB free_cma:0kB writeback_tmp:0kB pages_scanned:46664 all_unreclaimable? yes
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55106.988129] lowmem_reserve[]: 0 0 0 0
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55106.998441] Node 0 DMA: 43*4kB (E) 63*8kB (EM) 46*16kB (EM) 22*32kB (UEMR) 5*64kB (MR) 2*128kB (R) 3*256kB (R) 1*512kB (R) 0*1024kB 0*2048kB 0*4096kB = 3972kB
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.008215] Node 0 DMA32: 274*4kB (UEMR) 19*8kB (R) 19*16kB (R) 13*32kB (R) 6*64kB (R) 2*128kB (R) 1*256kB (R) 2*512kB (R) 0*1024kB 0*2048kB 0*4096kB = 3888kB
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.018312] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=2048kB
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.023195] 1266 total pagecache pages
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.025399] 52 pages in swap cache
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.027423] Swap cache stats: add 710804, delete 710752, find 168673/295578
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.031609] Free swap = 0kB
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.033507] Total swap = 1048572kB
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.035550] 262045 pages RAM
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.037322] 0 pages HighMem/MovableOnly
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.039675] 7184 pages reserved
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.041568] [ pid ] uid tgid total_vm rss nr_ptes nr_pmds swapents oom_score_adj name
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.046576] [ 1508] 0 1508 2866 1 11 3 238 -1000 udevd
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.051456] [ 2026] 0 2026 2340 26 10 3 97 0 dhclient
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.056623] [ 2067] 0 2067 28018 24 26 3 86 -1000 auditd
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.061685] [ 2085] 0 2085 61847 62 23 3 176 0 rsyslogd
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.066646] [ 2101] 0 2101 1095 3 8 3 34 0 rngd
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.071259] [ 2115] 32 2115 8823 13 21 3 84 0 rpcbind
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.079086] [ 2132] 29 2132 9965 1 24 3 198 0 rpc.statd
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.084942] [ 2155] 81 2155 5448 1 15 3 76 0 dbus-daemon
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.079086] [ 2132] 29 2132 9965 1 24 3 198 0 rpc.statd
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.084942] [ 2155] 81 2155 5448 1 15 3 76 0 dbus-daemon
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.090856] [ 2255] 0 2255 19454 0 41 3 212 -1000 sshd
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.095863] [ 2280] 38 2280 7321 30 18 3 110 0 ntpd
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.100734] [ 2290] 0 2290 12027 0 26 3 145 0 vsftpd
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.105680] [ 2704] 0 2704 22241 43 45 3 420 0 sendmail
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.110775] [ 2712] 51 2712 20105 0 39 3 387 0 sendmail
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.116132] [ 2741] 0 2741 109631 11 198 4 1827 0 httpd
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.121252] [ 2749] 0 2749 29880 26 15 3 119 0 crond
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.126542] [ 2759] 0 2759 4267 0 13 3 45 0 atd
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.131429] [ 2786] 0 2786 1078 1 8 3 23 0 mingetty
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.136825] [ 2788] 0 2788 1078 1 8 3 23 0 mingetty
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.142284] [ 2790] 0 2790 1078 1 8 3 23 0 mingetty
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.147440] [ 2792] 0 2792 1078 1 8 3 22 0 mingetty
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.152566] [ 2794] 0 2794 1078 1 8 3 23 0 mingetty
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.157974] [ 2796] 0 2796 1078 1 8 3 23 0 mingetty
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.163385] [ 2801] 0 2801 2719 1 10 3 93 -1000 udevd
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.168763] [ 2802] 0 2802 2719 1 10 3 93 -1000 udevd
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.173841] [ 2804] 0 2804 1615 1 9 3 31 0 agetty
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.178963] [ 2841] 48 2841 118657 4 215 4 11156 0 httpd
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.184133] [ 2842] 48 2842 118657 4 215 4 11156 0 httpd
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.189346] [ 2843] 48 2843 118657 4 215 4 11156 0 httpd
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.194472] [ 2844] 48 2844 118657 4 215 4 11156 0 httpd
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.199467] [ 2845] 48 2845 118657 4 215 4 11156 0 httpd
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.204794] [ 2964] 48 2964 118657 4 215 4 11156 0 httpd
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.210517] [14102] 501 14102 59070 14152 70 3 1633 0 php
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.215530] [14111] 501 14111 36683 4 28 3 176 0 crond
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.220551] [14120] 501 14120 36683 3 28 3 177 0 crond
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.225583] [14126] 501 14126 107278 0 149 3 17380 0 php
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.231030] [14131] 501 14131 36683 3 28 3 177 0 crond
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.236207] [14136] 501 14136 107021 17 149 4 17152 0 php
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.241384] [14141] 501 14141 36683 3 28 3 177 0 crond
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.246511] [14145] 501 14145 107278 928 150 3 16478 0 php
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.251493] [14171] 501 14171 36683 3 28 3 177 0 crond
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.257445] [14175] 501 14175 106680 4726 145 3 12126 0 php
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.262515] [14179] 501 14179 106394 5093 144 4 11479 0 php
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.267307] [14182] 501 14182 36683 3 28 3 177 0 crond
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.272187] [14187] 501 14187 106397 6416 146 3 10136 0 php
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.277067] [14191] 501 14191 36683 3 28 3 177 0 crond
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.282002] [14195] 501 14195 106218 4022 146 3 12348 0 php
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.287346] [14199] 501 14199 106072 6103 148 3 10142 0 php
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.292576] [14205] 501 14205 36683 3 28 3 177 0 crond
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.297652] [14208] 501 14208 105941 7965 146 3 8150 0 php
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.302522] [14213] 501 14213 36683 3 28 3 177 0 crond
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.307727] [14215] 501 14215 36683 3 28 3 177 0 crond
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.313074] [14218] 501 14218 106857 12307 146 3 4547 0 php
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.317977] [14221] 501 14221 105659 9303 143 4 6486 0 php
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.322666] [14224] 501 14224 105136 10941 146 3 4292 0 php
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.327764] [14225] 501 14225 36683 3 28 3 177 0 crond
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.333212] [14226] 501 14226 36683 3 28 3 177 0 crond
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.338541] [14227] 501 14227 36683 3 28 3 177 0 crond
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.343450] [14230] 501 14230 104049 9848 139 3 4315 0 php
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.348530] [14231] 501 14231 91525 259 117 3 1141 0 php
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.353693] [14233] 501 14233 104752 10345 142 4 4562 0 php
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.358841] [14234] 501 14234 36683 3 28 3 177 0 crond
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.364203] [14235] 501 14235 36683 3 28 3 177 0 crond
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.369257] [14236] 501 14236 36683 3 28 3 177 0 crond
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.374474] [14240] 501 14240 103856 9789 140 3 4155 0 php
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.379243] [14241] 501 14241 91525 607 120 4 727 0 php
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.384435] [14242] 501 14242 104753 10925 141 4 3897 0 php
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.389379] [14272] 501 14272 36683 3 28 3 177 0 crond
Mar 3 12:40:14 ip-172-31-31-176 kernel: [55107.394313] [14273] 501 14273 36683 3 28 3 177 0 crond
答案 0 :(得分:0)
我想说t2.micro没有与Magento一起使用的必要计算能力。看起来你的cron脚本花费的时间太长了,而cron最终会开始更多,直到oom-killer必须开始。
我首先会检查EC2监控中的CPU积分,看看你是否还没有耗尽它们。如果你有,你可能想要切换到t2.small或更大(这不是免费的)。
答案 1 :(得分:-2)
您可以尝试添加多个实例并尝试使用负载平衡。