Show Table of Contents
A.4. HAProxy のインストールおよび設定
以下の手順を 2 つの HAProxy ノードで実行します。
haproxyをインストールします。#
yum install haproxy- SELinux および HTTP に対して
haproxyを設定します。#
vim /etc/firewalld/services/haproxy-http.xml以下の行を追加します。<?xml version="1.0" encoding="utf-8"?> <service> <short>HAProxy-HTTP</short> <description>HAProxy load-balancer</description> <port protocol="tcp" port="80"/> </service>
root ユーザーとして、適切な SELinux コンテキストとファイルパーミッションをhaproxy-http.xmlファイルに割り当てます。#
cd /etc/firewalld/services#restorecon haproxy-http.xml#chmod 640 haproxy-http.xml - HTTPS を使用する場合は、SELinux および HTTPS に対して
haproxyを設定します。#
vim /etc/firewalld/services/haproxy-https.xml以下の行を追加します。<?xml version="1.0" encoding="utf-8"?> <service> <short>HAProxy-HTTPS</short> <description>HAProxy load-balancer</description> <port protocol="tcp" port="443"/> </service>
root ユーザーとして、適切な SELinux コンテキストとファイルパーミッションをhaproxy-https.xmlファイルに割り当てます。#
cd /etc/firewalld/services#restorecon haproxy-https.xml#chmod 640 haproxy-https.xml - HTTPS を使用する場合は、SSL のキーを生成します。証明書がない場合は、自己署名証明書を使用できます。キーの生成や自己署名証明書に関する詳細は、Red Hat Enterprise Linux の『システム管理者のガイド』を参照してください。最後に、証明書と鍵を PEM ファイルに格納します。
#
cat example.com.crt example.com.key > example.com.pem#cp example.com.pem /etc/ssl/private/ - HAProxy を設定します。
#
vim /etc/haproxy/haproxy.cfghaproxy.cfgのglobalおよびdefaultsセクションは変更されません。以下の例のように、defaultsセクションの後にfrontendおよびbackendセクションを設定する必要があります。frontend http_web *:80 mode http default_backend rgw frontend rgw-https bind <insert vip ipv4>:443 ssl crt /etc/ssl/private/example.com.pem default_backend rgw backend rgw balance roundrobin mode http server rgw1 10.0.0.71:80 check server rgw2 10.0.0.80:80 check haproxyを有効にし、開始します。#
systemctl enable haproxy#systemctl start haproxy

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.