手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

MySQL多实例部署案例

[日期:2012-11-06] 来源:Linux社区  作者:qiuzhijun [字体:大 中 小]

5. 一切准备就绪,启动MySQL实例

 

启动命令mysqld_multi

命令执行语法:

mysqld_multi [OPTIONS] {start|stop|report} [GNR,GNR,GNR...]
或者
mysqld_multi [OPTIONS] {start|stop|report} [GNR-GNR,GNR,GNR-GNR,...]

示例:
mysqld_multi start 3306,3307
或者
mysqld_multi start 3306-3307

 

更多mysqld_multi命令的用法请参考官方文档和网络上其它的文档!同时也可以拷贝MySQL安装目录下support-files/mysqld_multi.server 脚本来启动多实例,这里不再说明!

  1. mysqld_multi start 3306
  2. mysqld_multi start 3307

启动完成后,查看各实例错误日志文件:

[root@MySQL5_10 ~]# cat /data/mysql/data3306/log/error.log

121019 20:33:37 mysqld_safe Starting mysqld daemon with databases from /data/mysql/data3306/data

121019 20:33:38 InnoDB: The InnoDB memory heap is disabled

121019 20:33:38 InnoDB: Mutexes and rw_locks use InnoDB's own implementation

121019 20:33:38 InnoDB: Compressed tables use zlib 1.2.3

121019 20:33:38 InnoDB: Initializing buffer pool, size = 100.0M

121019 20:33:38 InnoDB: Completed initialization of buffer pool

InnoDB: The first specified data file /data/mysql/data3306/innodb_ts/ibdata1 did not exist:

InnoDB: a new database to be created!

121019 20:33:38 InnoDB: Setting file /data/mysql/data3306/innodb_ts/ibdata1 size to 256 MB

InnoDB: Database physically writes the file full: wait...

InnoDB: Progress in MB: 100 200

121019 20:33:49 InnoDB: Log file /data/mysql/data3306/innodb_log/ib_logfile0 did not exist: new to be created

InnoDB: Setting log file /data/mysql/data3306/innodb_log/ib_logfile0 size to 128 MB

InnoDB: Database physically writes the file full: wait...

InnoDB: Progress in MB: 100

121019 20:33:55 InnoDB: Log file /data/mysql/data3306/innodb_log/ib_logfile1 did not exist: new to be created

InnoDB: Setting log file /data/mysql/data3306/innodb_log/ib_logfile1 size to 128 MB

InnoDB: Database physically writes the file full: wait...

InnoDB: Progress in MB: 100

InnoDB: Doublewrite buffer not found: creating new

InnoDB: Doublewrite buffer created

InnoDB: 127 rollback segment(s) active.

InnoDB: Creating foreign key constraint system tables

InnoDB: Foreign key constraint system tables created

121019 20:34:01 InnoDB: Waiting for the background threads to start

121019 20:34:02 InnoDB: 1.1.6 started; log sequence number 0

121019 20:34:03 [Note] Event Scheduler: Loaded 0 events

121019 20:34:03 [Note] /usr/local/webserver/mysql/bin/mysqld: ready for connections.

Version: '5.5.12-log' socket: '/data/mysql/data3306/sock/mysql.sock' port: 3306 Source distribution

[root@MySQL5_10 ~]# cat /data/mysql/data3307/log/error.log

121019 20:44:47 mysqld_safe mysqld from pid file /data/mysql/data3307/sock/mysql.pid ended

121019 20:47:22 mysqld_safe Starting mysqld daemon with databases from /data/mysql/data3307/data

121019 20:47:22 InnoDB: The InnoDB memory heap is disabled

121019 20:47:22 InnoDB: Mutexes and rw_locks use InnoDB's own implementation

121019 20:47:22 InnoDB: Compressed tables use zlib 1.2.3

121019 20:47:22 InnoDB: Initializing buffer pool, size = 100.0M

121019 20:47:22 InnoDB: Completed initialization of buffer pool

InnoDB: The first specified data file /data/mysql/data3307/innodb_ts/ibdata1 did not exist:

InnoDB: a new database to be created!

121019 20:47:22 InnoDB: Setting file /data/mysql/data3307/innodb_ts/ibdata1 size to 256 MB

InnoDB: Database physically writes the file full: wait...

InnoDB: Progress in MB: 100 200

121019 20:47:33 InnoDB: Log file /data/mysql/data3307/innodb_log/ib_logfile0 did not exist: new to be created

InnoDB: Setting log file /data/mysql/data3307/innodb_log/ib_logfile0 size to 128 MB

InnoDB: Database physically writes the file full: wait...

InnoDB: Progress in MB: 100

121019 20:47:40 InnoDB: Log file /data/mysql/data3307/innodb_log/ib_logfile1 did not exist: new to be created

InnoDB: Setting log file /data/mysql/data3307/innodb_log/ib_logfile1 size to 128 MB

InnoDB: Database physically writes the file full: wait...

InnoDB: Progress in MB: 100

InnoDB: Doublewrite buffer not found: creating new

InnoDB: Doublewrite buffer created

InnoDB: 127 rollback segment(s) active.

InnoDB: Creating foreign key constraint system tables

InnoDB: Foreign key constraint system tables created

121019 20:47:46 InnoDB: Waiting for the background threads to start

121019 20:47:47 InnoDB: 1.1.6 started; log sequence number 0

121019 20:47:47 [Note] Recovering after a crash using /data/mysql/data3307/binlog/mysql-bin3307

121019 20:47:47 [Note] Starting crash recovery...

121019 20:47:47 [Note] Crash recovery finished.

121019 20:47:47 [Note] Event Scheduler: Loaded 0 events

121019 20:47:47 [Note] /usr/local/webserver/mysql/bin/mysqld: ready for connections.

Version: '

 

5.5.12-log' socket: '/data/mysql/data3307/sock/mysql.sock' port: 3307 Source distribution

 

下面再看看mysqld_multi日志:

 

[root@MySQL5_10 ~]# cat /data/mysql/multi.log

 

Starting MySQL servers

121019 20:33:37 mysqld_safe Logging to '/data/mysql/data3306/log/error.log'.

121019 20:33:37 mysqld_safe Starting mysqld daemon with databases from /data/mysql/data3306/data

mysqld_multi log file version 2.16; run: 五 10月 19 20:35:27 2012


Starting MySQL servers

121019 20:47:22 mysqld_safe Logging to '/data/mysql/data3307/log/error.log'.

121019 20:47:22 mysqld_safe Starting mysqld daemon with databases from /data/mysql/data3307/data

出现上面信息,说明多实例启动没有问题!

也可通过查看端口信息:

[root@MySQL5_10 ~]# lsof -i:3306

COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME

mysqld 3463 mysql 13u IPv4 9377 TCP *:mysql (LISTEN)

[root@MySQL5_10 ~]# lsof -i:3307

COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME

mysqld 9674 mysql 13u IPv4 20787 TCP *:opsession-prxy (LISTEN)


[root@MySQL5_10 ~]# ps aux |grep mysqld |grep -v grep

 

显示结果略.........
................

linux
相关资讯       MySQL基础教程  MySQL实例  MySQL多实例 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款