nginxとtengineがチェックモジュールを追加

1 nginxは、インストールされていないnginxにチェックモジュールをコンパイルしてインストールします

[ルート@ localhostの〜] wgetのhttps://github.com/yaoweibin/nginx_upstream_check_module/archive/v0.3.0.tar.gz 
[ルート@ localhostの〜] タールXF v0.3.0 
[ルート@ localhostの〜] #のCDのnginx_upstream_check_module -0.3.0 
[ルート@ localhostのnginx_upstream_check_module-0.3.0] LS -l 
合計260 
-rw-RW-r--の1ルートルート0 2014年10月2日CHANGES
 -rw-RW-r--の1つのルートルート5483 10月2日2014 check_1.2.1 .patch
 -rw-rw-r-- 1ルートルート7130 Oct 2 2014 check_1.2.2 + .patch
 -rw-rw-r-- 1ルートルート7094 Oct 2 2014 check_1.2.6 + .patch
 -rw -rw-r-- 1ルートルート6791 2014年10月2日check_1.5.12 +.patch
 -rw-rw-r-- 1ルートルート6701 2014年2月2日check_1.7.2 + .patch
 -rw-rw-r-- 1ルートルート6943 2014年10月2日check.patch
 -rw-rw-r-- 1ルートルート749 2014年2月2日config 
drwxrwxr -x 2ルートルート4096 2014年10月2日doc
 -rw-rw-r-- 1ルートルート1709 Oct 2 2014 nginx-sticky- module.patch 
drwxrwxr -x 2ルートルート4096 Oct 2 2014 nginx- tests
 -rw-rw-r-- 1 root root 46860 Oct 2 2014 ngx_http_upstream_check_handler.c
 -rw-rw-r-- 1 root root 3718 Oct 2 2014 ngx_http_upstream_check_handler.h
 -rw-rw-r-- 1 root root 112230 2014年10月2日ngx_http_upstream_check_module.c
-rw-rw-r-- 1ルートルート529 2014年10月2日ngx_http_upstream_check_module.h
 -rw-rw-r-- 1ルートルート2848 Oct 2 2014 ngx_http_upstream_jvm_route_module.patch
 -rw-rw-r-- 1ルートルート11384 10月2日2014 README 
drwxrwxr -x 6ルートルート4096 Oct 2 2014 テスト
 -rw-rw-r-- 1ルートルート3342 Oct 2 2014 アップストリーム
