Chinaunix首页 | 论坛 | 博客
  • 博客访问: 461101
  • 博文数量: 237
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 0
  • 用 户 组: 普通用户
  • 注册时间: 2016-06-12 14:40
个人简介

  每个人生的当口,都是会有一个孤独的时刻,四顾无人,只有自己,于是不得不看明白自己的脆弱,自己的欲望,自己的念想,自己的界限,还有,自己真正的梦想。

文章分类

全部博文(237)

文章存档

2017年(3)

2016年(234)

分类: LINUX

2016-05-11 15:37:13


公司出口服务器是用的squid+mysql验证+iptables防火墙来控制用户上网的!我来了以后才知道公司出口服务器只有一台,没有备份用机,如果出口服务器硬件出问题,将导致整个公司网络瘫痪,于是申请了一台机器来搭建出口备份用服务器。

今天刚好有时间就来搭建下,但是出现了以前搭建时候没见过的问题,总结了下发出来,为大家以后安装遇到类似的问题提供参考!至于详细的安装过程,请搜索我以前在发的帖子《squid详细文档》,里面叙述得很清楚!先说下我的环境:

统:Red Hat Enterprise Linux AS release 4

Mysqlmysql-5.1.35.tar.gz

Mysql_authmysql_auth-0.8.tar.gz

Squidsquid-2.5.STABLE13.tar.gz

编译环境:gcc-3.4.6-3

下面是解决的过程:

当我把squidmysql以及mysql_auth都安装好了以后,权限等也设置好了,但是启动的时候穿线如下问题(添加验证配置之前是正常启动的)!

[root@gateway etc]# /usr/local/squid/sbin/squid -Nd 1

2009/06/24 11:11:57| Starting Squid Cache version 2.5.STABLE13 for i686-pc-linux-gnu...

2009/06/24 11:11:57| Process ID 28778

2009/06/24 11:11:57| With 8192 file descriptors available

2009/06/24 11:11:57| Performing DNS Tests...

2009/06/24 11:11:57| Successful DNS name lookup tests...

2009/06/24 11:11:57| DNS Socket created at 0.0.0.0, port 5018, FD 4

2009/06/24 11:11:57| Adding nameserver 210.53.31.2 from squid.conf

2009/06/24 11:11:57| helperOpenServers: Starting 5 'mysql_auth' processes

2009/06/24 11:11:57| Unlinkd pipe opened on FD 14

2009/06/24 11:11:57| Swap maxSize 20480000 KB, estimated 1575384 objects

2009/06/24 11:11:57| Target number of buckets: 78769

2009/06/24 11:11:57| Using 131072 Store buckets

2009/06/24 11:11:57| Max Mem  size: 49152 KB

2009/06/24 11:11:57| Max Swap size: 20480000 KB

2009/06/24 11:11:57| Rebuilding storage in /usr/local/squid/var/cache (DIRTY)

2009/06/24 11:11:57| Using Least Load store dir selection

2009/06/24 11:11:57| Current Directory is /usr/local/squid/etc

2009/06/24 11:11:57| Loaded Icons.

2009/06/24 11:11:57| Accepting HTTP connections at 0.0.0.0, port 2160, FD 16.

2009/06/24 11:11:57| WCCP Disabled.

2009/06/24 11:11:57| Ready to serve requests.

2009/06/24 11:11:57| WARNING: basicauthenticator #1 (FD 6) exited

2009/06/24 11:11:57| WARNING: basicauthenticator #2 (FD 7) exited

2009/06/24 11:11:57| WARNING: basicauthenticator #3 (FD 8) exited

2009/06/24 11:11:57| Too few basicauthenticator processes are running

FATAL: The basicauthenticator helpers are crashing too rapidly, need help!

Aborted

 

紧接着查看系统文件日志

less /var/log/messages

Jun 24 11:11:54 gateway squid: The basicauthenticator helpers are crashing too rapidly, need help!

 

因为一般squid有问题的话都会反应在这两个地方,此时还是看不出问题的所在,我上次也是同样的步骤没有出现这样的问题,于是googlebaidu了一遍,但是网上多半说是/usr/local/squid/etc/mysql_auth.conf文件权限的问题,于是

chmod 777 /usr/local/squid/etc/mysql_auth.conf

chown squid.squid  /usr/local/squid/etc/mysql_auth.conf

问题依旧!此时脑子一片空白了,没办法,又把所有的squid的日志文件都查看了一遍,在查看/usr/local/squid/var/logs/cache.log文件的时候惊喜的发现如下日志:

