一区二区三区在线-一区二区三区亚洲视频-一区二区三区亚洲-一区二区三区午夜-一区二区三区四区在线视频-一区二区三区四区在线免费观看

服務(wù)器之家:專注于服務(wù)器技術(shù)及軟件下載分享
分類導(dǎo)航

云服務(wù)器|WEB服務(wù)器|FTP服務(wù)器|郵件服務(wù)器|虛擬主機(jī)|服務(wù)器安全|DNS服務(wù)器|服務(wù)器知識(shí)|Nginx|IIS|Tomcat|

服務(wù)器之家 - 服務(wù)器技術(shù) - Nginx - Nginx平滑升級(jí)的詳細(xì)操作方法

Nginx平滑升級(jí)的詳細(xì)操作方法

2019-10-16 12:54nginx技術(shù)網(wǎng) Nginx

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

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

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

復(fù)制代碼代碼如下:
./nginx -V 

 

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

復(fù)制代碼代碼如下:
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 

 

注意不要進(jìn)行make install

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

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

 

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

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

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

 

(5)升級(jí)

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

 

(6)清理多余文件

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

 

(7)查看Nginx版本

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


三、觀察進(jìn)程變化

 

在我的機(jī)器上可以觀察到,我配置的是10個(gè)worker進(jìn)程,啟動(dòng)后觀察到:

復(fù)制代碼代碼如下:
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 

 

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

復(fù)制代碼代碼如下:
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 

 

再過(guò)一小會(huì)兒觀察:

復(fù)制代碼代碼如下:
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.

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 武侠古典久久亚洲精品 | 日韩免费高清专区 | 久久视频精品3线视频在线观看 | 99久久国产亚洲综合精品 | 70老妇牲交毛片 | 午夜欧美精品久久久久久久 | 黑人性xxx | 91精品手机国产在线观 | 欧美又大又粗又长又硬 | 国产精品99爱免费视频 | 好爽轻点太大了太深了 | ts人妖另类国产 | 91传媒在线观看 | 99视频有精品 | 韩国美女被的免费视频 | 色天天综合色天天看 | 含羞草传媒网站免费进入欢迎 | 亚洲AV久久无码精品九号软件 | 亚洲欧美日韩另类在线 | 成年人网站免费在线观看 | 果冻传媒天美传媒在线小视频播放 | 男女拍拍拍免费视频网站 | 白丝萝莉h| 日韩免费毛片视频杨思敏 | 99久久999久久久综合精品涩 | 免费观看欧美性一级 | 四虎在线播放 | 青春草视频免费观看 | 艾秋麻豆果冻剧传媒在线播放 | 男女做性视频 | 99热这里只有精品国产免费 | 免费叼嘿视频 | 男人资源站| 日本最新伦中文字幕 | 波多洁野衣一二区三区 | 果冻传媒在线播放1 | 18性夜影院午夜寂寞影院免费 | 特黄特黄一级高清免费大片 | 久久视热频国产这里只有精品23 | 天堂伊人网 | 色多多在线观看视频 |