Este conteúdo não está disponível no idioma selecionado.
A.4. Install and Configure HAProxy
Perform the following procedure on your two HAProxy nodes:
- Install
haproxy.yum install haproxy
# yum install haproxyCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Configure
haproxyfor SELinux and HTTP.vim /etc/firewalld/services/haproxy-http.xml
# vim /etc/firewalld/services/haproxy-http.xmlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Add the following lines:Copy to Clipboard Copied! Toggle word wrap Toggle overflow As root, assign the correct SELinux context and file permissions to thehaproxy-http.xmlfile.cd /etc/firewalld/services restorecon haproxy-http.xml chmod 640 haproxy-http.xml
# cd /etc/firewalld/services # restorecon haproxy-http.xml # chmod 640 haproxy-http.xmlCopy to Clipboard Copied! Toggle word wrap Toggle overflow - If you intend to use HTTPS, configure
haproxyfor SELinux and HTTPS.vim /etc/firewalld/services/haproxy-https.xml
# vim /etc/firewalld/services/haproxy-https.xmlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Add the following lines:Copy to Clipboard Copied! Toggle word wrap Toggle overflow As root, assign the correct SELinux context and file permissions to thehaproxy-https.xmlfile.cd /etc/firewalld/services restorecon haproxy-https.xml chmod 640 haproxy-https.xml
# cd /etc/firewalld/services # restorecon haproxy-https.xml # chmod 640 haproxy-https.xmlCopy to Clipboard Copied! Toggle word wrap Toggle overflow - If you intend to use HTTPS, generate keys for SSL. If you do not have a certificate, you may use a self-signed certificate. For information on generating keys and on self-signed certificates, see the Red Hat Enterprise Linux System Administrator's Guide.Finally, put the certificate and key into a PEM file.
cat example.com.crt example.com.key > example.com.pem cp example.com.pem /etc/ssl/private/
# cat example.com.crt example.com.key > example.com.pem # cp example.com.pem /etc/ssl/private/Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Configure HAProxy.
vim /etc/haproxy/haproxy.cfg
# vim /etc/haproxy/haproxy.cfgCopy to Clipboard Copied! Toggle word wrap Toggle overflow Theglobalanddefaultssections ofhaproxy.cfgmay remain unchanged. After thedefaultssections, you will need to configurefrontendandbackendsections, as in the following example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Enable/start
haproxysystemctl enable haproxy systemctl start haproxy
# systemctl enable haproxy # systemctl start haproxyCopy to Clipboard Copied! Toggle word wrap Toggle overflow