_fair.patch drwxrwxr -x 2ルートルート4096 Oct 2 2014 util 
[root @localhost nginx-1.8。 1] パッチ-p1 <../nginx_upstream_check_module-0.3.0/check_1.7.2+.patch 
パッチングファイルはsrc / HTTP /モジュール/ ngx_http_upstream_ip_hash_module.c 
パッチングファイルSRC / HTTP /モジュール/ngx_http_upstream_least_conn_module.c 
パッチファイルsrc / http / ngx_http_upstream_round_robin.c 
ハンク1は9でファズ2で成功しました 
ハンク2は95で成功しました(オフセット4行)。
ハンク3は159で成功しました(オフセット4行)。
ハンク4は227で成功しました(オフセット4行)。
ハンク5は339で成功しました(オフセット4行)。
ハンク6は381で成功しました(オフセット4行)。
ハンク7は443で成功しました(オフセット4行)。
ハンク8は541で成功しました(オフセット-1行)。
パッチファイルsrc / http /ngx_http_upstream_round_robin.h 
[ルート @localhostのnginx-1.8.1] ./configureを--add-モジュール= .. / nginx_upstream_check_module-0.3.0 / 
[ルート@ localhostのnginxの-1.8.1] メイク&& make installを     
メイクを[1 ]:ディレクトリ `/home/ceiec/nginx-1.8.1 'を残しています
[root @localhost nginx-1.8.1] / usr / local / nginx / sbin / nginx -t 
nginx:設定ファイル/ usr / local / nginx / confに/ nginx.conf構文okです
nginxの:設定ファイルは/ usr / local / nginxの/ confに/ nginx.confテストに成功している
[ルート @localhostのconf] 50 -nヘッドはnginx.conf 
    8080上流 {
         サーバー 10.11.1.11:8080 weight = 1 ; 
         server 10.11.1.17:8080 weight = 1 ; 
チェック間隔 = 3000上昇= 2落下= 2タイムアウト= 1000タイプ= http;

2 tengineをコンパイルしてインストールします

[ルート@ localhostの〜] タール-zxvf tengine-2.3.1.tar.gz 
[ルート@ localhostのtengine-2.3.1] ます。mkdir -pは/ opt / tengine 
[ルート@ localhostのtengine-2.3.1] ./ configure --prefix = / opt / tengine --without-http_upstream_keepalive_module \ 
 --add-module = modules / ngx_backtrace_module \
  --add-module = modules / ngx_debug_pool \
  --add-module = modules / ngx_debug_timer \
  --add-module = modules / ngx_http_concat_module \
  --add-module = modules / ngx_http_footer_filter_module \
  --add-module = modules / ngx_http_proxy_connect_module \
  --add-module = modules / ngx_http_reqstat_module \
 --add-module = modules / ngx_http_slice_module \
  --add-module = modules / ngx_http_sysguard_module \
  --add-module = modules / ngx_http_trim_filter_module \
  --add-module = modules / ngx_http_upstream_check_module \
  --add-module = modules / ngx_ent_cons_module___ent_cons_module___stream_http_upstream
  --addモジュール=モジュール/ ngx_http_upstream_dynamic_module \
  --addモジュール=モジュール/ ngx_http_upstream_dyups_module \
  --addモジュール=モジュール/ ngx_http_upstream_keepalive_module \
  --addモジュール=モジュール/ ngx_http_upstream_session_sticky_module \
  --addモジュール=モジュール/ ngx_http_user_agent_module 
[ルート@localhost tengine-2.3.1] メイク&& make installを 
[ルート@ localhostののconf] は/ opt / tengine / sbinに/ nginxの-V 
Tengineバージョン:Tengine / 2.3.1 
nginxのバージョン:nginxの /1.16.0 
のgccで構築された 4.4 
OpenSSL 1.0.1e-fipsでビルドされた .7 20120313(Red Hat 4.4.7-23 )(GCC) 2013年2月11日
TLS SNIサポートが有効になっている
構成引数:--prefix = / opt / tengine --without-http_upstream_keepalive_module --add-module = modules / ngx_backtrace_module --add-module = modules / ngx_debug_pool --add-module = modules / ngx_debug_timer --add-module = modules / ngx_http_concat_module- -add-module = modules / ngx_http_footer_filter_module --add-module = modules / ngx_http_proxy_connect_module --add-module = modules / ngx_http_reqstat_module --add-module = modules / ngx_http_slice_module --add-module = modules / ngx_http_sysguard_module --add-module =モジュール/ ngx_http_trim_filter_module --addモジュール=モジュール/ ngx_http_upstream_check_module --addモジュール=モジュール/ ngx_http_upstream_consistent_hash_module --addモジュール=モジュール/ ngx_http_upstream_dynamic_module --addモジュール=モジュール/ ngx_http_upstream_dyups_module --addモジュール=モジュール/ ngx_http_upstream_keepalive_module  - add-module = modules / ngx_http_upstream_session_sticky_module--add-module = modules /ngx_http_user_agent_module 
[ルート @localhostのconf] は/ opt / tengine / sbinに/ nginxの-c /opt/tengine/conf/nginx.conf 
[ルート@ localhostののconf] psの-ef | grepをnginxの 
ルート8000 1 0午前9時?00:00:00 nginx:マスタープロセス / opt / tengine / sbin / nginx -c / opt / tengine / conf / nginx.conf 
root       8001 8000 0 09:00?00:00:00 nginx:ワーカープロセス                                  
ルート       8002 8000 0 09:00?00:00:00 nginx:ワーカープロセス                                  
ルート       8003 8000 0 09:00?00:00:00 nginx:ワーカープロセス                                  
ルート       8004 8000 0 09:00?00:00:00 nginx:ワーカープロセス                                  
ルート       8010 26644 0 09:00 pts / 0 00:00:00 grep nginx 
[root @localhost keepalived] / opt / tengine / sbin / nginx -c / opt / tengine / conf / nginx.conf -t 
nginx:構成ファイル/ opt / tengine / conf / nginx.conf構文は問題ありません
nginx:構成ファイル / opt / tengine / conf / nginx.confテストが成功しました
[root @localhost keepalived] / etc / init.dディレクトリ/ keepalivedの開始 
[ルート@ localhostのkeepalivedの] IP A

3既存のnginxにチェックモジュールを追加します

[root @ localhost nginx_upstream_check_module-0.3.0] / usr / local / nginx / sbin / nginx -V 
nginx version:nginx / 1.8.1 
built by gcc 4.4.7 20120313(Red Hat 4.4.7-23 )(GCC)
configureの引数:
[ルート nginx_upstream_check_module-0.3.0 @localhost] CDの/home/ceiec/nginx-1.8.1 
[ルート@ localhostのnginxの-1.8.1] パッチ-p1 </home/test/nginx_upstream_check_module-0.3.0 /check_1.7.2+.patch 
パッチファイルsrc / http / modules / ngx_http_upstream_ip_hash_module.c 
パッチファイルsrc / http / modules / ngx_http_upstream_least_conn_module.c 
パッチファイルsrc / http / ngx_http_upstream_round_robin.c
ハンク1はファズ2で9に成功しました。 
ハンク2は95(オフセット4行)で成功しました。
ハンク3は159で成功しました(オフセット4行)。
ハンク4は227で成功しました(オフセット4行)。
ハンク5は339で成功しました(オフセット4行)。
ハンク6は381で成功しました(オフセット4行)。
ハンク7は443で成功しました(オフセット4行)。
ハンク8は541で成功しました(オフセット-1行)。
パッチファイルsrc / http / ngx_http_upstream_round_robin.h 
[root @localhost nginx-1.8.1]  ./configure --add-module = .. / nginx_upstream_check_module-0.3.0 
[ルート@ localhostのnginxの-1.8.1] メイク##注:のみ、以前のように、ここでは、コンパイラのニーズやパラメータを作るメイクインストールを実行しないでください、それ以外の場合は、使用されているnginxを上書きします) 
make [1]:ディレクトリ `/home/test/nginx-1.8.1 ' 残しますmake -f objs / Makefile manpage 
make [ 1]:Entering directory` / home / test / nginx -1.8.1 ' 
sed -e " s | %% PREFIX %% | / usr / local / nginx | " \
         -e " s | %% PID_PATH %% | /usr/local/nginx/logs/nginx.pid | " \
         -e " s | %% CONF_PATH %% | /usr/local/nginx/conf/nginx.conf | " \
        -e "s | %% ERROR_LOG_PATH %% | /usr/local/nginx/logs/error.log | " \ 
        <man /nginx.8> objs / nginx.8 
make [ 1]:ディレクトリ` /home/ceiec/nginx-1.8.1を残しています' 
[root @localhost nginx-1.8.1] / usr / local / nginx / sbinに/ nginxの-t 
nginxの:[EMERG]未知のディレクティブ" チェック"   /usr/local/nginx/conf/nginx.conf:24 
nginxの:設定ファイルは/ usr / local / nginxの/ confに/ nginx.confテストに失敗しました
[ root @localhost nginx-1.8.1] / usr / local / nginx / sbin / nginx 
nginx:[emerg]不明なディレクティブ" check "  in /usr/local/nginx/conf/nginx.conf:24

