Squid Common commands

Source: Internet
Author: User
Tags disk usage

Squid routine maintenance process, a number of commonly used commands:

1. Initialize the cache directory you configured in squid.conf
Squid-z
If you have an error message, check the permissions of your cache directory.
You can use the use to change directory permissions:
Chown-r Squid:squid/cache Directory 2, debug your squid.conf, that is, verify the syntax and configuration of squid.conf.
Squid-k Parse
If squid.conf has syntax or misconfiguration, it will return a hint to you, if not returned, try to start squid. 3, start squid in the foreground and output the start-up process.
/usr/local/squid/sbin/squid-n-D1
If you have ready to server reques related information, the squid starts successfully.
Then CTRL + C, stop squid, and start it in a way that runs in the background.4, start squid running in the background.
squid-s
You can use Ps-ax |grep squid to see if the squid process exists. 5, stop squid
squid-k shutdown6, re-boot the modified squid.conf
Squid-k reconfigure-f/xxx/squid.conf
After squid has made configuration changes, you can use this command for squid configuration overloading.7. Add squid to the system startup item
vi/etc/rc.d/rc.local
/usr/local/squid/sbin/squid-s8. Modify the permissions of the cache directory.
Chown-r Squid:squid/cache Directory
The cache cache directory changes according to its own configuration, squid users and groups are Squid,squid
(Note: In the FreeBSD system, if our squid is listening on port 80, only the root user can boot). 9, modify the Squid log directory permissions
Chown-r squid:squid the directory where the log files are defined
This step is not suitable for every user who uses squid. Meaning to let squid have permission to write in this directory. 10. View your log document.
More/usr/local/squid/var/logs/access.log | grep tcp_mem_hit
The instructions can be seen during squid run, with those files being cached in memory by squid and returned to the access user.
More/usr/local/squid/var/logs/access.log | grep tcp_hit
This instruction can be seen during squid run, where those files are cached by squid into the cache directory and returned to the access user.
More/usr/local/squid/var/logs/access.log | grep Tcp_miss
This instruction can be seen during squid run, where those files are not cached by squid, but are fetched from the original server and returned to the access user. Two. Squid hit rate analysis
/usr/local/squid/bin/squidclient-p Mgr:info
/usr/local/squid/bin/squidclient-p Mgr:5min
You can see the detailed performance situation, where port is your proxy ports, 5min can be 60min get squid run status information: Squidclient-p mgr:info
Get Squid Memory usage: squidclient-p mgr:mem
Get a list of squid already cached: Squidclient-p mgr:bjects. Use it carefully,it may crash
Get squid disk usage: squidclient-p MGR:DISKD
Force update of a url:squidclient-p 80-m PURGE http://www.xxx.com/xxx.php
For more information, see: Squidclient-h or Squidclient-p Mgr:
Check hit rate:
Squidclient-h IP (specifically listening IP)-p 80 (Specific listening port) Mgr:info
third, regular removal of invalid data in Swap.state
/path/to/squid/sbin/squid-k rotate-f/path/to/squid/conf_file
Vi/etc/crontab
0 0 * * * root/usr/local/sbin/squid-k rotate-f/usr/local/etc/squid/squid1.conf
When squid applications run for some time, cache_ Dir corresponding to the Swap.state file will become more and more large, the invalid interface data more and more, which may affect the response time of squid, it is necessary to use the Rotate command to make squid clean swap.state inside the invalid data, reduce the size of swap.state.

Squid Common commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.