multi部署单机多实例详细过程(2)

Starting MySQL servers
150514 09:36:14 mysqld_safe Logging to'/home/data/mysql3309/data/data02.err'.
150514 09:36:15 mysqld_safe Logging to '/home/data/mysql3308/data/data02.err'.
150514 09:36:15 mysqld_safe Logging to'/home/data/mysql3307/data/data02.err'.
150514 09:36:15 mysqld_safe Starting mysqlddaemon with databases from /home/data/mysql3308/data
150514 09:36:15 mysqld_safe Starting mysqlddaemon with databases from /home/data/mysql3307/data
150514 09:36:15 mysqld_safe Starting mysqlddaemon with databases from /home/data/mysql3309/data

6,查看多实例

[mysql@data02 ~]$ mysqld_multi--defaults-extra-file=/etc/my.cnf report

Reporting MySQL servers

MySQL server from group: mysqld1 is running

MySQL server from group: mysqld2 is running

MySQL server from group: mysqld3 is running

[mysql@data02 ~]$

后台日志信息:

Reporting MySQL servers

MySQL server from group: mysqld1 is running

MySQL server from group: mysqld2 is running

MySQL server from group: mysqld3 is running

7,停止多实例

mysqld_multi--defaults-extra-file=/etc/my.cnf stop 1,2,3

后台日志信息:

Stopping MySQL servers

150514 09:35:43 mysqld_safe mysqld from pidfile /usr/local/mysql3309/mysqld.pid ended

150514 09:35:43 mysqld_safe mysqld from pidfile /usr/local/mysql3307/mysqld.pid ended

150514 09:35:43 mysqld_safe mysqld from pidfile /usr/local/mysql3308/mysqld.pid ended

8,各自登录mysql实例

需要指定启动的socket就可以登录到各自的mysql实例,如下所示:

[mysql@data02 ~]$ mysql --socket=/usr/local/mysql3308/mysql.sock

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.6.12-log Sourcedistribution

Copyright (c) 2000, 2013, Oracle and/or itsaffiliates. All rights reserved.

Oracle is a registered trademark of OracleCorporation and/or its

affiliates. Other names may be trademarksof their respective

owners.

Type 'help;' or '\h' for help. Type '\c' toclear the current input statement.

mysql> select @@port;

+--------+

| @@port |

+--------+

|  3308 |

+--------+

1 row in set (0.00 sec)

mysql>

mysql> create database d3308;

Query OK, 1 row affected (0.04 sec)

mysql>

9,可以在多端口上搭建主从、主主服务

9.1,在3307实例建立账号

复制账号

GRANTREPLICATION SLAVE,RELOAD,SUPER ON *.*TO repl@'192.168.52.%' IDENTIFIED BY'repl_1234';

备份账号

GRANTRELOAD, SUPER, LOCK TABLES, REPLICATION CLIENT, CREATE TABLESPACE ON *.* TO'backup'@'192.168.%' IDENTIFIED BY '123456';

GRANTALL PRIVILEGES ON `mysql`.* TO 'backup'@'192.168.%';

GRANTEVENT ON *.* TO 'backup'@'192.168.%';

9.2,将数据从3307实例同步到3308端口 

备份:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/9a9bc53f6efecade896716debe9df2bc.html