最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

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

 更新時(shí)間:2014年03月06日 10:47:48   作者:  
這篇文章主要介紹了Nginx平滑升級(jí)的詳細(xì)操作方法,適應(yīng)編譯安裝ningx的情況,yum安裝的直接用yum更新即可,需要的朋友可以參考下

一、平滑升級(jí)概述
Nginx方便地幫助我們實(shí)現(xiàn)了平滑升級(jí)。其原理簡單概括,就是:
(1)在不停掉老進(jìn)程的情況下,啟動(dòng)新進(jìn)程。
(2)老進(jìn)程負(fù)責(zé)處理仍然沒有處理完的請(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í)過程
具體的操作也很簡單,如下:

(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 

可見新的進(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)程。過幾秒種可以看到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 

再過一小會(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.

 

相關(guān)文章

  • Nginx配置并開啟WebDAV服務(wù)的完整指南

    Nginx配置并開啟WebDAV服務(wù)的完整指南

    本文主要介紹了Nginx上配置并開啟WebDAV服務(wù)的完整指南,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2025-02-02
  • 前端異常502?bad?gateway的原因和解決辦法

    前端異常502?bad?gateway的原因和解決辦法

    本文詳細(xì)講解了前端異常502?bad?gateway的原因和解決辦法,文中通過示例代碼介紹的非常詳細(xì)。對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧<BR>
    2021-12-12
  • Nginx實(shí)現(xiàn)Nacos反向代理的項(xiàng)目實(shí)踐

    Nginx實(shí)現(xiàn)Nacos反向代理的項(xiàng)目實(shí)踐

    在日常的web網(wǎng)站部署中,經(jīng)常會(huì)用到nginx反向代理,本文主要介紹了Nginx實(shí)現(xiàn)Nacos反向代理的項(xiàng)目實(shí)踐,Nginx實(shí)現(xiàn)Nacos反向代理的項(xiàng)目實(shí)踐
    2022-03-03
  • Nginx防盜鏈與服務(wù)優(yōu)化配置的全過程

    Nginx防盜鏈與服務(wù)優(yōu)化配置的全過程

    由于Nginx本身的一些優(yōu)點(diǎn),輕量,開源,易用,越來越多的公司使用nginx作為自己公司的web應(yīng)用服務(wù)器,下面這篇文章主要給大家介紹了關(guān)于Nginx防盜鏈與服務(wù)優(yōu)化配置的相關(guān)資料,需要的朋友可以參考下
    2022-01-01
  • 聊聊配置?Nginx?訪問與錯(cuò)誤日志的問題

    聊聊配置?Nginx?訪問與錯(cuò)誤日志的問題

    這篇文章主要介紹了配置?Nginx?訪問與錯(cuò)誤日志,Nginx是一個(gè)開放源代碼的高性能HTTP和反向代理服務(wù)器,負(fù)責(zé)處理Internet上某些最大站點(diǎn)的負(fù)載,對(duì)Nginx?錯(cuò)誤日志相關(guān)知識(shí)感興趣的朋友一起看看吧
    2022-05-05
  • Nginx配置入門教程

    Nginx配置入門教程

    這篇文章主要介紹了Nginx配置入門教程,本文講解了反向代理的概念、初始配置、進(jìn)階配置、負(fù)載均衡配置等內(nèi)容,需要的朋友可以參考下
    2015-02-02
  • Windows系統(tǒng)下安裝及部署Nginx詳細(xì)教程(含多個(gè)站點(diǎn)部署)

    Windows系統(tǒng)下安裝及部署Nginx詳細(xì)教程(含多個(gè)站點(diǎn)部署)

    Nginx是一個(gè)很強(qiáng)大的高性能Web和反向代理服務(wù),也是一種輕量級(jí)的Web服務(wù)器,可以作為獨(dú)立的服務(wù)器部署網(wǎng)站,應(yīng)用非常廣泛,這篇文章主要給大家介紹了關(guān)于Windows系統(tǒng)下安裝及部署Nginx(含多個(gè)站點(diǎn)部署)的相關(guān)資料,需要的朋友可以參考下
    2024-01-01
  • Nginx使用反向代理實(shí)現(xiàn)負(fù)載均衡過程解析

    Nginx使用反向代理實(shí)現(xiàn)負(fù)載均衡過程解析

    這篇文章主要介紹了Nginx使用反向代理實(shí)現(xiàn)負(fù)載均衡過程解析,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2019-09-09
  • windows7下安裝PHP+nginx的方法

    windows7下安裝PHP+nginx的方法

    這篇文章主要介紹了windows7下安裝PHP+nginx的方法,較為詳細(xì)的分析了Windows7環(huán)境下安裝php與nginx服務(wù)器環(huán)境的具體步驟與相關(guān)設(shè)置技巧,需要的朋友可以參考下
    2016-05-05
  • NGINX基于cookie針對(duì)同一域名進(jìn)行分流轉(zhuǎn)發(fā)

    NGINX基于cookie針對(duì)同一域名進(jìn)行分流轉(zhuǎn)發(fā)

    本文介紹了利用NGINX基于cookie進(jìn)行多環(huán)境分流的方法,通過在Docker中部署兩個(gè)后端NGINX容器,并在前端NGINX配置中設(shè)置map規(guī)則,根據(jù)cookie值將請(qǐng)求分發(fā)到不同后端,感興趣的可以了解一下
    2025-07-07

最新評(píng)論

汉寿县| 内丘县| 岗巴县| 天祝| 五家渠市| 龙里县| 安庆市| 高碑店市| 阿拉尔市| 方正县| 额济纳旗| 临沧市| 永嘉县| 务川| 定陶县| 武强县| 楚雄市| 宜黄县| 贵南县| 大兴区| 垣曲县| 烟台市| 南雄市| 南皮县| 含山县| 壶关县| 江源县| 宝坻区| 正镶白旗| 新建县| 弥勒县| 武陟县| 株洲县| 楚雄市| 桐梓县| 建德市| 新营市| 安塞县| 乌兰浩特市| 罗平县| 濉溪县|