Chuyển đến nội dung chính

Bài đăng

Đang hiển thị bài đăng từ Tháng 1, 2017

[LB-HA] Configuration Load balancing and High available on HA PROXY tool

Install HAProxy Load Balancer on CentOS Understand about High Available (HA) and Load Balancing Configuring the load balancer Setting up HAProxy for load balancing is a quite straight forward process. Basically all you need to do is tell HAProxy what kind of connections it should be listening for and which servers it should relay the connections to. This is done by creating a configuration file  /etc/haproxy/haproxy.cfg  with the defining settings. You can read about the configuration options at  HAProxy documentation  if you wish to find out more. Open a .cfg file for edit for example using  vi  with the following command sudo vi /etc/haproxy/haproxy.cfg Add the following sections to the the file. Replace the   with what ever you want to call you servers on the statistics page and the  > with the private IPs for the servers you wish to direct the web traffic to. You can check the private IPs at your  UpCloud Control Panel  and  Private network  -tab under  Network  -me

[LB-HA] Install HAProxy Load Balancer on CentOS

Load balancing is a common solution for distributing web applications horizontally across multiple hosts while providing the users a single point of access to the service. It aims to optimize resource usage, maximize throughput, minimize response time, and avoid overloading any single resource.  HAProxy  is one of the most popular opensource load balancing software, which also offers high availability and proxy functionality. It’s available for install on many Linux distributions as well as Solaris and FreeBSD. HAProxy is particularly suited for very high traffic websites, and is therefore often used to improve web service reliability and performance for multi-server configurations. This guide lays out the steps for setting up HAProxy as a load balancer on CentOS 7 to its own cloud host which then directs the traffic to your web servers. As a pre-requirement for following this guide, you’ll need to have a minimum of two servers with at least the basic web service such as Ap

[LB-HA] Understand about High Available (HA) and Load Balancing

High Available (HA) :  Hỗ trợ dự phòng tiến trình. Hoạt đông với cơ chế Active - Passive . Hệ thống tồn tại 02 loại Component với role 'Active' và 'Passive'.  Active   Component sẽ đảm nhận việc xử lý tiến trình. Passive Component đóng vai trò backup. Trường hợp Active Component gặp lỗi (fail, downtime) hệ thống sẽ chuyển sang hoạt động trên B ackup  Component . Quá trình chuyển từ Active Component sang Passive Component gọi là 'Fail over'. Một số khái niệm liên quan đến HA: - FailOver: Chuyển đổi tiến trình chạy trên Passive Component khi Active Component gặp sự cố. - Fail Back: Khôi phục lại tiến trình hoạt động trên Active Component sau khi tiến trình dịch chuyển đến Passive Component trong quá trình FailOver. - Fault - Tolerant: Công nghệ giúp đảm bảo tính liên tục của dịch vụ. Trường hợp một thành phần trong hệ thống bị hoạt động gián đoạn vẫn cho phép toàn bộ hệ thống hoạt động ổn định. Load Balancing : Hoạt động với cơ chế Active - Active .

[Code Sample] Java Socket Connection

1. Server source import java.io.*; import java.net.*; public class Server { ServerSocket providerSocket ; Socket connection = null ; ObjectOutputStream out ; ObjectInputStream in ; String message ; Server() { } void run() { try { // 1. creating a server socket /* * port: the port number, or 0 to use a port number that is automatically allocated.  * backlog requested maximum length of the queue of incoming connections. */ providerSocket = new ServerSocket(2004, 10); // 2. Wait for connection System. out .println( "Waiting for connection" ); connection = providerSocket .accept(); System. out .println( "Connection received from " + connection .getInetAddress().getHostName()); // 3. get Input and Output streams out = new ObjectOutputStream( connection .getOutputStream()); out .flush(); in = new ObjectInputStream( connection .getInp