激情久久久_欧美视频区_成人av免费_不卡视频一二三区_欧美精品在欧美一区二区少妇_欧美一区二区三区的

服務器之家:專注于服務器技術及軟件下載分享
分類導航

云服務器|WEB服務器|FTP服務器|郵件服務器|虛擬主機|服務器安全|DNS服務器|服務器知識|Nginx|IIS|Tomcat|

服務器之家 - 服務器技術 - Nginx - Nginx平滑升級的詳細操作方法

Nginx平滑升級的詳細操作方法

2019-10-16 12:54nginx技術網 Nginx

這篇文章主要介紹了Nginx平滑升級的詳細操作方法,適應編譯安裝ningx的情況,yum安裝的直接用yum更新即可,需要的朋友可以參考下

一、平滑升級概述
Nginx方便地幫助我們實現了平滑升級。其原理簡單概括,就是:
(1)在不停掉老進程的情況下,啟動新進程。
(2)老進程負責處理仍然沒有處理完的請求,但不再接受處理請求。
(3)新進程接受新請求。
(4)老進程處理完所有請求,關閉所有連接后,停止。
這樣就很方便地實現了平滑升級。一般有兩種情況下需要升級Nginx,一種是確實要升級Nginx的版本,另一種是要為Nginx添加新的模塊。
二.、升級過程
具體的操作也很簡單,如下:

(0)查看當前版本
在存放Nginx的可執行文件的目錄下輸入:

復制代碼代碼如下:
./nginx -V 

 

(1)下載新的Nginx版本并編譯。

復制代碼代碼如下:
wget nginx-1.0.11.tar.gz  
tar zxvf nginx-1.0.11.tar.gz  
cd nginx-1.0.11  
./configure --add-module=/customized_module_0 --add-module=/customized_module_1  
make 

 

注意不要進行make install

(2)備份老版本的可執行文件

復制代碼代碼如下:
cd /usr/local/nginx/sbin  
sudo cp nginx nginx.old 

 

(3)修改配置文件
如果有必要的話,進行配置文件的修改。

(4)拷貝新的可執行文件

復制代碼代碼如下:
sudo cp /home/michael/tmp/nginx-1.0.11/objs/nginx /usr/local/nginx/sbin/ 

 

(5)升級

復制代碼代碼如下:
cd /home/michael/tmp/nginx-1.0.11  
make upgrade 

 

(6)清理多余文件

復制代碼代碼如下:
rm -rf /home/michael/tmp/nginx-1.0.11 

 

(7)查看Nginx版本

復制代碼代碼如下:
cd /usr/local/nginx/sbin  
./nginx -V 


三、觀察進程變化

 

在我的機器上可以觀察到,我配置的是10個worker進程,啟動后觀察到:

復制代碼代碼如下:
root      6241 10419  0 10:51 ?        00:00:00 nginx: master process /usr/local/nginx/sbin/nginx  
nobody    6242  6241  2 10:51 ?        00:00:00 nginx: worker process        
nobody    6243  6241  0 10:51 ?        00:00:00 nginx: worker process        
nobody    6244  6241  0 10:51 ?        00:00:00 nginx: worker process        
nobody    6245  6241  0 10:51 ?        00:00:00 nginx: worker process        
nobody    6246  6241  0 10:51 ?        00:00:00 nginx: worker process        
nobody    6247  6241  0 10:51 ?        00:00:00 nginx: worker process        
nobody    6248  6241  0 10:51 ?        00:00:00 nginx: worker process        
nobody    6249  6241  0 10:51 ?        00:00:00 nginx: worker process        
nobody    6250  6241  0 10:51 ?        00:00:00 nginx: worker process        
nobody    6251  6241  1 10:51 ?        00:00:00 nginx: worker process        
nobody    6252  6241  0 10:51 ?        00:00:00 nginx: cache manager process  
nobody    6253  6241  0 10:51 ?        00:00:00 nginx: cache loader process  
luming    6310 25051  0 10:51 pts/1    00:00:00 grep --color=auto nginx  
nobody    7995 10419  0 Jan12 ?        00:20:37 nginx: worker process is shutting down  
nobody    7996 10419  0 Jan12 ?        00:20:11 nginx: worker process is shutting down  
nobody    7998 10419  0 Jan12 ?        00:20:04 nginx: worker process is shutting down  
nobody    8003 10419  0 Jan12 ?        00:20:12 nginx: worker process is shutting down  
root     10419     1  0 Jan08 ?        00:00:00 nginx: master process /usr/local/nginx/sbin/nginx 

 

