PostgreSQL同步数据库数据
通过PostgreSQL的发布-订阅功能,可以将各个服务中心的,以渠道中心为例,发布-订阅步骤如下:
- 删除服务中心原有的发布
Drop publication channelcenter_pub;
- 查询渠道中心所有表名
select tablename from pg_tables where schemaname = 'public';
- 新建发布
CREATE publication channelcenter_pub FOR table
cc_address,
cc_address_relation,
cc_base_rule,
cc_channel,
cc_channel_product_group,
cc_channel_sku,
cc_customer,
cc_customer_logistics_template,
cc_customer_manage_area,
cc_customer_product_group,
cc_customer_quota_record,
cc_customer_sku,
cc_endpoint,
cc_freight_relation,
cc_freight_rule,
cc_freight_template,
cc_logistics_company,
cc_logistics_template,
cc_manage_area,
cc_node_group_sku,
cc_online_store,
cc_pay_info,
cc_price_strategy,
cc_qualification_info,
cc_real_store,
cc_service_fee,
cc_settlement_rule;