
Github: https://github.com/cc-morning/river
不吝给个 star !
整个迁移流程就像一条河流
// 直接迁移 From Stream -> To Stream | | e.g: Oracle e.g: PostgreSQL Lua 脚本 // Lua 脚本迁移 / From Stream -> Filter Stream -> To Stream | | e.g: Oracle | JSON | CSV e.g: MySQL | ES | PostgreSQL From:CSV ,JSON ,MySQL ,Oracle ,PostgreSQL
To:Elasticsearch ,MySQL ,Oracle ,PostgreSQL
config.toml
[task1] thread = 2 # 任务协程运行时的调度线程数 filter = "type_conver.lua" # Lua 脚本 [task1.from.csv] path = [ "/xxx/xxx/test1.csv", "/xxx/xxx/test2.csv" ] delimiter = "," # 分隔符 flexible = true # 忽略错位 quoting = true # 支持引号 double_quote = true # 引号转义 [task1.to.postgresql] url = "postgresql://test:[email protected]/test" table = "test" fixnul = true # 修复 0x00 [task2.from.json] path = [ "/xxx/xxx/test1.json", "/xxx/xxx/test2.json" ] columns = "id,name,sex,age" parallel = 10240 # 格式化,提取指定 key 行为并行度 [task2.to.mysql] url = "mysql://test:[email protected]/test" table = "test" 多个任务会多线程同时执行。
运行命令
# // 不打印日志执行 # river config.toml # # // 打印日志执行(日志级别:error ,warn ,info ,debug ,trace ) # LOG=info river config.toml 1 zoain OP 得益于 lua 的灵活以及 jit 提供不俗的性能,甚至可以拿来做一些简单的清洗工作 |
2 pkwenda 2022-03-03 15:12:52 +08:00 lua 库必须 star |