免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1402 | 回复: 3
打印 上一主题 下一主题

mysql的replication问题求救,在线等! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-01-05 09:54 |只看该作者 |倒序浏览
操作系统是linux8
mysql:4.0.23
我想作双机互备,从机的配置文件如下:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
server-id=2
master-host=192.168.1.252
master-user=root
master-password=123456
master-port=3307
master-connect-retry=10
replicate-do-db=mytest
log-bin=/var/lib/mysql/mysql/mytest
binlog-do-db=mytest

[mysql.server]
user=mysql
basedir=/var/lib

[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

我用show slave status,结果如下:
+---------------+-------------+-------------+---------------+-----------------+---------------------+-------------------------+---------------+-----------------------+------------------+-------------------+-----------------+---------------------+------------+------------+--------------+---------------------+-----------------+
| Master_Host   | Master_User | Master_Port | Connect_retry | Master_Log_File | Read_Master_Log_Pos | Relay_Log_File          | Relay_Log_Pos | Relay_Master_Log_File | Slave_IO_Running | Slave_SQL_Running | Replicate_do_db | Replicate_ignore_db | Last_errno | Last_error | Skip_counter
| Exec_master_log_pos | Relay_log_space |
+---------------+-------------+-------------+---------------+-----------------+---------------------+-------------------------+---------------+-----------------------+------------------+-------------------+-----------------+---------------------+------------+------------+--------------+---------------------+-----------------+
| 192.168.1.252 | root        | 3307        | 10            |                 | 4                   | localhost-relay-bin.007 | 4             |                       | No               | No                | mytest          |                     | 0          |            | 0
| 0                   | 0               |
+---------------+-------------+-------------+---------------+-----------------+---------------------+-------------------------+---------------+-----------------------+------------------+-------------------+-----------------+---------------------+------------+------------+--------------+---------------------+-----------------+

我发现Slave_IO_Running | Slave_SQL_Running 的 状态均为NO.
show processlist,结果如下:
+----+------+-----------+------+---------+------+-------+------------------+
| Id | User | Host      | db   | Command | Time | State | Info             |
+----+------+-----------+------+---------+------+-------+------------------+
|  1 | root | localhost | NULL | Sleep   | 704  |       | NULL             |
|  3 | root | localhost | NULL | Query   | 0    | NULL  | show processlist |
+----+------+-----------+------+---------+------+-------+------------------+
在主机里的都很正常,有谁知道原因?

论坛徽章:
0
2 [报告]
发表于 2005-01-05 10:41 |只看该作者

mysql的replication问题求救,在线等!

在slave server 中使用 slave start 启动。。

论坛徽章:
0
3 [报告]
发表于 2005-01-05 11:55 |只看该作者

mysql的replication问题求救,在线等!

这个问题已经解决,新的问题又来了.我在用show processlist时,显示connecting to master,连不上?
我检查了授权,没有问题呀.
[quote]原帖由 "平凡的香草"]在slave server 中使用 slave start 启动。。[/quote 发表:

论坛徽章:
0
4 [报告]
发表于 2005-01-05 14:22 |只看该作者

mysql的replication问题求救,在线等!

有两点:
1,serverid为1
2,binlog启用
应该就可以实现master server了。。。

仔细看看下面的描述

# Replication Master Server (default)
# binary logging is required for replication
log-bin

# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id       = 1

# Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
#    the syntax is:
#
#    CHANGE MASTER TO MASTER_HOST=<host>;, MASTER_PORT=<port>;,
#    MASTER_USER=<user>;, MASTER_PASSWORD=<password>; ;
#
#    where you replace <host>;, <user>;, <password>; by quoted strings and
#    <port>; by the master's port number (3306 by default).
#
#    Example:
#
#    CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
#    MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
#
# 2) Set the variables below. However, in case you choose this method, then
#    start replication for the first time (even unsuccessfully, for example
#    if you mistyped the password in master-password and the slave fails to
#    connect), the slave will create a master.info file, and any later
#    change in this file to the variables' values below will be ignored and
#    overridden by the content of the master.info file, unless you shutdown
#    the slave server, delete master.info and restart the slaver server.
#    For that reason, you may want to leave the lines below untouched
#    (commented) and instead use CHANGE MASTER TO (see above)
#
# required unique id between 2 and 2^32 - 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
#server-id       = 2
#
#    MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
#
# 2) Set the variables below. However, in case you choose this method, then
#    start replication for the first time (even unsuccessfully, for example
#    if you mistyped the password in master-password and the slave fails to
#    connect), the slave will create a master.info file, and any later
#    change in this file to the variables' values below will be ignored and
#    overridden by the content of the master.info file, unless you shutdown
#    the slave server, delete master.info and restart the slaver server.
#    For that reason, you may want to leave the lines below untouched
#    (commented) and instead use CHANGE MASTER TO (see above)
#
# required unique id between 2 and 2^32 - 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
#server-id       = 2
#
# The replication master for this slave - required
#master-host     =   <hostname>;
#
# The username the slave will use for authentication when connecting
# to the master - required
#master-user     =   <username>;
#
# The password the slave will authenticate with when connecting to
# the master - required
#master-password =   <password>;
#
# The port the master is listening on.
# optional - defaults to 3306
#master-port     =  <port>;
#
# binary logging - not required for slaves, but recommended
#log-bin

# Point the following paths to different dedicated disks
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP