Mysql5.7 SSL Master-slave replication

Source: Internet
Author: User
Tags ssl connection


This article from Turtle Ops wuguiyunwei.com

650) this.width=650; "Width=" 1011 "height=" 471 "src=" Https://wuguiyunwei.com/wp-content/uploads/2017/05/mysql_ Replication_topology_threads.png "class=" Attachment-full size-full wp-post-image "style=" border:none; vertical-align:middle;height:auto;width:729.328px; "/>

Master-slave replication environment based on SSL secure connection Mysql5.7 main ip:192.168.6.189 from ip:192.168.6.135

Create Ssl/rsa in (master) MySQL

650) this.width=650; "class=" Alignnone size-full wp-image-487 "src=" http://wuguiyunwei.com/wp-content/uploads/2017/ 05/m1-2.png "width=" 863 "height=" 323 "style=" border:none;vertical-align:middle;height:auto;margin:5px 0px 20px; "/ >

The results are as follows

650) this.width=650; "class=" Alignnone size-full wp-image-490 "src=" http://wuguiyunwei.com/wp-content/uploads/2017/ 05/m2.png "width=" 861 "height=" "style=" border:none;vertical-align:middle;height:auto;margin:5px 0px 20px; "/>

Need to configure SSL file for Chown Mysql:mysql && restart for root execution

650) this.width=650; "class=" Alignnone size-full wp-image-512 "src=" http://wuguiyunwei.com/wp-content/uploads/2017/ 05/m3.png "width=" 866 "height=" "style=" border:none;vertical-align:middle;height:auto;margin:5px 0px 20px; "/>

650) this.width=650; "class=" Alignnone size-full wp-image-492 "src=" http://wuguiyunwei.com/wp-content/uploads/2017/ 05/m4.png "width=" 861 "height=" Bayi "style=" border:none;vertical-align:middle;height:auto;margin:5px 0px 20px; "/>

From can see MySQL to successfully support SSL secure connection

Note: Internet replication recommends SSL connectivity

650) this.width=650; "class=" Alignnone size-full wp-image-493 "src=" http://wuguiyunwei.com/wp-content/uploads/2017/ 05/m5.png "width=" 863 "height=" 597 "style=" border:none;vertical-align:middle;height:auto;margin:5px 0px 20px; "/>

Create a copy account on Master: Require SSL

650) this.width=650; "class=" Alignnone size-full wp-image-494 "src=" http://wuguiyunwei.com/wp-content/uploads/2017/ 05/m6.png "width=" 865 "height=" "style=" border:none;vertical-align:middle;height:auto;margin:5px 0px 20px; "/>

Enable binary logging on master and restart MySQL

650) this.width=650; "class=" Alignnone size-full wp-image-495 "src=" http://wuguiyunwei.com/wp-content/uploads/2017/ 05/m7.png "width=" 865 "height=" 143 "style=" border:none;vertical-align:middle;height:auto;margin:5px 0px 20px; "/>

Pass Master's certificate to the slave server

650) this.width=650; "class=" Alignnone size-full wp-image-496 "src=" http://wuguiyunwei.com/wp-content/uploads/2017/ 05/m9.png "width=" 865 "height=" 233 "style=" border:none;vertical-align:middle;height:auto;margin:5px 0px 20px; "/>

Configuring firewalls in master to allow 3306/TCP communication

Firewall-cmd–permanent–add-port=3306/tcp && Firewall-cmd–reload

650) this.width=650; "class=" Alignnone size-full wp-image-497 "src=" http://wuguiyunwei.com/wp-content/uploads/2017/ 05/m8.png "width=" 859 "height=" style= "border:none;vertical-align:middle;height:auto;margin:5px 0px 20px;"/>

configure MySQL from the server

Edit MySQL configuration file/etc/my.cnf

Note Server-id Two hosts are not the same

650) this.width=650; "class=" Alignnone size-full wp-image-498 "src=" http://wuguiyunwei.com/wp-content/uploads/2017/ 05/m12.png "width=" 863 "height=" 126 "style=" border:none;vertical-align:middle;height:auto;margin:5px 0px 20px; "/ >

Copy the files from the master to this machine chown mysql:mysql && restart MySQL

650) this.width=650; "class=" Alignnone size-full wp-image-499 "src=" http://wuguiyunwei.com/wp-content/uploads/2017/ 05/m13.png "width=" 860 "height=" "style=" border:none;vertical-align:middle;height:auto;margin:5px 0px 20px; "/>

View SSL Stone No successful configuration is supported

650) this.width=650; "class=" Alignnone size-full wp-image-500 "src=" http://wuguiyunwei.com/wp-content/uploads/2017/ 05/m14.png "width=" 858 "height=" "style=" border:none;vertical-align:middle;height:auto;margin:5px 0px 20px; "/ >

Test with SSL connection master

/usr/local/mysql/bin/mysql–ssl-ca=ca.pem–ssl-cert=client-cert.pem–ssl-key=client-key.pem-u zhengda-p123456-h 192.168.6.189

650) this.width=650; "class=" Alignnone size-full wp-image-501 "src=" http://wuguiyunwei.com/wp-content/uploads/2017/ 05/m15.png "width=" 862 "height=" 295 "style=" border:none;vertical-align:middle;height:auto;margin:5px 0px 20px; "/ >

650) this.width=650; "class=" Alignnone size-full wp-image-502 "src=" http://wuguiyunwei.com/wp-content/uploads/2017/ 05/m16.png "width=" 861 "height=" 526 "style=" border:none;vertical-align:middle;height:auto;margin:5px 0px 20px; "/ >

The SSL connection was successful and the login SSL protocol used was: Cipher in using is Dhe-rsa-aes256-sha

Start configuring Master-slave, login from MySQL

Change Master to master_host= ' 192.168.6.189′,master_user= ' Zhengda ', master_password= ' 123456′,master_log_file= ' Mysql-bin.000001′,master_log_pos=154,master_ssl=1,master_ssl_ca= '/data/mysql/ca.pem ', master_ssl_cert= '/data/ Mysql/client-cert.pem ', master_ssl_key= '/data/mysql/client-key.pem ';

650) this.width=650; "class=" Alignnone size-full wp-image-503 "src=" http://wuguiyunwei.com/wp-content/uploads/2017/ 05/m17.png "width=" 863 "height=" 101 "style=" border:none;vertical-align:middle;height:auto;margin:5px 0px 20px; "/ >

Enable from && view

650) this.width=650; "class=" Alignnone size-full wp-image-504 "src=" http://wuguiyunwei.com/wp-content/uploads/2017/ 05/m18.png "width=" 863 "height=" 337 "style=" border:none;vertical-align:middle;height:auto;margin:5px 0px 20px; "/ >

Create a library on test master ZHENGDA1,ZHENGDA6

650) this.width=650; "class=" Alignnone size-full wp-image-505 "src=" http://wuguiyunwei.com/wp-content/uploads/2017/ 05/m19.png "width=" 859 "height=" 352 "style=" border:none;vertical-align:middle;height:auto;margin:5px 0px 20px; "/ >

To view the success from the library is as follows

650) this.width=650; "class=" Alignnone size-full wp-image-506 "src=" http://wuguiyunwei.com/wp-content/uploads/2017/ 05/m20.png "width=" 858 "height=" 278 "style=" border:none;vertical-align:middle;height:auto;margin:5px 0px 20px; "/ >

Replication is transmitted by default in plaintext, and SSL encryption increases the security of the data.


Mysql5.7 SSL Master-slave replication

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.