squid 3.5.12-20151128-r13959 失敗編
Raspberry Pi2でsquid 3.5.12-20151128-r13959 をビルドし、動かしたときに出た不具合です。
・rockを初期化しようとするとエラー …対応済み
・キャッシュディレクトリ作成がエラー …対応済み
・2GB以上のrockが作れない …対応済み
・cache.logにワーニングが記録される …放置
・たくさんログローテーションしてしまう …対応済み
・マルチインスタンス時、cachemgrの表示がおかしい …放置
rockを初期化しようとするとエラー
現象
キャッシュディレクトリ作成(squid -z)でエラー
$ sudo squid -z
----
2015/12/07 01:12:07| assertion failed: ../../src/ipc/AtomicWord.h:88: "Enabled()"
----
起動もエラー
----
$ sudo service squid start
[warn] Starting Squid HTTP Proxy: squid[....] Creating Squid HTTP Proxy cache structure ... (warning).
2015/12/07 01:14:17| assertion failed: ../../src/ipc/AtomicWord.h:88: "Enabled()"
Aborted
Aborted
failed!
----
原因と対策
C++11でコンパイルしていない。
configureのオプションにCXXFLAGS='-std=c++11'を追加する。
キャッシュディレクトリ作成がエラー
現象
$ sudo -u proxy squid -z
----
WARNING: Cannot write log file: /var/log/squid/cache.log
/var/log/squid/cache.log: Permission denied
messages will be sent to 'stderr'.
WARNING: Cannot write log file: /var/log/squid/cache.log
/var/log/squid/cache.log: Permission denied
messages will be sent to 'stderr'.
2015/12/08 20:35:05 kid2| Set Current Directory to /var/cache/squid
2015/12/08 20:35:05 kid2| Creating missing swap directories
2015/12/08 20:35:05 kid2| Creating Rock db: /var/lib/squid/rock
2015/12/08 20:35:05 kid2| ERROR: Failed to initialize Rock Store db in /var/lib/squid/rock; create error: (13) Permission denied
FATAL: Rock Store db creation error
Squid Cache (Version 3.5.12-20151128-r13959): Terminated abnormally.
CPU Usage: 0.040 seconds = 0.020 user + 0.020 sys
Maximum Resident Size: 39408 KB
Page faults with physical i/o: 0
WARNING: Cannot write log file: /var/log/squid/cache.log
/var/log/squid/cache.log: Permission denied
messages will be sent to 'stderr'.
2015/12/08 20:35:05 kid3| Set Current Directory to /var/cache/squid
2015/12/08 20:35:05 kid3| Creating missing swap directories
WARNING: Cannot write log file: /var/log/squid/cache.log
/var/log/squid/cache.log: Permission denied
messages will be sent to 'stderr'.
2015/12/08 20:35:05 kid1| Set Current Directory to /var/cache/squid
2015/12/08 20:35:05 kid1| Creating missing swap directories
WARNING: Cannot write log file: /var/log/squid/cache.log
/var/log/squid/cache.log: Permission denied
messages will be sent to 'stderr'.
2015/12/08 20:35:08 kid2| Set Current Directory to /var/cache/squid
2015/12/08 20:35:08 kid2| Creating missing swap directories
2015/12/08 20:35:08 kid2| Creating Rock db: /var/lib/squid/rock
2015/12/08 20:35:08 kid2| ERROR: Failed to initialize Rock Store db in /var/lib/squid/rock; create error: (13) Permission denied
FATAL: Rock Store db creation error
Squid Cache (Version 3.5.12-20151128-r13959): Terminated abnormally.
CPU Usage: 0.040 seconds = 0.030 user + 0.010 sys
Maximum Resident Size: 39568 KB
Page faults with physical i/o: 0
WARNING: Cannot write log file: /var/log/squid/cache.log
/var/log/squid/cache.log: Permission denied
messages will be sent to 'stderr'.
2015/12/08 20:35:14 kid2| Set Current Directory to /var/cache/squid
2015/12/08 20:35:14 kid2| Creating missing swap directories
2015/12/08 20:35:14 kid2| Creating Rock db: /var/lib/squid/rock
2015/12/08 20:35:14 kid2| ERROR: Failed to initialize Rock Store db in /var/lib/squid/rock; create error: (13) Permission denied
FATAL: Rock Store db creation error
Squid Cache (Version 3.5.12-20151128-r13959): Terminated abnormally.
CPU Usage: 0.040 seconds = 0.030 user + 0.010 sys
Maximum Resident Size: 39568 KB
Page faults with physical i/o: 0
----
原因と対応
/var/run/squidのオーナーがrootになっているのが問題らしい
$ ll /var/run
----
drwxr-xr-x 2 root root 40 12月 7 00:38 squid
----
オーナーをproxyに変更する
$ sudo chown proxy.proxy /var/run/squid
2GB以上のrockが作れない
現象
キャッシュディレクトリ作成時にエラー
$ sudo -u proxy squid -z
----
ERROR: Failed to initialize Rock Store db in /var/cache/squid/rock; truncate error: (22) Invalid argument
----
原因と対応
ビルド時に2GB以上のファイルサポートを有効にしていない。
configureオプションに以下を追加する。
----
--with-large-files
----
cache.logにワーニングが記録される
現象
$ sudo view /var/log/squid/cache.log
----
WARNING: disk-cache maximum object size is too large for mem-cache: 4096.00 KB > 512.00 KB
----
原因と対応
不明。特に問題に問題ないのでそのまま使う。
たくさんログローテーションしてしまう
現象
一度に何世代もローテーションしてしまい、ログがめちゃめちゃになる。
$ ll /var/log/squid
----
-rw-r----- 1 proxy proxy 0 12月 13 06:25 access.log
-rw-r----- 1 proxy proxy 0 12月 13 06:25 access.log.0
-rw-r----- 1 proxy proxy 4360875 12月 14 01:09 access.log.1
-rw-r----- 1 proxy proxy 29476 12月 10 22:55 access.log.2
-rw-r----- 1 proxy proxy 76167 12月 7 20:28 access.log.3
-rw-r----- 1 proxy proxy 4465767 12月 13 06:24 access.log.4
-rw-r----- 1 proxy proxy 536326 12月 7 06:23 access.log.5
---
原因と対応
squid3.5ではsquid -k rotate 時にプロセスの数だけローテーションするため。
cache.log、access.log、cache_swap_logにはプロセス番号を付けるなど別ファイルに分けておく。
必要の無いログは出さないのも有効か。
$ sudo vi /etc/squid/squid.conf
----
cache_swap_log /var/log/squid/cache_swap_${process_number}.log
access_log none
cache_log /var/log/squid/cache_${process_number}.log
----
マルチインスタンス時、cachemgrの表示がおかしい
現象
cache_memで指定したサイズが表示されない。
$ sudo squidclient cachemgr mgr:info
----
Storage Mem size: 2128 KB
Storage Mem capacity: 51.9% used, 48.1% free
----
原因と対応
原因不明。コーディネータの情報だけが表示されているのではないか。
※その後、マルチインスタンスは使用しないことにしましたので、詳細不明です。
ということで、今回でsquid3.5ネタは一旦終了します。
最近のコメント