由于跨数据库引用而复制数据库时出错 - 表不存在

发布于 2024-11-02 21:25:20 字数 1382 浏览 0 评论 0原文

我们在服务器上运行 mysql v5.0.77,收集一些测量数据。

在mysql服务器上,我们有以下数据库:

raw_data_db
配置表数据库
processed_data_db

我们只想复制使用“raw_data_db”和“config_tables_db”中的信息构建的“processed_data_db”。

当从属服务器尝试复制构建已处理数据的语句时,我们不断收到错误。

示例:
<代码> [错误]从站:查询时出现错误“表‘raw_data_db.s253’不存在”。默认数据库:“数据”。查询:'CREATE TEMPORARY TABLE temp SELECT * FROM raw_data_db.s253 WHERE DateTimeVal>='2011/04/21 17:00:00' AND DateTimeVal<='2011/04/21 17:10:00'',Error_code:1146

我假设正在发生的是跨数据库选择无法找到原始数据库,因为我们没有复制它,并且数据不存在于从属服务器上......或者类似的事情?

所以我尝试使用忽略,但我们仍然收到错误
复制狂野忽略表 = raw_data_db.*
replicate-wild-ignore-table = data.temp*

其他配置信息:
复制重写数据库=processed_data_db->数据
replicate-do-db = data

如果所有表都是根据对其他数据库的引用创建的,是否可以仅复制一个数据库?关于如何解决此错误有什么想法吗?

我研究了基于行的复制,这似乎可以解决问题,但它仅在 v5.1 或更高版本中可用......早期版本中有类似的东西吗?

我将忽略表语句修复为“data.%temp%”,它似乎忽略得很好,但我仍然无法复制我想要的表,因为插入语句现在引用了一个不存在的表。

例如
<代码> 查询时出现错误“表‘data.temp’不存在”。默认数据库:“数据”。查询: 'INSERT INTO abc SELECT FROM_UNIXTIME(AVG(UNIX_TIMESTAMP(DateTimeVal))), ROUND(AVG(差异),3), ROUND(STDDEV(差异),3), ROUND(AVG(频率),0), ROUND( AVG(SignalPower),1) FROM temp WHERE ABS(Difference)<'10000.0' AND Difference!='0'' 处理

是从原始数据库创建临时表,然后对临时表中的所有值求平均值并将结果插入到processed_data_db中,但由于我忽略了create语句,因此它无权访问这些表,但我首先忽略它们的原因是因为它们引用了我想要复制的内容之外的表...所以我不确定应该如何处理这个...任何建议都会很大赞赏。

We have mysql v5.0.77 running on a server collecting some measurement data.

On the mysql server, we have the following databases:

raw_data_db
config_tables_db
processed_data_db

We ONLY want to replicate the 'processed_data_db' which is constructed using information from the 'raw_data_db' and 'config_tables_db'.

We keep getting errors on our slave server when it tries to duplicate the statements that are constructing the processed data.

Example:

[ERROR] Slave: Error 'Table 'raw_data_db.s253' doesn't exist' on query. Default database: 'data'. Query: 'CREATE TEMPORARY TABLE temp SELECT * FROM raw_data_db.s253 WHERE DateTimeVal>='2011/04/21 17:00:00' AND DateTimeVal<='2011/04/21 17:10:00'', Error_code: 1146

What I am assuming is happening is that the cross-db selects can't find the raw database because we aren't replicating it, and the data do not exist on the slave...or something along those lines?

So I tried using ignores, but we're still getting the errors
replicate-wild-ignore-table = raw_data_db.*
replicate-wild-ignore-table = data.temp*

Other configuration information:
replicate-rewrite-db = processed_data_db->data
replicate-do-db = data

Is it possible to replicate just the one database if all the tables are created from references to other databases? Any ideas on how to get around this error?

I looked in to row-based replication which seemed like it might do the trick, but it's only available in v5.1 or greater....is there anything similar in earlier versions?

I fixed the ignore table statements to "data.%temp%", and it seems to be ignoring just fine, but I still can't replicate the tables I want because the insert statement is now referencing a table that doesn't exist.

ex.

Error 'Table 'data.temp' doesn't exist' on query. Default database: 'data'. Query: 'INSERT INTO abc SELECT FROM_UNIXTIME(AVG(UNIX_TIMESTAMP(DateTimeVal))), ROUND(AVG(Difference),3), ROUND(STDDEV(Difference),3), ROUND(AVG(Frequency),0), ROUND(AVG(SignalPower),1) FROM temp WHERE ABS(Difference)<'10000.0' AND Difference!='0''

The processing is creating temporary tables from the raw database and then averaging all the values in the temporary table and inserting the result in to the processed_data_db, but since I'm ignoring the create statements, it doesn't have access to those tables, but the reason I'm ignoring them in the first place is because they reference tables outside of what I want to replicate...so I'm not sure how I should approach this....any suggestions would be greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

与君绝 2024-11-09 21:25:20

临时表和复制
选项。默认情况下,所有临时
表被复制;发生这种情况
是否有匹配的
--replicate-do-db、--replicate-do-table 或 --replicate-wild-do-table 选项有效。然而,
--replicate-ignore-table 和 --replicate-wild-ignore-table 选项适用于临时表。

http://dev.mysql.com/doc/refman /5.0/en/replication-features-temptables.html

编辑:

  1. 复制 raw_data_db 和 config_tables_db 表,使用
    在您插入查询时
  2. 使用 drbd 协议
    http://www.mysql.com/why-mysql/drbd/

Temporary tables and replication
options. By default, all temporary
tables are replicated; this happens
whether or not there are any matching
--replicate-do-db, --replicate-do-table, or --replicate-wild-do-table options in effect. However, the
--replicate-ignore-table and --replicate-wild-ignore-table options are honored for temporary tables.

http://dev.mysql.com/doc/refman/5.0/en/replication-features-temptables.html

edit:

  1. replicate raw_data_db and config_tables_db tables which using
    in you insert query
  2. use drbd protocol
    http://www.mysql.com/why-mysql/drbd/
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文