Blog servmon 之前每次都会输出 PHP Warning: Module ‘imap’ already loaded 的错误信息,被 Cron Daemon 发到了 [email protected],再由本地 Postfix 转发到管理员私人邮箱,生成了大量垃圾邮件。原因是 imap module 已经被静态编译进 PHP,再以 so 的形式动态加载会发生冲突。现在修改了 /etc/php5/conf.d/imap.ini,注释掉 extension=imap.so 一行,问题解决。
月度归档: 2013年10月
mirrors 修复部分文件不能更新问题
mirrors 9月重装后使用 root 同步,一些文件 owner 变成了 root。对所有文件进行 chown,但事实上没有全部 chown。后来改用 mirror 用户同步,就有一些文件一直不能同步成功(Permission Denied)。感谢 HUANG Jianbo 的反馈。
chown 时使用的命令是 chown -R /srv/{array/exports,array/repo,ftp1,ftp2,ftp3,ftp4},而 ftp1,ftp2,ftp3,ftp4 是符号链接(链接到 /mnt/{d,e,f,g}),重装系统之前是直接挂载在这里的。对这些符号链接,chown 并没有 follow symlink,因此 ftp1,2,3,4 事实上没有 chown。正确的做法是在后面加 /,也就是 chown -R /srv/ftp{1,2,3,4}/。希望引以为戒。
mirrors 修复 page allocation failure
从 syslog 里看到,从9月3日(也就是 mirrors 最近一次故障刚恢复服务)开始,每天都有几十次甚至上百次 page allocation failure,最多的一天 266 次。诱发者大部分是 swapper/0,少数是 rsync,nginx,collectd。
Aron Xu 建议修改 sysctl 中的下列参数:
vm.vfs_cache_pressure=1000 vm.zone_reclaim_mode=2
现在不再出现 page allocation failure 了。
mirrors 修复 Debian 源缓存不一致问题
mirrors 在此前两个星期,Debian 源有时 Packages 文件与软件包有时会 MD5 不一致,这是因为 SSD cache 没有及时更新。本来是希望每次同步之后更新当前源,每6小时整体更新(failover,以防万一)。但实际出现了三次问题:
- 对 rsync 参数理解不对,旧缓存文件没有删除,导致 SSD 满了。现在自己写了个很丑的 bash 脚本来实现。
- ftpsync 的同步写在文件末尾,而末尾的 runmirrors 有可能失败,导致脚本提前退出,不执行更新。
- ftpsync 的同步写在 stage1 后,stage2 更新 Packages 和索引文件后并没有更新缓存。
ftpsync 真是个比较复杂的东西。非常抱歉这种间歇性的缓存不一致给 Debian 用户带来的麻烦。
Freeshell 修改及重置控制面板密码功能
登录 freeshell 后,可以点击 “Change Web Password” 修改控制面板密码(与虚拟机 SSH 密码无关)。
如果忘了控制面板密码,请用注册 freeshell 时的科大邮箱发邮件到 [email protected]。
有管理员权限的可以登录 freeshell,点击 admin area 中的 Search User 查找到这个用户的 appid,再点击 Reset Web Password,输入 appid,系统给用户发含有新随机密码的邮件。
登录失败的提示信息也做了改进。
freeshell 增加 process 和 socket 配额
为了让比较占资源的应用流畅地运行在 freeshell 上,增加了如下配额限制:
- 进程数(含内核线程)200 => 500
- TCP socket 数 100 => 500
- Non-TCP socket(包括 UNIX socket)数 100 => 1000
登录 freeshell.ustc.edu.cn,在 Control Panel 中可以看到虚拟机当前的进程数、TCP socket 数、Non-TCP socket 数。
mirrors 修复缓存更新慢的问题
现在设置了 trigger,每个源同步完成后都会立即更新这个源的 cache,而不用等每天凌晨统一更新 cache 了。这使得缓存不一致的时间缩短到秒级。
此外,由于 rsync 同步不够灵活,全部删掉再重新复制又太浪费,我重新发明了轮子来做同步。算法见下面的注释:
# There are actually 3 file lists: # - cache_list: files to be cached (param 1 of this func) # - WWWROOT: authoritative source # - CACHEROOT: cache files # After sync, CACHEROOT should contain up-to-date files in and only in the intersection of cache_list and WWWROOT. # So comes the algorithm: # 1. Remove files in CACHEROOT but not in cache_list # 2. Remove files in CACHEROOT but not in WWWROOT or not up-to-date # 3. Copy non-cached files in cache_list to CACHEROOT, if it exists in WWWROOT
完整的代码 git clone https://gitgeek.net/mirrors/ssd-cache.git
有问题,请找 [email protected]
Blog 和 Freeshell 服务器上配置了 Postfix,发往 [email protected] 和 [email protected] 的邮件会被转发到 [email protected]。
使用 blog 有任何问题请发邮件到 support@blog.ustc.edu.cn,freeshell 请发邮件到 [email protected]。
Freeshell 增加首页跳转和 Logout
之前访问 freeshell.ustc.edu.cn 不会判断是否登录,害得大家重新输入用户名和密码。现在,如果处于登录状态,访问首页就会自动跳转到管理页面。
还增加了登出(Logout)功能,点击控制面板上的 Logout 即可。
为 freeshell 管理员提供了查询用户、查看 freeshell 状态、调整磁盘配额的工具。
如果大家发现 freeshell 磁盘快满了,可以给 [email protected] 发邮件说明原因,我们一般视情况给您增加磁盘配额。近期已经给 7 个 freeshell 增加配额。freeshell 的磁盘是稀缺资源,希望不用的文件尽快删除。
mirrors 部分源从磁盘阵列迁移到本地磁盘
由于磁盘阵列负载过高,io util 常年 100%,现将一些大源移到本地磁盘。选取目标磁盘主要有两个原则,一是空余空间足够,二是目前负载不高。
移到 sdd 上的源是 qtproject。sdd 上原有的源主要有 debian 和 gentoo。
移到 sde 上的源是 ubuntu 和 ubuntu-releases。sde 上原有的源主要有 CPAN,CTAN,deepin,opensuse 和 cygwin。
移到 sdf 上的源是 debian-cd。sdf 上原有的源主要有 centos,eclipse 和 archlinux。
To Mirrors Maintainers:移动源的步骤:
- 以 mirror 用户登录 sync LXC
- 在 screen 或 byobu 中 rsync -av /mnt/original-disk/mirror /mnt/new-disk/
- 修改 ~/etc/ 中对应的配置文件
- git commit -a -m “commit message” –author=”Your Name <[email protected]>”
- git push
- rsync 结束后,原子地替换掉 HTTP 根目录中的符号链接:ln -s /mnt/new-disk/mirror /tmp/
- mv /tmp/mirror /srv/www/
- 检查 HTTP 是否可以正常访问。
- 如果有提供 FTP 服务,要到主机里修改 /etc/fstab,并 mount -a
- 如果有提供 rsync 服务,要到主机里修改 /etc/rsyncd.conf