mysql-5.6.36-Multi-instance-deployment (compiled version)

Source: Internet
Author: User

MySQL Multi-instance _ Qin Encyclopedia

Note: Before deploying a dual instance, you first need to deploy a single instance, and the single instance deployment details are as follows:

Https://www.cnblogs.com/wangqiner/p/9081002.html

1, if you have installed the completion of a single instance, you need to stop single-instance operation, followed by multi-instance deployment

/etc/init.d/mysqld Stopchkconfig mysqld off

2, has produced a lot of instance configuration files and startup files, the following:

3, upload data.tar.gz to the root directory, and then tar unzip

Tar XF data.tar.gz
[Email protected]/]# Tree/data
Data
├──3306
│├──my.cnf
│└──mysql
└──3307
├──my.cnf
└──mysql

4. Authorized owner, group and file permissions and view

Chown-r mysql.mysql/data/

[Email protected]/]# Find/data-name mysql| Xargs ls-l
 -rw-r--r-- 1 root root 1345 APR-2017/home/data/3306/mysql
 -rw-r--r-- 1 root root 1345 APR-2017/home/data/3307/mysql

[Email protected] home]# Find/home/data-name mysql| Xargs chmod
[Email protected] home]# find/home/data-name Mysql|xargs ls-l
 -rwx------ 1 root root 1345 Apr 2017/home/data/3306/mysql
 -rwx------ 1 root root 1345 Apr 2017/home/data/3307/mysql
[Email protected] home]#

5. Enter the MySQL initialization file directory

Cd/application/mysql/scripts

6. Initialize the 3306,3307 two instances (in order to generate data associations and files under MySQL database)

./mysql_install_db  --defaults-file=/data/3306/my.cnf--basedir=/application/mysql/--datadir=/data/ 3306/data--user=mysql------------perform--------------separately. /mysql_install_db  --defaults-file=/data/3307/my.cnf--basedir=/application/mysql/--datadir=/data/ 3307/data--user=mysql

7, environment variable settings, such as already configured, can skip

' export Path=/application/mysql/bin: $PATH ' >>/etc/profilesource  /etc/profile

8, before the start to ensure that no error file errors, in advance to create error log files and authorized owners and groups

touch/data/3306//data/3307//data/3306//data/3307 /oldboy_3307.err

9. Start MySQL Multi-instance

---command---
/data/3306/mysql start/data/3307/mysql start

---show---

[[email protected] data]#/data/3306/mysql start
Starting MySQL ...
[[email protected] data]#/data/3307/mysql start
Starting MySQL ...

10. Check if the MySQL port is starting properly

[Email protected] data]# SS-Lntupnetid State Recv-Q send-Q Local address:port Peer address:port TCP LISTEN0       -:::3306:::* Users: (("mysqld",36610, One) ) TCP LISTEN0       -:::3307:::* Users: (("mysqld",37337, One))

11. Log into MySQL multiple instances separately

---into the command---

Mysql-s/data/3306/mysql.sock
Mysql-s/data/3307/mysql.sock

----Show-----

[Email protected] data]# mysql-s/data/3306/Mysql.sockwelcome to the MySQL monitor. Commands End With; or \g.your MySQL connection ID is 1Server Version:5.6. $Source Distributioncopyright (c) -, ., Oracle and/or its affiliates. All rights reserved. Oracle isA registered trademark of Oracle Corporation and/or Itsaffiliates. Other names trademarks of their respectiveowners. Type'Help ;'Or'\h' forHelp. Type'\c'To clear the current input statement.mysql>show databases;+--------------------+| Database |+--------------------+| Information_schema | | MySQL | | Performance_schema | | Test |+--------------------+4Rowsinch Set(0.00sec) MySQL>exitbye[[email protected] data]# MySQL-s/data/3307/Mysql.sockwelcome to the MySQL monitor. Commands End With; or \g.your MySQL connection ID is 1Server Version:5.6. $Source Distributioncopyright (c) -, ., Oracle and/or its affiliates. All rights reserved. Oracle isA registered trademark of Oracle Corporation and/or Itsaffiliates. Other names trademarks of their respectiveowners. Type'Help ;'Or'\h' forHelp. Type'\c'To clear the current input statement.mysql>show databases;+--------------------+| Database |+--------------------+| Information_schema | | MySQL | | Performance_schema | | Test |+--------------------+4Rowsinch Set(0.01sec) MySQL>Exitbye

Complete the above operation, MySQL multi-instance is already deployed to complete!

The following is an example of adding an idea

1./data/3306 renamed to/data/3308 under the copy root directory

2. Compare the my.cnf and MySQL boot files under multi-instance MySQL instance,

The only difference is that the instance name differs (such as 3306,3307,3308), and the server ID differs (any number is different)

3, use Sed-i "s#3306#3308#g"/data/3308/my* command to replace, if not very clear, you can open the copied 3308 directory of the configuration files and startup files, modified to 3308;

4, modified after the initialization of instance 3308, according to the above initialization command to change the name of the other instance to 3308;

5, create the error log file to the instance 3308;

6, the authorization instance 3308, changes the owner, belongs to the group and the Authority;

7, start multi-instance 3308/data/3308/mysql start;

8. Check if the port is started.

mysql-5.6.36-Multi-instance-deployment (compiled version)

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.