2009/06/23 16:41:48| Cache dir '/usr/local/squid/var/cache' size remains unchanged at 20480000 KB

2009/06/23 16:41:48| DNS Socket created at 0.0.0.0, port 5013, FD 8

2009/06/23 16:41:48| Adding nameserver 210.53.31.2 from squid.conf

2009/06/23 16:41:48| helperOpenServers: Starting 5 'mysql_auth' processes

(mysql_auth): error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: Permission denied

(mysql_auth): error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: Permission denied

(mysql_auth): error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: Permission denied

(mysql_auth): error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: Permission denied

2009/06/23 16:41:49| Accepting HTTP connections at 0.0.0.0, port 2160, FD 9.

2009/06/23 16:41:49| WCCP Disabled.

(mysql_auth): error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: Permission denied

2009/06/23 16:41:49| Loaded Icons.

2009/06/23 16:41:49| eventCleanup

2009/06/23 16:41:49| Ready to serve requests.

2009/06/23 16:41:49| WARNING: basicauthenticator #1 (FD 11) exited

2009/06/23 16:41:49| WARNING: basicauthenticator #2 (FD 12) exited

2009/06/23 16:41:49| WARNING: basicauthenticator #3 (FD 15) exited

2009/06/23 16:41:49| Too few basicauthenticator processes are running

 

原来是libmysqlclient.so.16文件权限有问题,问题就好解决了!首先查看该文件是否存在:

[root@gateway logs]# find / -name "libmysqlclient.so.16" -print

/lib/libmysqlclient.so.16

/usr/local/lib/libmysqlclient.so.16

/usr/local/mysql/lib/mysql/libmysqlclient.so.16

/usr/lib/libmysqlclient.so.16

/root/zhang/squid/mysql-5.1.35/libmysql/.libs/libmysqlclient.so.16

然后查看下mysql_auth文件调用的libmysqlclient.so.16是在哪个目录下,用ldd查看下:

[root@gateway libexec]# ldd mysql_auth

        libmysqlclient.so.16 => /lib/libmysqlclient.so.16 (0x008a8000)

        libc.so.6 => /lib/tls/libc.so.6 (0x0066f000)

        libcrypt.so.1 => /lib/libcrypt.so.1 (0x009ef000)

        libnsl.so.1 => /lib/libnsl.so.1 (0x00b37000)

        libm.so.6 => /lib/tls/libm.so.6 (0x007a2000)

        libz.so.1 => /usr/lib/libz.so.1 (0x00111000)

        /lib/ld-linux.so.2 (0x00651000)

好了,终于发现libmysqlclient.so.16的路径了,加上权限就可以了,

chmod 755  /lib/libmysqlclient.so.16

OK,启动下,一切正常,

[root@gateway ~]# /usr/local/squid/sbin/squid &

[root@gateway libexec]# ps -aux | grep squid

Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.3/FAQ

root      3948  0.0  0.1  4556  616 ?        Ss   14:09   0:00 /usr/local/squid/sbin/squid

squid     3950  0.1  0.9  8912 4856 ?        S    14:09   0:00 (squid)

squid     3951  0.0  0.1  4240  852 ?        Ss   14:09   0:00 (mysql_auth)

squid     3952  0.0  0.1  3320  852 ?        Ss   14:09   0:00 (mysql_auth)

squid     3953  0.0  0.1  4404  852 ?        Ss   14:09   0:00 (mysql_auth)

squid     3954  0.0  0.1  4296  852 ?        Ss   14:09   0:00 (mysql_auth)

squid     3955  0.0  0.1  3696  852 ?        Ss   14:09   0:00 (mysql_auth)

squid     3956  0.0  0.0  2740  272 ?        Ss   14:09   0:00 (unlinkd)

[root@gateway libexec]# netstat -lnp | grep squid

tcp        0      0 0.0.0.0:2160        0.0.0.0:*        LISTEN      3950/(squid)

udp        0     0 0.0.0.0:5007        0.0.0.0:*                     3950/(squid)

打开网页,终于出现了代理验证窗口,输入用户名密码,久违的网页终于出现了,至此问题解决!

 

通过这次问题的解决告诉我们,程序的日志文件非常的重要,如果程序出问题会第一时间反应在程序的日志文件甚至系统日志文件,所以我们解决问题的利剑就是利用日志文件!如果实在找不到问题的所在,那就把该程序的日志文件都浏览一遍,也许能发现一些蛛丝马迹!

阅读(1519) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~