Linuxcentos5.6版本下mysql5.6主从环境安装配置方法
这篇文章主要讲解了“Linux centos5.6版本下MySQL5.6主从环境安装配置方法”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“Linux centos5.6版本下mysql5.6主从环境安装配置方法”吧!
创新互联专注于庄浪网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供庄浪营销型网站建设,庄浪网站制作、庄浪网页设计、庄浪网站官网定制、小程序设计服务,打造庄浪网络公司原创品牌,更为您提供庄浪网站排名全网营销落地服务。
服务器配置,具体iP,主从库如下
主库 IP:192.168.1.189 master server 从库 IP:192.168.1.188 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命令,安装所有所需rpm文件
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 sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
三、进行主从库账号授权操作:
主库
grant replication slave on *.* to 'jpsync'@'192.168.1.189' identified by 'jppasswd'; flush privileges; show master status; #查看主库信息
从库
stop slave; change master to master_host='192.168.1.188',master_port=3306,master_user='jpsync',master_password='jppasswd', master_log_file='mysql-master-bin.000003',master_log_pos=408; start slave; show slave status\G;
如果出现
Slave_IO_Running: Yes Slave_SQL_Running: Yes
表明mysql主从库成功。
感谢各位的阅读,以上就是“Linux centos5.6版本下mysql5.6主从环境安装配置方法”的内容了,经过本文的学习后,相信大家对Linux centos5.6版本下mysql5.6主从环境安装配置方法这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是创新互联,小编将为大家推送更多相关知识点的文章,欢迎关注!
文章名称:Linuxcentos5.6版本下mysql5.6主从环境安装配置方法
网页地址:http://ybzwz.com/article/pegsej.html