Scalable, highly available, load-balanced site architecture Design Solutions

Source: Internet
Author: User

Scalable, highly available, load-balanced site architecture Design Solutions

Basic Requirements :

1. High availability: Reduce downtime to a minimum or even uninterrupted service

2, scalability: With the increase in access, the system has a good ability to scale

3, Visibility: The state of the system and service is under a real-time monitoring

4. High performance and reliability: Optimized architecture and reasonable backup strategy

5, Security: Structural security and Host Security policy

Basic ideas

1, for frequent access, the user volume of large objects (Bbs,blog) in a reasonable way to load to multiple servers. Separate the database, prepare 2 sets of MySQL database to achieve master-slave replication, that is, reduce the load, but also improve the reliability. A step closer, using MySQL proxy technology, to achieve the master-slave server Read and write separation, greatly improve the performance and load capacity of the system.

2. The database is isolated from the external network, allowing only Web servers (Bbs,blog, etc.) to be accessed through private addresses. This improves the security of the database while also saving valuable bandwidth.

3, the deployment of monitoring system, through monitoring host survival, service, host resources, real-time to put the health status of the system in a visual state, the operating state of the system is well aware.

4, backup is not to think of things, use a separate server centralized backup, is a relatively good idea.

Topological structure

Business logic

Technology implementation

1, load Balancing. 2 Linux servers with the same configuration, the kernel supports LVS and configures the Keepalived tool to enable load forwarding. Once the real server fails, keepalived will automatically remove the faulty machine from the forwarding queue and wait until the fault is repaired, and it will automatically add the address of the real server to the forwarding list. Because LVS supports session retention, there is no need to worry about the loss of login for applications such as BBS.

2, MySQL master-slave replication. That is to ensure the security of data, but also improve access performance. We add MySQL proxy to each Web server on the front end, we can expect to realize the automatic separation of Read and write, let the write operation occur in the main database, so that the query such read operation occurs from the database.

3. Nagios is an open source, widely welcomed monitoring platform. It can monitor the host's survival, system resources (disk space, load, and so on) and network services in real time. Once a fault is detected, a message (SMS) will be sent automatically to notify the failure.

4, Backup. Includes backups of Web data and database servers. For Web services, the GNU tar is ready for all the backup wishes. A simple set-up of crontab will allow the system to help us back up in the moment we dream. However, due to space constraints, it is not possible to back up all the time, so we should make a suitable strategy to constantly replace the old backup data with the new backup; how many days is appropriate? Look at the disk capacity. For the database, mysqldump first, then tar. After you have completed these tasks, transfer the backup files to the backup server set. A more convenient way is to hook up the backup server to the Web server and the database server in NFS.

5, Web server. Include at least both Apache and MySQL proxy components. Apache do BBS and blog containers, virtual machines to the user's request forwarded to the BBS directory or blog directory.

6, security measures. It contains two layers of security, one layer is the host itself, the other is the structure (MySQL is isolated from the external network). The practice proves that iptables is a very trustworthy firewall tool. In practical application, the strategy of opening the window after closing, greatly enhance the security of the system.

Components

First, hardware: Load Balancer 2 (Dell 1950), Web server 2-3 (dell1950), Database 2 (Dell 2950), Storage NAS (5T formatted capacity), Backup 4u server (with disk array 5T capacity), Monitoring server 1 units (dell1850).

Second, software: Operating system CentOS 5 (custom installation), Load balancer ipvsadm, keepalived, monitoring Nagios,web service apache+php, database MySQL, database agent MySQL proxy.

Schedule

1, LVS load Balancing configuration and testing: 2-3 days

2. Web server configuration: 2-3 days

3, MySQL master server configuration: 1-3 days

4. Web Data Migration: 1 days

5. Database Data migration: 2 days

6, on-line test: 1-2 days

7. Official Online: 2 days

Keepalived.conf
! Configuration File for Keepalived
Global_defs {
router_id Lvs_devel
}

Vrrp_instance Vi_1 {
State Master
Interface eth0
VIRTUAL_ROUTER_ID 59
Priority 100
Advert_int 1
Authentication {
Auth_type PASS
Auth_pass 1111
}
virtual_ipaddress {
61.61.61.100
#61.61.61.101
}
}

virtual_server 61.61.61.100 {
Delay_loop 6
Lb_algo RR
Lb_kind DR
Persistence_timeout
Protocol TCP
real_server 61.61.61.102 {
Weight
Tcp_check {
Connect_timeout 3
Nb_get_retry 3
Delay_before_retry 3
Connect_port
}
}
real_server 61.61.61.103 {
Weight
Tcp_check {
Connect_timeout 3
Nb_get_retry 3
Delay_before_retry 3
Connect_port
}
}
}

Real Server virtual IP settings script
#!/bin/bash
#description: Start Realserver
vip=61.61.61.100
./etc/rc.d/init.d/functions
Case "$1″in
start)
echo "Start LVS of Realserver"
/sbin/ifconfig lo:0 $VIP broadcast $VIP netmask 255.255.255.255 up
echo "1″>/proc/sys/net/ipv4/conf/lo/arp_ignore
echo "2″>/proc/sys/net/ipv4/conf/lo/arp_announce
echo "1″>/proc/sys/net/ipv4/conf/all/arp_ignore
echo "2″>/proc/sys/net/ipv4/conf/all/arp_announce
;;
stop)
/sbin/ifconfig lo:0 down
echo "Close LVS directorserver"
echo "0″>/proc/sys/net/ipv4/conf/lo/arp_ignore
echo "0″>/proc/sys/net/ipv4/conf/lo/arp_announce
echo "0″>/proc/sys/net/ipv4/conf/all/arp_ignore
echo "0″>/proc/sys/net/ipv4/conf/all/arp_announce
;;
*)
echo "Usage: $ {start|stop}"
Exit 1
Esac

Scalable, highly available, load-balanced site architecture Design Solutions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.