欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

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

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

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

(0)查看當前版本
在存放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 

注意不要進行make install

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

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

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

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

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

(5)升級

復(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 

三、觀察進程變化

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

復(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 

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

復(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 

再過一小會兒觀察:

復(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配置二級域名的示例代碼

    nginx配置二級域名的示例代碼

    這篇文章主要介紹了nginx配置二級域名的示例代碼,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-08-08
  • 一文快速了解Nginx超時設(shè)置

    一文快速了解Nginx超時設(shè)置

    這篇文章主要給大家介紹了關(guān)于如何通過一文快速了解Nginx超時設(shè)置的相關(guān)資料,:后端正常的業(yè)務(wù)處理時間超過了nginx的超時時間,導(dǎo)致nginx主動返回504,為解決這個問題,我們網(wǎng)上搜索發(fā)現(xiàn)可以通過調(diào)整這幾個參數(shù)來調(diào)大nginx的超時時間,需要的朋友可以參考下
    2023-11-11
  • nginx反向代理踩過的坑及解決

    nginx反向代理踩過的坑及解決

    這篇文章主要介紹了nginx反向代理踩過的坑及解決方案,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2023-12-12
  • Nginx防盜鏈根據(jù)UA屏蔽惡意User Agent請求(防蜘蛛)

    Nginx防盜鏈根據(jù)UA屏蔽惡意User Agent請求(防蜘蛛)

    相對于 Apache,Nginx 占用的系統(tǒng)資源更少,更適合 VPS 使用。惡意盜鏈的 User Agent 無處不在,博客更換到 WordPress 沒幾天,就被 SPAM(垃圾留言)盯上,又被暴力破解后臺用戶名密碼。今天來介紹 Nginx 屏蔽惡意 User Agent請求的方法
    2016-07-07
  • 使用Nginx讓網(wǎng)站快速置灰的方法

    使用Nginx讓網(wǎng)站快速置灰的方法

    這篇文章主要介紹了使用Nginx讓網(wǎng)站快速置灰的方法,首先是查看當前編譯的版本是否支持http_sub_module模塊,如果不支持需要重新編譯增加此模塊,具體配置方法參考下本文
    2023-11-11
  • 詳解nginx upstream 配置和作用

    詳解nginx upstream 配置和作用

    這篇文章主要介紹了詳解nginx upstream 配置和作用,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-07-07
  • 詳解NGINX訪問https跳轉(zhuǎn)到http的解決方法

    詳解NGINX訪問https跳轉(zhuǎn)到http的解決方法

    這篇文章主要介紹了詳解NGINX訪問https跳轉(zhuǎn)到http的解決方法,非常具有實用價值,需要的朋友可以參考下
    2017-06-06
  • Nginx啟動、重啟失敗的一般解決方法和步驟

    Nginx啟動、重啟失敗的一般解決方法和步驟

    這篇文章主要介紹了Nginx啟動、重啟失敗的一般解決方法和步驟,本文沒啥技術(shù)含量,只是一個慣用手法的總結(jié),需要的朋友可以參考下
    2015-07-07
  • nginx http響應(yīng)限速的具體實現(xiàn)

    nginx http響應(yīng)限速的具體實現(xiàn)

    本文主要介紹了nginx http響應(yīng)限速的具體實現(xiàn),可以使用limite_rate和limit_rate_after來限制HTTP響應(yīng)的速度,具有一定的參考價值,感興趣的可以了解一下
    2024-05-05
  • uwsgi+nginx代理Django無法訪問靜態(tài)資源的解決

    uwsgi+nginx代理Django無法訪問靜態(tài)資源的解決

    這篇文章主要介紹了uwsgi+nginx代理Django無法訪問靜態(tài)資源,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-05-05

最新評論