Mohon tunggu...
Mboi Coy
Mboi Coy Mohon Tunggu... -

:)

Selanjutnya

Tutup

Inovasi

Distributed Web Server with Load Balancer

22 Januari 2010   02:09 Diperbarui: 26 Juni 2015   18:20 615
+
Laporkan Konten
Laporkan Akun
Kompasiana adalah platform blog. Konten ini menjadi tanggung jawab bloger dan tidak mewakili pandangan redaksi Kompas.
Lihat foto
Bagikan ide kreativitasmu dalam bentuk konten di Kompasiana | Sumber gambar: Freepik

First thing you must do is define cluster name and client ip's.

upstream  my_cluster  {
         fair;
         server 192.168.0.10 max_fails=3  fail_timeout=30s;
         server 192.168.0.11 max_fails=3  fail_timeout=30s;
}


Then, we tell Nginx to work as Load Balancer and call my_cluster on server section

server {
        listen       192.168.0.1:80;
        server_name  _;
        location / {
             proxy_pass  http://my_cluster;
             proxy_set_header Host $host;
             proxy_set_header X-Real-IP $remote_addr;
             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}


Restart Nginx service, and now your Nginx is running as Load Balancer

For complete configuration, see this nginx.conf

Squid

It's more simple to configure if using Squid.

http_port 80 vhost


Then define ip's for clients.

cache_peer 192.168.0.10 parent 80 0 no-query originserver round-robin
cache_peer 192.168.0.11 parent 80 0 no-query originserver round-robin

You must restart / reload the Squid service in order to take a change you've made.

For complete configuration, see this squid.conf

As you can see, Load Balancer configuration are similar with Reverse Proxy configuration. Because basically they works with the same method. for your reference with Reverse Proxy, you can read my Revese Proxy article.

Summary


Load Balancing is a Technique that reasonable to consider if your server load that running as Web Server is getting bigger and bigger. It's the impact of increasing of web traffic or more complex of application needs. Every Load Balancer offers their own feature and methodology, So by researching and read more article or blog will help you to make a decision.

HALAMAN :
  1. 1
  2. 2
  3. 3
Mohon tunggu...

Lihat Inovasi Selengkapnya
Beri Komentar
Berkomentarlah secara bijaksana dan bertanggung jawab. Komentar sepenuhnya menjadi tanggung jawab komentator seperti diatur dalam UU ITE

Belum ada komentar. Jadilah yang pertama untuk memberikan komentar!
LAPORKAN KONTEN
Alasan
Laporkan Konten
Laporkan Akun