上記は、パッチが追加されると正常に追加されますが、コンパイルではまだチェックエラーが表示されることを示しています。

 

モジュール構文をチェック

チェック間隔=ミリ秒[fall = count] [rise = count] [timeout = milliseconds] [default_down = true | false ] [type = tcp | http | ssl_hello | mysql | ajp | fastcgi] 
チェック間隔 = 5000上昇= 1落下= 3タイムアウト= 4000 ;
    間隔をチェック= 3000上昇= 2落下= 5タイムアウト= 1000タイプ= ssl_hello; 
    確認間隔= 3000上昇= 2落下= 5タイムアウト= 1000タイプ= http; 
    check_http_send "HEAD / HTTP / 1.0 \ R \ n \ R \ n"; 
    check_http_expect_alive http_2xx http_3xx; 
默认配置:間隔= 3000秋= 5上昇= 2タイムアウト= 1000 default_down = タイプ= TCP * 
間隔:检测间隔3秒 
秋:连续检测失败次数5次时、认定relaserverがダウンしています
立ち上がり:连续检测成功2次时、认定relaserverがアップ
超时1:タイムアウト秒
default_down:初期状態はダウン、テストに合格した後のみup 
タイプ:検出タイプメソッドtcp
 1. tcp:tcpソケット、非推奨、バックエンドビジネスは100%開始されておらず、フロントエンドは解放されています
。2 .ssl_hello:helloメッセージを送信し、relaserver 3から返されたhelloメッセージを受信し
ます。http:上流のrelaserverを受信して​​処理するかどうかを判断するカスタム要求を送信します
。4. mysql:mysqlサーバーに接続し、上流のrelaserverがまだ存在するかどうかを判断し
ます。5 . ajp: AJP Cpingパケットを送信し、AJP Cpong応答を受信して​​解析し、上流のリラサーバーがまだ生きているかどうかを診断します(AJP tomcatに組み込まれているプロトコル)
 6. fastcgi:phpプログラムが生きているかどうか
check_http_send命令     
この命令は、HTTPパケットの検出、アナログLVSの検出を監視し、アナログ伝送のRealServerの後端にロード・バランサを可能にします。
check_http_expect_alive命令
check_http_expect_alive [http_2xx | http_3xx | http_4xx | http_5xx] 
は、テストが成功した場合でも期待どおりであっても、指定されたHTTPコードを返します

 

おすすめ

転載: www.cnblogs.com/yhq1314/p/12753719.html