1.nginx的热部署(平滑升级)与版本回退
所谓热部署,就是在应用正在运行的时候升级软件,却不需要重新启动应用。
1.1 安装旧版本
1)现在我们有两个版本的nginx安装包:
[root@nginx2 nginx]# ls
nginx-1.15.9.tar.gz nginx-1.17.4.tar.gz
2)首先安装低版本的nginx:
[root@nginx2 nginx]# tar zxf nginx-1.15.9.tar.gz
[root@nginx2 nginx]# ls
nginx-1.15.9 nginx-1.15.9.tar.gz nginx-1.17.4.tar.gz
[root@nginx2 nginx]# cd nginx-1.15.9/
[root@nginx2 nginx-1.15.9]# ls
auto CHANGES CHANGES.ru conf configure contrib html LICENSE man README src
[root@nginx2 nginx-1.15.9]# ./configure --prefix=/usr/local/nginx/
成功。
[root@nginx2 nginx-1.15.9]# make && make install
[root@nginx2 nginx-1.15.9]# echo $?
0
[root@nginx2 nginx-1.15.9]# cd /usr/local/nginx/sbin/
[root@nginx2 sbin]# ls
nginx
[root@nginx2 sbin]# ./nginx
3)查看nginx工作进程:
[root@nginx2 sbin]# ps aux | grep nginx
avahi 665 0.0 0.1 30192 1760 ? Ss 12:48 0:00 avahi-daemon: running [nginx2.local]
root 5477 0.0 0.0 20496 612 ? Ss 12:55 0:00 nginx: master process ./nginx
nobody 5478 0.0 0.1 23032 1620 ? S 12:55 0:00 nginx: worker process
root 5645 0.0 0.0 112648 956 pts/0 R+ 13:04 0:00 grep --color=auto nginx
1.2 开始热部署进入新版本
1)首先备份nginx现有的二进制文件:
[root@nginx2 ~]# cd /usr/local/nginx/sbin/
[root@nginx2 sbin]