0

所以一个月前,我设置了从我的一个 Web 服务器到 m 个本地 LAN 服务器的复制。我有 2 个本地 LAN 服务器,它们是主 Web 服务器(falcon)的从属服务器(quad 和 hex)。数周以来,复制工作没有问题。

然后我在本周早些时候注意到 I/O 线程既没有运行在 quad 也没有运行在 hex 上。所以我一遍又一遍地重新启动它们,因为每隔一段时间,对于至少一个从属服务器来说,看起来一切都会正常运行长达几分钟。然后 I/O 线程将再次停止工作。我试图通过 phpmyadmin 重新配置两台 LAN 机器上的主服务器,并且 phpmyadmin 报告从服务器现在连接到主服务器。phpmyadmin 现在(不是昨天)为我提供了将从属数据库与主数据库同步的选项。我运行它,几秒钟后页面停止加载,但没有给出响应(错误或其他)。

所有涉及的机器都在 Ubuntu 12.04 上运行 LAMP 堆栈。Web 服务器是 12.04 服务器,而 LAN 机器都是 12.04 桌面。我怀疑我在 LAN 机器上运行了 apt-get update/upgrade,而忽略了在我的猎鹰上这样做。所以今天早上我在所有三台机器上运行了它。I/O 线程仍然不会运行。

SQL 线程始终在运行。有时,主站会显示其中一个从站(十六进制)已连接。但它不会保持连接。

就像我说的那样,这工作了数周而没有问题。然后最近停止了。所以这就是为什么我怀疑最近的更新/升级中的某些东西破坏了这一切。

有谁知道如何修复这个?

谢谢

根据请求添加 - 来自 falcon 的 my.cnf:

#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port            = xxxx
socket          = /var/run/mysqld/mysqld.sock

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket          = /var/run/mysqld/mysqld.sock
nice            = 0

[mysqld]
#
# * Basic Settings
#
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = xxxx
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address            = xxx.xxx.xxx.xxx
#
# * Fine Tuning
#
key_buffer              = 16M
max_allowed_packet      = 16M
thread_stack            = 192K
thread_cache_size       = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover         = BACKUP
#max_connections        = 100
#table_cache            = 64
#thread_concurrency     = 10
#
# * Query Cache Configuration
#
query_cache_limit       = 1M
query_cache_size        = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file        = /var/log/mysql/mysql.log
#general_log             = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Here you can see queries with especially long duration
#log_slow_queries       = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id              = 1
#log_bin                        = /var/log/mysql/mysql-bin.log
expire_logs_days        = 10
max_binlog_size         = 100M
#binlog_do_db           = include_database_name
#binlog_ignore_db       = include_database_name

# Replication per phpmyadmin - falcon is the MASTER
server-id=8503668
log-bin=mysql-bin
log-error=mysql-bin.err

#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#

# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem



[mysqldump]
quick
quote-names
max_allowed_packet      = 16M

[mysql]
#no-auto-rehash # faster start of mysql but no tab completition

[isamchk]
key_buffer              = 16M

#
# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/

此外,根据请求添加,quad 上 my.cnf 中的行将其设置为复制

# Replication per phpmyadmin
server-id=1369932901
report-host=quad
replicate-ignore-db=visits

my.cnf 的其余部分是默认的,除了绑定地址是 quad 的 LAN IP 192.168.1.70。十六进制的 my.cnf 与服务器 ID 不同的方式相同,报告主机是十六进制,它忽略访问数据库。而且,与 quad 一样,绑定地址是本地 LAN IP 192.168.1.60。

周末更新: 这个问题漂浮了 4 天,没有关于如何修复曾经有效的损坏复制的答案。我已经发布了 my.cnf (或者至少是它的相关部分),但没有人对修复什么有任何建议。在这 4 天中,这个问题一直存在,其中 2 天是周末,所以我没有期待太多。

奇怪的是,昨晚我第 100 次对两个奴隶进行了完整的奴隶启动,最终成功了。两个奴隶都跑了一夜没有问题,现在报告他们追上了主人(落后 0 秒)。我在主服务器上创建了一个垃圾数据库,以测试一切是否正常工作。它几乎立即出现在两个奴隶身上。

我仍然不知道为什么它首先停止工作。有人建议需要经常监控 MySQL 复制。有没有为此目的的好工具?(奴隶是 Ubuntu,我主要用 PHP 编写代码。)

4

1 回答 1

0
  • 如果从I/O thread服务器不再在此服务器上运行,请检查从服务器的错误日志以获取可能指示此线程可能已停止的原因的消息。
  • 检查错误日志的最后 100 行,看看是否提供了线索。通常问题是CHANGE MASTER TO命令中给出的错误位置。通常最简单的解决方法是重新设置从站,就像它是一个新的从站一样。最后一个错误可以由Last Error Number和确定Last Error
  • 检查您是否能够从从服务器 ping/telnet 到主服务器。
于 2013-07-24T11:28:15.423 回答