Skip to content

Commit b088613

Browse files
author
王聪
committed
增加makefile
1 parent 08f8518 commit b088613

4 files changed

Lines changed: 42 additions & 3 deletions

File tree

Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM golang:1.13.8-alpine3.11 as build-env
2+
3+
ENV GO111MODULE=on
4+
ENV GOPROXY=http://goproxy.cn
5+
ENV BUILDPATH=github.com/icowan/redis-tool
6+
RUN mkdir -p /go/src/${BUILDPATH}
7+
COPY ./ /go/src/${BUILDPATH}
8+
RUN cd /go/src/${BUILDPATH} && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go install -v
9+
10+
FROM alpine:latest
11+
12+
COPY --from=build-env /go/bin/shalog /go/bin/shalog
13+
14+
WORKDIR /go/bin/

Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
APPNAME = redis-tool
2+
BIN = $(GOPATH)/bin
3+
GOCMD = /usr/local/go/bin/go
4+
GOBUILD = $(GOCMD) build
5+
6+
all: build-linux-amd64 build-linux-arm64 build-darwin-amd64 build-windows-amd64
7+
8+
build-linux-amd64:
9+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o ./$(APPNAME)-linux-amd64 -v
10+
11+
build-linux-arm64:
12+
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $(GOBUILD) -o ./$(APPNAME)-linux-arm64 -v
13+
14+
build-darwin-amd64:
15+
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 $(GOBUILD) -o ./$(APPNAME)-darwin-amd64 -v
16+
17+
build-windows-amd64:
18+
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(GOBUILD) -o ./$(APPNAME)-windows-amd64.exe -v

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ Usage:
3131
Examples:
3232
3333
支持命令:
34-
[hash, set, sorted-set, all]
34+
[hash, set, sorted-set, list, all]
35+
3536
3637
Available Commands:
3738
all 迁移所有
3839
hash 哈希列表迁移
40+
list 列表迁移
3941
set redis set 迁移
4042
sorted-set 有序集合迁移
4143
@@ -58,13 +60,13 @@ Use "redis-tool migrate [command] --help" for more information about a command.
5860
### 编译
5961

6062
```bash
61-
make build
63+
make build-linux
6264
```
6365

6466
### 执行
6567

6668
```bash
67-
redis-tool migrate
69+
redis-tool migrate -h
6870
```
6971

7072
#### 迁移hash
@@ -80,3 +82,8 @@ redis-tool migrate hash sys:user --source-hosts=127.0.0.1:6379 --source-auth=123
8082
```bash
8183
redis-tool migrate hash sys:user --source-hosts 127.0.0.1:6379,127.0.0.1:7379 --source-redis-cluster true --source-auth 123456 --target-redis-cluster true --target-hosts 127.0.0.1:6379,127.0.0.1:7379 --target-auth 123456
8284
```
85+
#### 迁移所有
86+
87+
```bash
88+
redis-tool migrate all "*" --source-hosts=127.0.0.1:6379 --source-auth=123456 --source-database=1 --target-redis-cluster=true --target-hosts=127.0.0.1:6379,127.0.0.1:7379 --target-auth=123456
89+
```
File renamed without changes.

0 commit comments

Comments
 (0)