Code Monkey home page Code Monkey logo

mongodb-migrate's Introduction

Mongodb-Migrate 并发迁移脚本

Go语言开发的并发mongodb迁移脚本,提供基本功能,代码150行,无学习成本,可迅速根据需求修改拿走.

用法:

go run main.go

截图:

===================================================================================================================
| Mongodb Migrate Tool
===================================================================================================================
| URL格式: mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
| URL例子[
|     mongodb://127.0.0.1:27017/test
|     mongodb://root:[email protected]:27017/entryDB
| ]
| 每次拉去数据条数: 5000
| 每个拉取任务一次拉去的数据: 500
| worker数量: 50
===================================================================================================================
(1/4) 请输入数据源URL:
mongodb://192.168.0.204:27017/userStorage
(2/4) 请输入collection:
user
(3/4) 请输入目标源URL:
mongodb://127.0.0.1:27017/test
(4/4) 请输入collection:
userCopy
-------------------------------------------------------------------------------------------------------------------
0 / 312744 (0%)
4000 / 312744 (1%)

修改并发数量:

const FetchSourceLimit        = 5000      //每次拉去数据条数
const SplitFetchSourceLimit   = 500       //每个拉取任务一次拉去的数据
const WorkerCount             = 50        //worker数量

mongodb-migrate's People

Contributors

40t avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.