Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

MySQL: installation and master-slave replication based on SSL encryption (based on 5.7)

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Xiaosheng blog: http://xsboke.blog.51cto.com

-Thank you for your reference. If you have any questions, you are welcome to communicate.

Table of contents:

-introduction and installation of mysql-5.7.13

-configure ssl encrypted transport for mysql-5.7.13

-Master-slave replication of mysql-5.7.13 based on SSL encrypted transmission

A brief introduction to Mysql5.7.13

1. The main optimization of Mysql5.7

Mysql5.7 natively supports centos7.* version of systemd

Better performance: better optimization for multicore CPU, solid state drives, and locks

Better InnoDB storage engine

After the mysql5.6 version, multithreading is supported to implement master-slave replication.

New sys library: this will be the most frequently accessed library by DBA in the future

Better optimizer: the meaning of optimizer code refactoring will bring huge improvements in this and later versions, and Oracle officials are solving the biggest problem before MySQL: native JSON type support (JavaScript Object Notation).

Note: JSON (JavaScriptObject Notation) is a lightweight data exchange format. JSON uses a completely language-independent text format, but also uses conventions similar to the C language family (including C, C++, C #, Java, JavaScript, Perl, Python, and so on). These features make JSON an ideal data exchange language. It is easy for people to read and write, and it is also easy to be parsed and generated by machines (generally used to increase the network transmission rate).

1) JSON syntax is a subset of the syntax represented by JavaScript objects.

Data in key-value pairs data is saved by comma-separated curly braces. Square braces save arrays of files written in JSON, instead of .yaml format files. (used in docker kubernetes to create a RC. )

two。 The basic process of installing mysql5.7 on centos7.*

1) mariadb-libs database is installed by default in Centos7.*, which needs to be uninstalled

2) confirm the kernel version and system version

3) install dependency packages

Cmake: since the regular configure compilation method has been deprecated from the MySQL5.5 version, a CMake compiler is required to set the compilation parameters for mysql. Such as: installation directory, data storage directory, character encoding, sorting rules and so on.

Boost # Boost library is required from MySQL 5.7.5. C++ 's Boost library is used in mysql source code, which requires boost1.59.0 or above to be installed.

GCC is a C language compilation tool under Linux. Mysql source code compilation is written entirely by C and C++, so GCC must be installed.

C _ syntax + parser under bison:Linux

Ncurses: character terminal processing library

4) create mysql users and user groups

5) create the directories required by mysql

6) install mysql5.7

7) optimize database execution path and initialize database

Second, install mysql5.7 in centos7.2 and optimize the configuration

1. Installation file preparation

Download cmake-3.5.tar.gz:

Http://wwwNaNake.org/download/

Download ncurses-5.9.tar.gz:

Ftp://ftp.gnu.org/gnu/ncurses/

Download bison-3.0.4.tar.gz:http:

/ / ftp.gnu.org/gnu/bison/

Download mysql-5.7.13.tar.gz:

Wget http://cdn.mysql.com/Downloads/MySQL-5.7/mysql-5.7.13.tar.gz

Download Boost_1_59_0.tar.gz:

Wget

Http://nchc.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz

two。 First install the dependency package and create mysql users, groups, and installation directories

Verify that the default database is installed on the system

Delete the default installed mariadb-libs database first

Cmake (cmake requires gcc gcc-c++ make automake support)

Install ncurses

Install bison

Install boost

Create the groups and users required by mysql

Create installation path

3. Install mysql5.7.13

First, configure cmake.

Then compile and install

Optimize mysql execution path and set authorization and initialize mysql system authorization table

Create a profile

Configure mysql to start automatically

First, check the error log.

Then check to see if there is a mysqld directory under / var/run.

Let's modify the mysqld service script

Restart the mysql service again

Change the default password for mysql

At this point, mysql is installed.

Third, implement master-slave replication based on ssl secure connection.

1. First create the ssl.rsa file in master

two。 Problems with key permissions (must be resolved)

Restart the mysqld service (sometimes errors are reported, but sometimes errors can only be found by viewing the error log)

View permissions for server-key.pem

Modify permissions and restart mysqld

View the mysqld error log again

3. Log in to mysql to see if ssl is supported

4. Generate an account in master for mysql master-slave replication

5. Start the binaries and restart the service on master

6. View the status of master

You need to know where to start master-slave replication in master.

7. Modify the my.cfg file of slave to specify the location of the relay log and relay log list

8. Transfer the certificate generated by master to slave

9. Set r permissions for client-key.pem

10. Add the location where certificates and key pairs are stored in the configuration file of slave

It is best to check the error log of mysql after reboot to see if there is an error message.

11. Check to see if ssl is supported and tested

Log in to slave's database

Test whether the ssl connection is successful

12. Each server in Mysql5.7 has a unique UUID number (extended knowledge)

13. Set synchronization in slave and enable slave function

14. test

First create the database and table in master and insert the data

Then check whether the data is synchronized in slave

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report