First, the implementation of master-slave server high-availability technology.
Approximate network topology diagram:
650) this.width=650; "src=" Https://s4.51cto.com/oss/201711/07/e3819115371e778e4aae13b66c4fa310.png "title=" 1.png " alt= "E3819115371e778e4aae13b66c4fa310.png"/>
Prerequisite Preparation Conditions:
Prepare four machines, one for keepalived master, one for keepalived backup, one for Rs1, one for Rs2, and both to shut down firewalls and selinux.
① installation package.
Yum Install keepalived
② Modify the location file (Master of keepalived).
Vim/etc/keepalived/keepalived.cf
650) this.width=650; "src=" Https://s3.51cto.com/oss/201711/07/e165a886a86ecfa15af23e431e8e8397.png "title=" 8.png " alt= "E165a886a86ecfa15af23e431e8e8397.png"/>
③ Modifying the master configuration file for keepalived (keepalived Backup)
650) this.width=650; "src=" Https://s4.51cto.com/oss/201711/07/dc81225a95faf04840c40e4a5a487b03.png "title=" 8.png " alt= "Dc81225a95faf04840c40e4a5a487b03.png"/>④ set the VIP to RS1 and set the network card alias.
650) this.width=650; "src=" Https://s2.51cto.com/oss/201711/07/5cf7263a6f12f10ea53136355c9b9898.png "title=" 1.png " alt= "5cf7263a6f12f10ea53136355c9b9898.png"/>⑤ the same, set the VIP to RS2 and set the card alias.
650) this.width=650; "src=" Https://s2.51cto.com/oss/201711/07/b6f2681686ef7a1d6a0a583ef4977aaa.png "title=" 1.png " alt= "B6f2681686ef7a1d6a0a583ef4977aaa.png"/>⑥ see if there is a service on the keepalived server.
650) this.width=650; "src=" Https://s2.51cto.com/oss/201711/07/015ccabda0b3d2a8cdd3b06920605cb9.png "title=" 1.png " alt= "015ccabda0b3d2a8cdd3b06920605cb9.png"/>
650) this.width=650; "src=" Https://s5.51cto.com/oss/201711/07/247f89ca992f2344115bae8e5e4cae4c.png "title=" 2.png " alt= "247f89ca992f2344115bae8e5e4cae4c.png"/>
⑦ test.
650) this.width=650; "src=" Https://s2.51cto.com/oss/201711/07/e882dd43ec948f0da5879036f0ac3aa7.png "title=" 1.png " alt= "E882dd43ec948f0da5879036f0ac3aa7.png"/>
⑧ simulates keepalived's master corruption.
650) this.width=650; "src=" Https://s1.51cto.com/oss/201711/07/6c23cc8e18c93f2f96b6710d92368109.png "title=" 1.png " alt= "6c23cc8e18c93f2f96b6710d92368109.png"/>
650) this.width=650; "src=" Https://s3.51cto.com/oss/201711/07/b4324f92b505566816954e1b72206d95.png "title=" 1.png " alt= "B4324f92b505566816954e1b72206d95.png"/>
Second, the realization of mutual primary from the mode of high-availability technology.
Approximate network topology diagram:
650) this.width=650; "src=" Https://s2.51cto.com/oss/201711/08/1396acf0f827747d41efb36c129a0510.png "title=" 3.png " alt= "1396acf0f827747d41efb36c129a0510.png"/>
The realization of the mutual dual-master mode is to prepare two VIP simultaneously supervise each other, when one of the other side down the top immediately, thereby achieving high availability.
① in the previous experiment (master configuration Master) configuration file to add a set of instance scheme, so as to achieve mutual master from.
650) this.width=650; "src=" Https://s2.51cto.com/oss/201711/08/385cccc3f8466d5c2c4ce5c013f412ad.png "title=" 1.png " alt= "385cccc3f8466d5c2c4ce5c013f412ad.png"/>
650) this.width=650; "src=" Https://s1.51cto.com/oss/201711/08/059092d75e0ca17dac88fb286ef822bb.png "title=" 2.png " alt= "059092d75e0ca17dac88fb286ef822bb.png"/>
The ② modifies the configuration file (from configuration file backup), just as opposed to the master profile, so that it can be supervised by each other.
650) this.width=650; "src=" Https://s5.51cto.com/oss/201711/08/c870cc8b89d3ab7687bffc206c12c3d4.png "title=" 1.png " alt= "C870cc8b89d3ab7687bffc206c12c3d4.png"/>
650) this.width=650; "src=" Https://s3.51cto.com/oss/201711/08/32c3ca93d5256f511ce7691aea3f6dc5.png "title=" 2.png " alt= "32c3ca93d5256f511ce7691aea3f6dc5.png"/>
High-availability cluster site architecture based on keepalived for multiple modes