Chinaunix

标题: mysql的replication问题求救,在线等! [打印本页]

作者: anchen211    时间: 2005-01-05 09:54
标题: mysql的replication问题求救,在线等!
操作系统是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 |
+----+------+-----------+------+---------+------+-------+------------------+
在主机里的都很正常,有谁知道原因?
作者: 平凡的香草    时间: 2005-01-05 10:41
标题: mysql的replication问题求救,在线等!
在slave server 中使用 slave start 启动。。
作者: anchen211    时间: 2005-01-05 11:55
标题: mysql的replication问题求救,在线等!
这个问题已经解决,新的问题又来了.我在用show processlist时,显示connecting to master,连不上?
我检查了授权,没有问题呀.
[quote]原帖由 "平凡的香草"]在slave server 中使用 slave start 启动。。[/quote 发表:

作者: 平凡的香草    时间: 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




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2