网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

mysqld_multi部署单机有哪些注意事项-创新互联

本文主要给大家简单讲讲mysqld_multi部署单机有哪些注意事项,相关专业术语大家可以上网查查或者找一些相关书籍补充一下,这里就不涉猎了,我们就直奔主题吧,希望mysqld_multi部署单机有哪些注意事项这篇文章可以给大家带来一些实际帮助。                                                         

创新互联建站于2013年成立,先为朝阳等服务建站,朝阳等地企业,进行企业商务咨询服务。为朝阳企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。一、mysql编译安装:
cd /usr/local/src
wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz 
tar zxvf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz
mv mysql-5.6.35-linux-glibc2.5-x86_64 /usr/local/mysql
cd /usr/local/mysql
useradd mysql
mkdir -p /data/mysql
chown -R mysql:mysql /data/mysql
./scripts/mysql_install_db --user=mysql --datadir=/data/mysql
cp support-files/my-default.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
二、准备第一个多实例3307

2.1 创建目录:

mkdir /usr/local/mysql3307
chown -R mysql.mysql /usr/local/mysql3307/
mkdir -p /data/mysql3307
chown -R mysql.mysql /data/mysql3307
mkdir -p /home/data/mysql3307/binlog
chown -R mysql.mysql /home/data/mysql3307

2.2 配置文件

[root@zhdya01 ~]# vim /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[mysqld_multi]
mysqld = /usr/local/mysql/bin/mysqld_safe
mysqladmin =/usr/local/mysql/bin/mysqladmin
log =/var/log/mysqld_multi.log
[mysqld1]
socket = /usr/local/mysql3307/mysql.sock
port = 3307
pid-file = /usr/local/mysql3307/mysql.pid
datadir = /data/mysql3307
log_bin=/home/data/mysql3307/binlog
server-id = 1
innodb_buffer_pool_size = 128M
innodb_flush_log_at_trx_commit = 0

2.3 初始化数据库

/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql3307
三、准备第二个多实例3308

3.1 创建目录:

mkdir /usr/local/mysql3308
chown -R mysql.mysql /usr/local/mysql3308/
mkdir -p /data/mysql3308
chown -R mysql.mysql /data/mysql3308
mkdir -p /home/data/mysql3308/binlog
chown -R mysql.mysql /home/data/mysql3308

3.2 配置文件

[root@zhdya01 ~]# vim /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[mysqld_multi]
mysqld = /usr/local/mysql/bin/mysqld_safe
mysqladmin =/usr/local/mysql/bin/mysqladmin
log =/var/log/mysqld_multi.log
[mysqld1]
socket = /usr/local/mysql3307/mysql.sock
port = 3307
pid-file = /usr/local/mysql3307/mysql.pid
datadir = /data/mysql3307
log_bin=/home/data/mysql3307/binlog
server-id = 1
innodb_buffer_pool_size = 128M
innodb_flush_log_at_trx_commit = 0
[mysqld2]
socket = /usr/local/mysql3308/mysql.sock
port = 3308
pid-file = /usr/local/mysql3308/mysql.pid
datadir = /data/mysql3308
log_bin=/home/data/mysql3308/binlog
server-id = 2
innodb_buffer_pool_size = 128M
innodb_flush_log_at_trx_commit = 0

3.3 初始化数据库

/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql3308
四、启动多实例
/etc/init.d/mysqld start
mysqld_multi --defaults-extra-file=/etc/my.cnf start 1,2
[root@zhdya01 bin]# !net
netstat -lntp -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address  Foreign Address  State PID/Program name 
tcp 0 0 0.0.0.0:22  0.0.0.0:*  LISTEN 1241/sshd  
tcp 0 0 127.0.0.1:25  0.0.0.0:*  LISTEN 2087/master  
tcp6 0 0 :::3306   :::*   LISTEN 4406/mysqld  
tcp6 0 0 :::3307   :::*   LISTEN 4197/mysqld  
tcp6 0 0 :::3308   :::*   LISTEN 3359/mysqld  
tcp6 0 0 :::8080   :::*   LISTEN 2222/java  
tcp6 0 0 :::22   :::*   LISTEN 1241/sshd  
tcp6 0 0 ::1:25   :::*   LISTEN 2087/master
五、查看启动状态
[root@zhdya01 bin]# 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
六、停止多实例
[root@zhdya01 bin]# mysqld_multi --defaults-extra-file=/etc/my.cnf stop 1,2
[root@zhdya01 bin]# mysqld_multi --defaults-extra-file=/etc/my.cnf report
Reporting MySQL servers
MySQL server from group: mysqld1 is not running
MySQL server from group: mysqld2 is not running
七、各自登录mysql实例
[root@zhdya01 bin]# mysql --socket=/usr/local/mysql3307/mysql.sock
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.35-log MySQL Community Server (GPL)
Copyright (c) 2000, 2016, 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>

mysqld_multi部署单机有哪些注意事项就先给大家讲到这里,对于其它相关问题大家想要了解的可以持续关注我们的行业资讯。我们的板块内容每天都会捕捉一些行业新闻及专业知识分享给大家的。


文章标题:mysqld_multi部署单机有哪些注意事项-创新互联
文章出自:http://bjjierui.cn/article/cdghph.html

其他资讯