Linux integration test nginx-generation anti-+ upstream + keepalived + msyql static and dynamic separation

1. Background:
    1.1 In order to better understand Linux-related common components, and memory consolidation, especially set the following experiments, we welcome the guidance to do. Very welcome! ! ! !
    1.2 Experimental topics: nginx Anti-generation load balancing wordpress, use keepalived load nginx, static and dynamic separation, and monitoring of various projects using zabbix
    1.3 (behind the blog there will be more projects to increase the use corosync + pacemaker high availability, using elk process the collected logs, use distributed file system for storage wordpress, finally using ansible to automate deployment.)
2. basic environment to prepare
    2.1 hardware environment to prepare (platform-wide adoption of Centos7)
                192.168.126.31 cent7-1 nginx + keepalived (primary master model, most before using dns round Inquiry)
                192.168.126.32 cent7-2 nginx + keepalived (primary master model)

                192.168.126.33 cent7-3 httpd static resources
                192.168.126.34 cent7-4 httpd static resources
               
                192.168.126.41 cent7-5 php-fpm + memcached caching dynamic resource (here not cache cluster)
                192.168.126.42 cent7-6 PHP-FPM dynamic resource ZABBIX +
                192.168.126.43 cent7-7 MariaDB (MySQL) + shared storage (NFS)
                41-43 performance preferably
    2.2 configuration Roadmap
            3132 do nginx load, keepalived two main master model vip 192.168.126.28,29, front-end load dns polling implementation, each can change local hosts or configuration files. (Keepalived main master model may be cases where two vip on one node); nginx proxy module using two anti behalf of the back-end host, dynamic and static, they are using a shared storage nfs, memcached as cache static resources, It can also consider doing dynamic;
3. start configuration:
    3.1 first prepare the system, minimizing system (CentOS-7-x86_64-minimal -1708.iso) I installed, everything that version is best not to wear, too card. Passing the installation process, some friends and have time to kickstart to install and use cobbler, but more automated test environments can be slow.
    1. yum repository may need to prepare for nginx yum repository. /etc/yum.repos.d/nginx.repo Vim
 
     3.2 using a host write ansible PlayBook
          A. yum the install ansible -Y
            B. CD / etc / ansible / Roles
            c.mkdir ./{ntdpate,httpd,nginx,keepalived , zabbix, MySQL, zabbix} / {default, Files, handle
rs, Meta, Tasks, Templates, VARS} -pv create various roles related directory
            d.cd / etc / ansible /; cp hosts {, bak};. vim hosts defined ansible hosts file, (under normal circumstances, modify the configuration file before their first back up what)
            e.hosts document reads as follows: hname variables used for identification, you can not define
            [nginx]
            192.168.126.31 hname = cent7-1
            192.168. 126.32 hname = cent7-2

            [httpd]
            192.168.126.33 hname=cent7-3
            192.168.126.34 hname=cent7-4

            [Fps]
            L92kl68kl26k4l Hname = Cent7-5
            192.168.126.42 hname = Cent7-6

            [MySQLs]
            192.168.126.43 hname = cent7-7
     
            f.ssh keygen -t-RSA -P ''; for I in {1..7}; do SSH-Copy-ID -i .ssh / id_rsa.pub the root @ cent7- $ i; done; ansible all -m ping; ssh key generated and distributed to all nodes. Ansible can be used to ensure control, and then ping it was successful. Here we note that there is no problem using as root, root password can not be put in ansible, too dangerous. If other users, the best place in the Administrators group, and a good definition in the sudo, otherwise there will be a lot of mistakes. Here reduce complexity, do not do.
    3.3 Role write nginx:
           1. cd / etc / ansible / the Roles / nginx /
           2. vim Task /

Guess you like

Origin blog.51cto.com/hyp0535/2400977