1. Project Environment 8 centos7/8 servers, nginx 1.21.1, ab, nfs4, 2. Project DescriptionBuild a 4/7 layer load balancing web cluster project based on nginx Simulate the business environment of an enterprise to build a high-concurrency , high-availability web cluster. Use stress testing to test the performance of the entire cluster, identify bottlenecks, and continuously optimize. 3. Project Steps1. InstallationInstall and deploy ansible services, establish a password-free channel with other servers, and write a playbook to install and deploy nginx and zabbix 2. ConfigurationDeploy nginx and zabbix through ansible, configure nginx long connection, number of concurrency, number of worker processes, speed limit and related configuration of zabbix, upload website content (build a WordPress blog system or flask interface website, etc.) 3. Implement load balancingUse two servers as dual-VIP load balancers, use nginx's 4/7 layer load balancing function, and use weighted round-robin scheduling algorithm 4. Build the serverBuild an nfs server to ensure data consistency of the website, and set the backend real-server/backend server to automatically mount when it boots 5. Stress TestingUse ab software to perform stress testing on the client 6. MonitoringAdd relevant servers and monitoring items on the zabbix/prometheus monitoring platform to monitor the performance of the entire web cluster--"zabbix 7. High AvailabilityUse keepalived software to make the load balancer highly available and prevent single point of failure--》keepalived 8. Domain name resolutionBuild a DNS server to perform domain name resolution for the entire web cluster. Through DNS domain name resolution load balancing, bind two VIPs to one domain name for user access, thereby importing traffic to different load balancers. 9. Improve performanceTry to optimize the entire web cluster to improve performance: optimize kernel parameters, nginx parameters, consider adding cache and other measures 10. Use Ansible to write playbooksTry to use Ansible to write playbooks to install all software: nginx, zabbix, keepalived, ab, nfs, etc. IV. Project Summary 1. Gradually understand the concept of cluster, from 1 to multiple 5. Notes on Building a Web Site1. Web site content, you need to determine: blog, interface website, test page, etc. Data consistency issues: NFS, SAN, cloud storage, NAS, etc. 2. Optimization of kernel parameters: [root@docker ~]# sysctl -p net.ipv4.ip_forward = 0 net.ipv4.conf.default.rp_filter = 1 net.ipv4.conf.default.accept_source_route = 0 kernel.core_uses_pid = 1 net.ipv4.tcp_syncookies = 1 kernel.msgmnb = 65536 kernel.msgmax = 65536 net.ipv4.conf.all.promote_secondaries = 1 net.ipv4.conf.default.promote_secondaries = 1 net.ipv6.neigh.default.gc_thresh3 = 4096 net.ipv4.neigh.default.gc_thresh3 = 4096 kernel.softlockup_panic = 1 net.ipv6.conf.all.disable_ipv6 = 0 net.ipv6.conf.default.disable_ipv6 = 0 net.ipv6.conf.lo.disable_ipv6 = 0 kernel.shmmax = 68719476736 kernel.printk = 5 kernel.sysrq = 1 kernel.numa_balancing = 0 [root@docker ~]# ulimit unlimited [root@docker ~]# ulimit -a core file size (blocks, -c) unlimited data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 14826 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 100001 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 14826 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited [root@docker ~]# ab -c 2000 -n 100000 http://192.168.0.92/ This is the end of this article about building a web cluster project based on nginx. For more relevant nginx web cluster project content, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Solution to the problem of text position jumping when the search text box leaves the focus
>>: CSS delivery address parallelogram line style example code
How to solve the Mysql transaction operation fail...
As the number of visits increases, the pressure o...
1. px px is the abbreviation of pixel, a relative...
Table of contents Preface question Online solutio...
Table of contents Index Type Index structure Nonc...
This article introduces the sample code for imple...
Grayscale release refers to a release method that...
Shopify Plus is the enterprise version of the e-c...
1. After installing MySQL 5.6, it cannot be enabl...
background: The site is separated from the front ...
Just as the title says. The question is very stran...
Find the problem I recently encountered a problem...
1. Implement a simple triangle Using the border i...
Let's take a look at the code file structure ...
This article example shares the specific code of ...