- 论坛徽章:
- 0
|
本帖最后由 浅爱拉拉 于 2012-08-16 13:34 编辑
实现两个局域网的服务器mysql数据库同步
mysql3306端口对外映射成XXXX端口
配置master过程:
创建用户admin
create user 'admin'@'%' identified by 'admin';
grant super,replication slave,file,reload on *.* to 'admin'@'%' identified by 'admin';
flush privileges;
/etc下没有my.cnf文件,于是从安装目录下copy文件mysql-large.cnf到/etc目录下,并修改成my.cnf
[mysqld]
port= 3306
socket = /var/lib/mysql/mysql.sock
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 1M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
thread_concurrency = 8
server-id = 1
log-bin=mysql-bin
log-bin-index=mysql-bin.index
binlog_format=mixed
重启服务。
show master status 显示没有问题
show processlist 没有 Binlog Dump线程
这是为什么呢
错误日志:
120816 11:06:28 [ERROR] Slave I/O: error connecting to master 'admin@211.6.106.200:3307' - retry-time: 60 retries: 86400, Error_code: 2003
120816 11:06:28 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.000002' at position 6207, relay log './localhost-relay-bin.000001' p osition: 4
120816 11:16:26 [Note] /usr/sbin/mysqld: Normal shutdown
120816 11:16:26 [Note] Slave I/O thread killed while connecting to master
120816 11:16:26 [Note] Slave I/O thread exiting, read up to log 'mysql-bin.000002', position 6207
120816 11:16:26 [Note] Event Scheduler: Purging the queue. 0 events
120816 11:16:26 [Note] Error reading relay log event: slave SQL thread was kille d
|
|