nginx维护手册

7
nginx维护手册 Lei Yang <[email protected] > 11年7月13日星期三

Upload: lei-yang

Post on 10-Jun-2015

1.071 views

Category:

Technology


7 download

DESCRIPTION

写个同事的nginx维护手册

TRANSCRIPT

Page 1: Nginx维护手册

nginx维护手册Lei Yang <[email protected]>

11年7月13日星期三

Page 2: Nginx维护手册

nginx升级

跟随nginx stable release

当stable release升级后,在1周内升级到最新。不要立即升级,防止stable出现严重问题

编译参数保持稳定,每次调整邮件让组内同事知道:/opt/app/nginx/sbin/nginx -V

11年7月13日星期三

Page 3: Nginx维护手册

第三方模块升级

编译时用--add-module的是第三方模块

检查模块与新版本nginx的兼容性。如果没有相关说明,直接email模块作者询问

github上的模块使用Downloads里的tar包

11年7月13日星期三

Page 4: Nginx维护手册

第三方模块升级11年7月13日星期三

Page 5: Nginx维护手册

nginx debug(1)

当确认是nginx有问题才做,大部分时候nginx没问题。完成后core dump要保留

netscaler> disable server nginx_ipnginx> gdb attach nginx_pidgdb> gcorenginx> gdb /opt/app/nginx/sbin/nginx core.pidgdb> backtracenginx> /etc/init.d/nginx restartnetscaler> enable server nginx_ip

11年7月13日星期三

Page 6: Nginx维护手册

20485 20485 20485 ? Ss 0:00 nginx: master process /opt/app/nginx/sbin/nginx -c /opt/conf/nginx/nginx.conf20486 20485 20485 ? S 19:55 \_ nginx: worker process 20488 20485 20485 ? S 19:58 \_ nginx: worker process 20489 20485 20485 ? S 20:09 \_ nginx: worker process 20490 20485 20485 ? S 20:01 \_ nginx: worker process 20491 20485 20485 ? S 20:04 \_ nginx: worker process 20492 20485 20485 ? S 20:10 \_ nginx: worker process 20493 20485 20485 ? S 20:11 \_ nginx: worker process 20494 20485 20485 ? S 19:55 \_ nginx: worker process 20495 20485 20485 ? S 0:00 \_ nginx: cache manager process

nginx debug(2)

上述步骤不单对一个nginx进程:pgrep nginx #获得nginx进程号

master, cache manager进程必做;worker process做至少两个

11年7月13日星期三

Page 7: Nginx维护手册

nginx debug(3)

backtrace获取完后,写英文邮件发送到[email protected] 邮件列表

邮件内容:

先描述清楚问题,然后附上backtrace,最后给出操作系统版本,nginx编译参数。

邮件例子:http://forum.nginx.org/read.php?2,212274

11年7月13日星期三