【发布时间】:2015-06-18 05:00:43
【问题描述】:
我们在主库中创建了一个触发器,但该触发器没有出现在从库中。
以下是创建触发器的示例:
CREATE TRIGGER filter_pos_transaction_delivery_combo_details BEFORE INSERT ON `pos-transaction_delivery_combo_details`
for each row
begin
DECLARE msg VARCHAR(200);
SET @store_code = (SELECT value FROM `admin-settings` WHERE attribute = 'local_store_code' LIMIT 1);
if STRCMP(new.store_code,@store_code) != 0 then
if STRCMP( @store_code,'MAINDB') != 0 then
set msg = "SKIPPING INSERTION: THIS DATA IS NOT FOR THIS LOCAL DB - pos-transaction_delivery_combo_details ";
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = msg;
end if;
end if;
end;
这里是cnf配置:
[mysqld]
user = mysql
port = 3306
datadir = /data/mysql/
pid-file = /data/mysql/fusion-maindb.pid
socket = /data/mysql/fusion-maindb.sock
log_error = /datalog/mysql_error_log/mysql_error.log
## Replication and Logging Settings ###
server_id = 11111111
log_bin = /datalog/rep_binlogs/maindb-bin.log
binlog_do_db = fusion
replicate_do_db = fusion
max_binlog_size = 1000M
slave-skip-errors = 1644,1007,1062,1449,1146,1062
innodb_buffer_pool_size = 8000M
log_slave_updates = 1
skip-external-locking
sync_binlog = 1
slave_net_timeout = 60
innodb_lock_wait_timeout = 120
binlog_format = STATEMENT
slave_compressed_protocol = 1
wait_timeout = 300
interactive_timeout = 300
【问题讨论】:
-
显示您尝试过的内容?
-
分享您的 mysql 版本和配置文件 my.cnf 或 my.ini 以及您如何在 master 上执行触发器创建语句。
-
我们使用的是 MySQL 5.6
标签: mysql triggers replication