AlmaLinux9 HAProxy サーバー  統計情報を参照する方法

環境
AlmaLinux release 9.2 (Turquoise Kodkod)

概要
HAProxy サーバーの統計情報がコマンドで参照できるように設定します。

操作手順
1.必要なパッケージをインストールします

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# dnf -y install socat
# dnf -y install socat
# dnf -y install socat

2.HAProxy の設定を確認します
# vi /etc/haproxy/haproxy.cfg

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
global
stats socket /var/lib/haproxy/stats
global 略 stats socket /var/lib/haproxy/stats
global
略
stats socket /var/lib/haproxy/stats

3.haproxyを再起動します
# systemctl restart haproxy

3.現在の状態を表示する
# echo “show info" | socat /var/lib/haproxy/stats stdio

4.統計情報を CSV 形式で出力する
# echo “show stat" | socat /var/lib/haproxy/stats stdio

5.現在のセッションを表示する

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# echo "show sess" | socat /var/lib/haproxy/stats stdio
# echo "show sess" | socat /var/lib/haproxy/stats stdio
# echo "show sess" | socat /var/lib/haproxy/stats stdio

 

AlmaLinux 9

Posted by arkgame