实现两个局域网的服务器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线程
这是为什么呢
两台服务器都要对外映射端口吗?

解决方案 »

  1.   

    [Quote=引用 1 楼  的回复:]
    salve能访问master就可以
    [/Quot为什么没有 Binlog Dump线程
      

  2.   

    没有新的binlog生成就不binlogdump吧在slave上执行show slave status\G看看是不是里两个yes  是两个yes就一切ok
      

  3.   

              Slave_IO_Running: Yes
              Slave_SQL_Running: Yes
      

  4.   

        Slave_IO_Running: Connecting
        Slave_SQL_Running: Yes
    错误日志:
    120816  0:44:57 [ERROR] Slave I/O: error connecting to master '[email protected]:3307' - retry-time: 60  retries: 86400, Error_code: 2003
    120816  0:44:57 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.000002' at position 1594, relay log './localhost-relay-bin.000001' position: 4