mysql多版本多实例部署_MySQL2种多实例部署方式总结

注意事项单独管理集中管理(mysqld_multi)

配置文件使用不同的配置文件共用一个配置文件

端口不可冲突不可冲突

basedir可单独目录/可相同目录可单独目录/可相同目录

datadir不相同不相同

pid文件不可冲突/独立访问不可冲突/独立访问

sock不可冲突/独立访问不可冲突/独立访问

log不可冲突/独立访问不可冲突/独立访问

启动方式自定义、分别文件管理启动mysqld_multi集中管理

优点缺点步骤稍微多一些,独自管理,风险略小步骤简单,需要一定技术含量管理维护

eg配置文件:(单独管理)#MySQLone

/usr/local/mysqlone/my.cnf

#MySQLtwo

/usr/local/mysqltwo/my.cnf

eg:启动方式(独立启动)[root@MySQL ~]# /etc/init.d/mysqldone start

[root@MySQL ~]# /etc/init.d/mysqltwo start

eg:进程查看|进程查看[root@MySQL ~]# netstat -atupn|grep -E --color ‘3306|3307‘

tcp        0      0 :::3306                     :::*                        LISTEN      7071/mysqld

tcp        0      0 :::3307                     :::*                        LISTEN      7077/mysqld

[root@MySQL ~]#

0475292a2467d8c6c08a227b1ebebde4.png

二、集中部署(mysqld_multi)

eg:配置文件(集中管理)/etc/my.cnf

[mysqld3306]

port = 3306

basedir = /usr/local/mysql

datadir = /usr/local/mysql/data/mysqlone

#启动可自定义,也可配置文件定义

#socket  =

#pidfile =

log-error

[mysqld3308]

port = 3307

basedir = /usr/local/mysql

datadir = /usr/local/mysql/data/mysqltwo

#启动可自定义,也可配置文件定义

#socket  =

#pidfile =

#log-error

[mysqld_multi]

mysqld=/usr/local/mysql/bin/mysqld_safe

mysqladmin=/usr/local/mysql/bin/mysqladmin

eg:初始化方式:/usr/local/mysql/scripts/mysql_install_db --datadir=/usr/local/mysql/data/MySQL_3306 --basedir=/usr/local/mysql --user=mysql

/usr/local/mysql/scripts/mysql_install_db --datadir=/usr/local/mysql/data/MySQL_3307 --basedir=/usr/local/mysql --user=mysql

eg:启动方式:(其它参数可自定义)[root@MySQL ~]# mysqld_multi  start 3306,3307

[root@MySQL ~]# mysqld_multi  report

Reporting MySQL servers

MySQL server from group: mysqld3306 is running

MySQL server from group: mysqld3307 is running

[root@MySQL ~]#

#停止一个实例:

[root@MySQL ~]# mysqld_multi stop 3306

[root@MySQL ~]# mysqld_multi report

Reporting MySQL servers

MySQL server from group: mysqld3306 is not running

MySQL server from group: mysqld3307 is running

[root@MySQL ~]#

eg:端口查看|进程查看

[root@MySQL ~]# netstat -atupn|grep -E --color ‘3306|3307‘

tcp        0      0 :::3306                     :::*                        LISTEN      7071/mysqld

tcp        0      0 :::3307                     :::*                        LISTEN      7077/mysqld

[root@MySQL ~]#

0475292a2467d8c6c08a227b1ebebde4.png

三、客户端访问:

3306:[root@MySQL ~]# mysql --sock=/usr/local/mysql/data/MySQL_3306/mysql.sock

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

Your MySQL connection id is 2

Server version: 5.6.21-log MySQL Community Server (GPL)

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

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

mysql>

3307:[root@MySQL ~]# mysql --sock=/usr/local/mysql/data/MySQL_3307/mysql.sock

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

Your MySQL connection id is 4

Server version: 5.6.21-log MySQL Community Server (GPL)

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

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

mysql>

如有不足,可指教。

本文出自 “永不放弃!任志远” 博客,谢绝转载!

MySQL2种多实例部署方式总结

标签:mysql2种多实例部署方式总结

本条技术文章来源于互联网,如果无意侵犯您的权益请点击此处反馈版权投诉

本文系统来源:http://renzhiyuan.blog.51cto.com/10433137/1902051

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值