20170313 upgrade.md 2.3 KB

1. DB部分

  • yhb_search新建suggest_conversion表

    DROP TABLE IF EXISTS suggest_conversion; CREATE TABLE suggest_conversion ( id int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自动增长的唯一主键', source varchar(32) CHARACTER SET utf8 NOT NULL COMMENT '原始关键词', dest varchar(255) CHARACTER SET utf8 NOT NULL COMMENT '转换后的关键词信息', update_time int(10) unsigned DEFAULT NULL COMMENT '更新时间', PRIMARY KEY (id), UNIQUE KEY IDX_SUGGEST_CONVERSION_SOURCE (source) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;

  • yhb_search新建spider_content表

    DROP TABLE IF EXISTS spider_content; CREATE TABLE spider_content ( id int(10) unsigned NOT NULL AUTO_INCREMENT, subject varchar(128) CHARACTER SET utf8 NOT NULL, summary varchar(1024) CHARACTER SET utf8 DEFAULT NULL, content varchar(10240) CHARACTER SET utf8 DEFAULT NULL, url varchar(255) CHARACTER SET utf8 DEFAULT NULL, create_time int(10) DEFAULT NULL, update_time int(10) DEFAULT NULL, PRIMARY KEY (id), UNIQUE KEY IDX_SPIDER_CONTENT_SUBJECT (subject) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;

  • yhb_search和yhb_operations新建suggest_conversion_custom表

    DROP TABLE IF EXISTS suggest_conversion_custom; CREATE TABLE suggest_conversion_custom ( id int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自动增长的唯一主键', source varchar(32) NOT NULL COMMENT '原始关键词', dest varchar(255) NOT NULL COMMENT '转换后的关键词信息', update_time int(10) unsigned DEFAULT NULL COMMENT '更新时间', status int(10) unsigned NOT NULL DEFAULT '1' COMMENT '是否启用 1:启动 0:不启动', PRIMARY KEY (id), UNIQUE KEY IDX_SUGGEST_CONVERSION_SOURCE (source) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;

2. Canal部分

  • operations文件夹里面增加监听suggest_conversion_custom表

    canal.instance.filter.regex = yhb_operations.suggest_conversion_custom...

3. 其他

producer增加监听suggest_conversion_custom表

canal.subscribeChannel.operation=yhb_operations.suggest_conversion_custom...

4. consumer重发之后执行以下脚本初始化操作

curl 'localhost:8088/search-consumer/proteced/upgrade'