PC-23

"Sebaik-baik manusia adalah mereka yang bermanfaat bagi orang lain"

Breaking

Thursday, March 15, 2018

Lab 8.11 Balancer Manager with "lbmethod"


Pada kesempatan kali ini saya akan berbagi kepada anda, yaitu konfigurasi Balancer Manager with "lbmethod"

Berikut Konfigurasinya :


3 server
1. www.tkj.net = 192.168.43.100 (control) 
2. node1.tkj.net = 192.168.43.101 (node1) 
3. node2.tkj.net = 192.168.43.102 (node2) 

- configure DNS for www.tkj.net, node1.tkj.net, and node2.tkj.net in server control 
- configure DNS node1.tkj.net in server node1 and install httpd 
- configure DNS node2.tkj.net in server node2 and install httpd

configure load balance in server control

[root@control ~]# nano /etc/httpd/conf.d/r_proxy.conf

---------------------------------------------------------------------------------------
# create new
<IfModule mod_proxy.c> 
        ProxyRequests Off 
        <Proxy *> 
         Require all granted 
        </Proxy> 
        <proxy balancer://cluster> 
                BalancerMember http://node1.tkj.net/ 
                BalancerMember http://node2.tkj.net/ 
                ProxySet lbmethod=byrequests
        </proxy> 
# configure balancer-manager
        <Location /balancer-manager> 
             SetHandler balancer-manager 
        </Location> 
                ProxyPass /balancer-manager ! 
                ProxyPass / balancer://cluster/
</IfModule>
----------------------------------------------------------------------------------------

[root@control ~]# systemctl restart httpd

----------------------------------------------------------------------------------------

akses situs http://www.tkj.net/balancer-manager
karena balancer manager bisa terbuka kita tambahkan authentikasi agar tidak bisa dibuka oleh orang lain

## edit file r_proxy

[root@control ~]# nano /etc/httpd/conf.d/r_proxy.conf
----------------------------------------------------------------------------------------

#kemudian tambahkan file dibawah SetHandler balancer-manager seperti ini 
<Location /balancer-manager> 
        SetHandler balancer-manager 
        AuthType Basic 
        AuthName "Balancer Manager" 
        AuthUserFile /etc/httpd/conf.d/.htpasswd 
        Require valid-user
---------------------------------------------------------------------------------------

buat password untuk balancer-manager

root@control ~]# htpasswd -c /etc/httpd/conf.d/.htpasswd tkj1
New password: 
Re-type new password: 
Adding password for user tkj1

[root@control ~]# systemctl restart httpd

----------------------------------------------------------------------------------------
akses situs http://www.tkj.net/balancer-manager 
pastikan ketika mengakses balancer-manager terdapat password didalamnya

Semoga Bermanfaat :)

No comments:

Post a Comment