可見新的進程有1個master和10個worker,另外還有1個老的master(可以從時間上看出)和4個worker(其他6個老的worker已經處理完所有連接而shutdown了)。還有一個loader進程。過幾秒種可以看到worker只有兩個了:

復制代碼代碼如下:
root      6241 10419  0 10:51 ?        00:00:00 nginx: master process /usr/local/nginx/sbin/nginx  
nobody    6242  6241  1 10:51 ?        00:00:00 nginx: worker process        
nobody    6243  6241  0 10:51 ?        00:00:00 nginx: worker process        
nobody    6244  6241  0 10:51 ?        00:00:00 nginx: worker process        
nobody    6245  6241  0 10:51 ?        00:00:00 nginx: worker process        
nobody    6246  6241  0 10:51 ?        00:00:00 nginx: worker process        
nobody    6247  6241  0 10:51 ?        00:00:00 nginx: worker process        
nobody    6248  6241  0 10:51 ?        00:00:00 nginx: worker process        
nobody    6249  6241  0 10:51 ?        00:00:00 nginx: worker process        
nobody    6250  6241  0 10:51 ?        00:00:00 nginx: worker process        
nobody    6251  6241  0 10:51 ?        00:00:00 nginx: worker process        
nobody    6252  6241  0 10:51 ?        00:00:00 nginx: cache manager process  
nobody    6253  6241  0 10:51 ?        00:00:00 nginx: cache loader process  
luming    6430 25051  0 10:51 pts/1    00:00:00 grep --color=auto nginx  
nobody    7996 10419  0 Jan12 ?        00:20:11 nginx: worker process is shutting down  
nobody    8003 10419  0 Jan12 ?        00:20:12 nginx: worker process is shutting down  
root     10419     1  0 Jan08 ?        00:00:00 nginx: master process /usr/local/nginx/sbin/nginx 

 

再過一小會兒觀察:

復制代碼代碼如下:
root      6241     1  0 10:51 ?        00:00:00 nginx: master process /usr/local/nginx/sbin/nginx  
nobody    6242  6241  0 10:51 ?        00:00:01 nginx: worker process        
nobody    6243  6241  0 10:51 ?        00:00:01 nginx: worker process        
nobody    6244  6241  0 10:51 ?        00:00:01 nginx: worker process        
nobody    6245  6241  0 10:51 ?        00:00:00 nginx: worker process        
nobody    6246  6241  0 10:51 ?        00:00:00 nginx: worker process        
nobody    6247  6241  0 10:51 ?        00:00:00 nginx: worker process        
nobody    6248  6241  0 10:51 ?        00:00:00 nginx: worker process        
nobody    6249  6241  0 10:51 ?        00:00:00 nginx: worker process        
nobody    6250  6241  0 10:51 ?        00:00:01 nginx: worker process        
nobody    6251  6241  0 10:51 ?        00:00:02 nginx: worker process        
nobody    6252  6241  0 10:51 ?        00:00:00 nginx: cache manager process  
luming    8680 25051  0 10:56 pts/1    00:00:00 grep --color=auto nginx 

 

Congratulations! You can upgrade your Nginx server gracefully.

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 中文字幕免费看 | chinese军人gay呻吟 | 鲁人人人鲁人人鲁精品 | 99精品视频在线观看免费 | 午夜视频在线观看免费视频 | av性色全交蜜桃成熟时 | 久久久久久久久久91 | 国产激爽大片在线播放 | 日韩视频在线视频 | 黄色网址在线免费播放 | 鲁丝一区二区二区四区 | 亚洲白嫩在线观看 | 99精品在线观看 | 精品国产99久久久久久宅男i | 亚洲午夜1000理论片aa | 老a影视网站在线观看免费 国产精品久久久久久久久久尿 | 在线观看中文字幕国产 | 亚洲精华液久久含羞草 | 久久久精品视频国产 | 中文字幕网在线 | 性片网站 | 俄罗斯16一20sex牲色另类 | 午夜影视一区二区 | 中文字幕精品一区久久久久 | 精品一区二区在线播放 | 黄色羞羞视频在线观看 | 国产乱一区二区三区视频 | 香蕉黄色网 | 免费a级黄色片 | 97伦理| 在线a| 日韩一级免费毛片 | 亚洲一区二区观看播放 | 成人一区二区三区在线 | 亚洲二区三区在线 | 91九色视频在线播放 | 操嫩草 | 91看片片 | 精品一区二区在线播放 | 日韩精品久久久久久久电影99爱 | 性aaa|