mysql5.6主从环境安装配置步骤详解
发布:smiling 来源: PHP粉丝网 添加日期:2014-10-17 14:48:56 浏览: 评论:0
主从配置是现在服务器集群中一个重要的数据处理方式了,下文来介绍在mysql5.6中快速配置安装mysql5.6的主从配置了,希望能帮助到各位.
服务器配置:
10.1.1.231 master server
10.1.1.234 slave server
服务器系统为:centos5.6
软件包:
- MySQL-client-5.6.13-1.linux_glibc2.5.x86_64.rpm
- MySQL-devel-5.6.13-1.linux_glibc2.5.x86_64.rpm
- MySQL-server-5.6.13-1.linux_glibc2.5.x86_64.rpm
- MySQL-shared-5.6.13-1.linux_glibc2.5.x86_64.rpm
- MySQL-shared-compat-5.6.13-1.linux_glibc2.5.x86_64.rpm
- MySQL-test-5.6.13-1.linux_glibc2.5.x86_64.rpm
一、安装mysql
- yum -y install libaio libaio-devel perl-Time-HiRes curl curl-devel zlib-devel openssl-devel perl cpio expat-devel gettext-devel perl-ExtUtils-MakeMaker perl-DBD-MySQL
- rpm -ivh MySQL-test-5.6.13-1.linux_glibc2.5.x86_64.rpm
- rpm -ivh MySQL-shared-5.6.13-1.linux_glibc2.5.x86_64.rpm
- rpm -ivh MySQL-shared-compat-5.6.13-1.linux_glibc2.5.x86_64.rpm
- rpm -ivh MySQL-server-5.6.13-1.linux_glibc2.5.x86_64.rpm
- rpm -ivh MySQL-devel-5.6.13-1.linux_glibc2.5.x86_64.rpm
- rpm -ivh MySQL-client-5.6.13-1.linux_glibc2.5.x86_64.rpm
二、修改master和slave配置,部分参数要根据实际情况来调整,主库/etc/my.cnf配置:
- [client]
- port = 3306
- socket = /state/partition1/mysql/mysql.sock
- default-character-set=utf8
- [mysqld]
- server-id=1025
- log-bin=mysql-master-bin
- binlog_format = mixed
- expire_logs_days=15
- max_connections=1000
- innodb_flush_log_at_trx_commit=1
- sync_binlog=1
- binlog-do-db=denovo_ng
- binlog-ignore-db=mysql,test,information_schema
- innodb_buffer_pool_size = 46673M
- skip-name-resolve
- datadir = /state/partition1/mysql/data
- port = 3306
- socket = /state/partition1/mysql/mysql.sock
- key_buffer_size=16M
- max_allowed_packet=16M
- join_buffer_size = 512M
- sort_buffer_size = 256M
- read_rnd_buffer_size = 128M
- innodb_buffer_pool_size = 40960M
- sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
从库/etc/my.cnf配置:
- [client]
- port = 3306
- socket = /state/partition1/mysql/mysql.sock
- [mysqld]
- server-id=1052
- datadir = /state/partition1/mysql/data
- port = 3306
- socket = /state/partition1/mysql/mysql.sock
- user=mysql
- log-bin=mysql-slave-bin
- max_binlog_size=1000M
- binlog_format = mixed
- expire_logs_days=7
- innodb_flush_log_at_trx_commit=1
- sync_binlog=1
- read_only=1
- binlog-do-db=denovo_ng
- binlog-ignore-db=mysql,test,information_schema
- innodb_buffer_pool_size = 36673M
- skip-name-resolve
- max_connections=1000
- max_user_connections=490
- max_connect_errors=2
- key_buffer_size=16M
- max_allowed_packet=16M
- join_buffer_size = 512M
- sort_buffer_size = 256M
- read_rnd_buffer_size = 128M
- innodb_buffer_pool_size = 40960M --phpfensi.com
- sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
三、进行主从库账号授权:
主库:grant replication slave on *.* to 'jpsync'@'10.1.1.234' identified by 'jppasswd';
flush privileges;
show master status; #查看主库信息
从库:
- stop slave;
- change master to master_host='10.1.1.231',master_port=3306,master_user='jpsync',master_password='jppasswd', master_log_file='mysql-master-bin.000003',master_log_pos=408;
- start slave;
- show slave statusG;
如果出现:
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
表明mysql主从库成功.
Tags: mysql5 6 mysql主从环境
相关文章
- ·CentOS6.4安装配置mysql 5.6服务器方法(2014-09-24)
- ·MySQL5.6 Using a password on the command line interface can be insecure(2014-09-24)
- ·mysql 5.5与5.6 timestamp 字段 DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIM(2014-09-27)
- ·Mysql5.5 InnoDB存储引擎设置(2014-09-28)
- ·mysql5.6设置sql_mode方法详解(2014-09-28)
- ·MYSQL开启慢查询与mysql5.6开启慢查询出错(2014-10-01)
- ·MySQL5.5默认编码的设置修改方法详解(2014-10-02)
- ·Linux中MySql5手动安装方法详解(2014-10-04)
- ·linux中mysql 5.5二进制文件安装详解(2014-10-04)
- ·mysql5存储过程入门创建,删除,调用详解(2014-10-07)
- ·MySql 5.X创建用户并授权方法(2014-10-08)
- ·mysql5 插入中文乱码问题(2014-10-08)
- ·mysql5.5提示Could not initialize master info structure(2014-10-09)
- ·mysql5 sql-mode 引起的错误解决办法(2014-10-10)
- ·MySQL5的存储过程详细实例(2014-10-13)
- ·php调用mysql5存储过程方法(2014-10-14)
推荐文章
热门文章
最新评论文章
- 写给考虑创业的年轻程序员(10)
- PHP新手上路(一)(7)
- 惹恼程序员的十件事(5)
- PHP邮件发送例子,已测试成功(5)
- 致初学者:PHP比ASP优秀的七个理由(4)
- PHP会被淘汰吗?(4)
- PHP新手上路(四)(4)
- 如何去学习PHP?(2)
- 简单入门级php分页代码(2)
- php中邮箱email 电话等格式的验证(2)