mapreduce

package module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

README

mrkit-go

github build status Go Reference

mrkit-go is a MapReduce toolkit in Go with a config-driven batch runner.

Primary path for new users:

  • define source / transform / sink in JSON
  • run ./cmd/batch with that config
  • support MySQL/Redis source and sink combinations

Quickstart (Config-Driven)

1) Prepare demo MySQL source data
MYSQL_HOST=localhost MYSQL_PORT=3306 MYSQL_USER=root MYSQL_PASSWORD=123456 \
MYSQL_DB=mysql SOURCE_TABLE=source_events TARGET_TABLE=agg_results \
ROWS=5000 KEY_MOD=100 \
go run ./cmd/batch -mode prepare
2) Validate config schema
go run ./cmd/batch -check -config example/batch-minimal/mysqlbatch/flow.mysql.count.json

Expected output:

config check pass
3) Run a flow
go run ./cmd/batch -config example/batch-minimal/mysqlbatch/flow.mysql.count.json

Cross-DB examples:

# mysql -> redis
go run ./cmd/batch -config example/batch-minimal/mysqlbatch/flow.mysql_to_redis.count.json

# prepare redis source keys for redis->* examples (db0/event:*)
sed "s/\"db\": 1/\"db\": 0/; s/\"key_prefix\": \"mr:count:\"/\"key_prefix\": \"event:\"/; s/\"value_field\": \"metric_sum\"/\"value_field\": \"metric\"/" \
  example/batch-minimal/mysqlbatch/flow.mysql_to_redis.count.json > /tmp/flow.mysql_to_redis.seed_event.json
go run ./cmd/batch -config /tmp/flow.mysql_to_redis.seed_event.json

# redis -> mysql
go run ./cmd/batch -config example/batch-minimal/redisbatch/flow.redis_to_mysql.count.json

# redis -> redis
go run ./cmd/batch -config example/batch-minimal/redisbatch/flow.redis_to_redis.count.json

Expected log includes:

flow done
  • source: mysql or redis extraction
  • transform: builtin (count / minmax / topN) or mapreduce plugin
  • sink: mysql or redis write-back

For built-in transforms, no prebuilt .so is required.

Documentation Map

Contributions

Pull requests are always welcome.

Created and improved by Yi-fei Gao. All code is licensed under the Apache License 2.0.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MasterIP string = ":10000"

Functions

func ParseArg

func ParseArg() ([]string, string, int, int, bool)

func StartMaster

func StartMaster(input []string, plugin string, nReducer int, nWorker int, inRAM bool)

func StartSingleMachineJob

func StartSingleMachineJob(input []string, plugin string, nReducer int, nWorker int, inRAM bool)

func StartWorker

func StartWorker(input []string, plugin string, nReducer int, nWorker int, storeInRAM bool)

Types

This section is empty.

Directories

Path Synopsis
cmd
batch command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL