当前位置:网站首页>Data_web(八)mysql增量同步到mongodb
Data_web(八)mysql增量同步到mongodb
2022-08-03 21:36:00 【ReadMeFrist】
1.mongdb连接
连接方式如下(重要!!!!,账号密码必须建立在db下面,如果默认再admin下面,导致无法切换库,连接报错)
2.mysql增量同步到mongodb的json如下,(可以参考先前文章mysql增量时间同步方式)
{
"job": {
"setting": {
"speed": {
"channel": 3,
"byte": 1048576
},
"errorLimit": {
"record": 0,
"percentage": 0.02
}
},
"content": [
{
"reader": {
"name": "mysqlreader",
"parameter": {
"username": "123",
"password": "123",
"connection": [
{
"jdbcUrl": [
"jdbc:mysql://192.168.1.101:3306/test"
],
"querySql": [
"SELECT 'test'as source,(CASE when gateway_id=9 then 'test' ELSE 'tnc' end) as app_code,target ,target_account_id as account_id, null as user_name, sms_content as content, send_time ,send_id as outer_id FROM qfc_mcs_send_mass_info where sms_type = '3' and status in (3,4) and send_time >= FROM_UNIXTIME(${lastTime}) and send_time < FROM_UNIXTIME(${currentTime});"
]
}
]
}
},
"writer": {
"name": "mongodbwriter",
"parameter": {
"address": [
"192.168.1.100:27017"
],
"userName": "username",
"userPassword": "password",
"dbName": "DBname",
"collectionName": "message_send_info",
"column": [
{
"name": "sourceSystem",
"type": "String"
},
{
"name": "app_code",
"type": "String"
},
{
"name": "target",
"type": "String"
},
{
"name": "account_id",
"type": "Long"
},
{
"name": "user_name",
"type": "String"
},
{
"name": "content",
"type": "String"
},
{
"name": "send_time",
"type": "Date"
},
{
"name": "outer_id",
"type": "Long"
}
],
"upsertInfo": {
"isUpsert": false,
"upsertKey": ""
}
}
}
}
]
}
}
如果需要更新isUpsert改写true upsertKey为更新的字段
3.字段参考
| DataX 内部类型 | MongoDB 数据类型 |
|---|---|
| Long | int, Long |
| Doubl | double |
| String | string, array |
| Date | date |
| Bytes | bytes |
边栏推荐
- 距LiveVideoStackCon 2022 上海站开幕还有3天!
- tidyverse based on data.table?
- CAS:1260586-88-6_Biotin-C5-Azide_Biotin-C5-Azide
- 385. Mini Parser
- 2022年全国职业院校技能大赛网络安全 B模块 任务十windows操作系统渗透测试 国赛原题
- Android build error: Plugin with id 'kotlin-android' not found.
- 七夕快乐!
- Use setTimeout to realize setInterval
- XSS测试
- CAS:1192802-98-4_UV 裂解的生物素-PEG2-叠氮
猜你喜欢

基于DMS的数仓智能运维服务,知多少?

XSS online shooting range---prompt

CAS:1260586-88-6_Biotin-C5-Azide_Biotin-C5-Azide

【Odoo】硬核组件开发,全文没一句废话~

深度学习怎么入门?零基础快速入门深度学习

2022年全国职业院校技能大赛网络安全 B模块 B-1任务一:主机发现与信息收集 国赛原题

E-commerce data warehouse ODS layer-----log data loading

CAS:908007-17-0_Biotin-azide_Biotin azide

距LiveVideoStackCon 2022 上海站开幕还有3天!

HCIP第十五天
随机推荐
ValidationError: Progress Plugin Invalid Options
FVCOM 3D Numerical Simulation of Hydrodynamics, Water Exchange, Dispersion and Transport of Oil Spills丨FVCOM Model Watershed, Numerical Simulation Method of Marine Water Environment
Markdown syntax
382. Linked List Random Node
卷起来!阿里高工携 18 位高级架构师耗时 57 天整合的 1658 页面试总结
C. Keshi Is Throwing a Party- Codeforces Global Round 17
《富爸爸,穷爸爸》思维导图和学习笔记
码率vs.分辨率,哪一个更重要?
What is the role and difference between buildscript and allprojects?
小朋友学C语言(1):Hello World
XSS online shooting range---haozi
CAS: 773888-45-2_BIOTIN ALKYNE_生物素-炔基
STP生成树
buildscript和allprojects的作用和区别是什么?
LitJson报错记录
IDaaS 是什么?一文说清它的价值
CAS:1260586-88-6_Biotin-C5-Azide_Biotin-C5-Azide
[kali-vulnerability exploitation] (3.2) Metasploit basics (on): basic knowledge
CAS:1192802-98-4_UV 裂解的生物素-PEG2-叠氮
超级实用网站+公众号合集