squid异常停止的排查步骤
- 今天重启squid的时候发现,squid启动后,status 一会就stop了
whoami@blackman:~/script/AutoProxy-master/main/server$ sudo service squid3 start squid3 start/running, process 19021 whoami@blackman:~/script/AutoProxy-master/main/server$ sudo service squid3 status squid3 start/running, process 19154 whoami@blackman:~/script/AutoProxy-master/main/server$ sudo service squid3 status squid3 stop/waiting
- 通过查看日志文件发现是了异常,提示中建议运行
squid -z
来检查swap 目录
FATAL: Failed to verify one of the swap directories, Check cache.log for details. Run 'squid -z' to create swap directories if needed, or if running Squid for the first time. Squid Cache (Version 3.3.8): Terminated abnormally. CPU Usage: 0.016 seconds = 0.009 user + 0.007 sys Maximum Resident Size: 73008 KB Page faults with physical i/o: 0
- 通过查看
squid -z
发现是因为权限的问题,导致缓存文件无法写入
whoami@blackman:~/script/AutoProxy-master/main/server$ /usr/sbin/squid3 -z whoami@blackman:~/script/AutoProxy-master/main/server$ 2018/01/24 11:26:12 kid1| Creating missing swap directories FATAL: Failed to make swap directory /var/cache/squid: (13) Permission denied 2018/01/24 11:26:15 kid1| Creating missing swap directories FATAL: Failed to make swap directory /var/cache/squid: (13) Permission denied
- 于是用
sudo chmod 777 /var/cache/squid/
就解决了,这里由于是局域网服务器,直接就是777,简单粗暴些。
whoami@blackman:~/script/AutoProxy-master/main/server$ sudo chmod 777 /var/cache/squid/ whoami@blackman:~/script/AutoProxy-master/main/server$ sudo /usr/sbin/squid3 -z whoami@blackman:~/script/AutoProxy-master/main/server$ 2018/01/24 11:29:42 kid1| Creating missing swap directories 2018/01/24 11:29:42 kid1| /var/cache/squid exists 2018/01/24 11:29:42 kid1| Making directories in /var/cache/squid/00 2018/01/24 11:29:42 kid1| Making directories in /var/cache/squid/01 2018/01/24 11:29:42 kid1| Making directories in /var/cache/squid/02 2018/01/24 11:29:42 kid1| Making directories in /var/cache/squid/03 2018/01/24 11:29:42 kid1| Making directories in /var/cache/squid/04 2018/01/24 11:29:42 kid1| Making directories in /var/cache/squid/05 2018/01/24 11:29:42 kid1| Making directories in /var/cache/squid/06 2018/01/24 11:29:42 kid1| Making directories in /var/cache/squid/07 2018/01/24 11:29:42 kid1| Making directories in /var/cache/squid/08 2018/01/24 11:29:42 kid1| Making directories in /var/cache/squid/09 2018/01/24 11:29:42 kid1| Making directories in /var/cache/squid/0A 2018/01/24 11:29:42 kid1| Making directories in /var/cache/squid/0B 2018/01/24 11:29:42 kid1| Making directories in /var/cache/squid/0C 2018/01/24 11:29:42 kid1| Making directories in /var/cache/squid/0D 2018/01/24 11:29:42 kid1| Making directories in /var/cache/squid/0E 2018/01/24 11:29:42 kid1| Making directories in /var/cache/squid/0F
到这里就解决了。squid -z
创建完swap 目录后,会停在那,我等了几分钟,等不急了,直接ctrl+c
给他结束了。然后service squid3 start
就正常了。
DEUBG手册:
- 出问题时先去翻日志文件,一般成熟的软件都有完善的日志记录,对定位异常非常有帮助 。
擅长爬虫、SEO、文本分类领域,交流微信 :z328134421