Skip to content

Commit 847c80e

Browse files
author
chenby
committed
v0.4.0
1 parent 8a4e81d commit 847c80e

File tree

12 files changed

+607
-480
lines changed

12 files changed

+607
-480
lines changed

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
### 0.4.0
2+
3+
Jsonl support. [issue#13](https://github.com/leonchen83/redis-rdb-cli/issues/13).
4+
15
### 0.3.2
26

3-
Fix invalid json issue[#12](https://github.com/leonchen83/redis-rdb-cli/issues/12).
7+
Fix invalid json [issue#12](https://github.com/leonchen83/redis-rdb-cli/issues/12).
48

59
### 0.3.1
610

7-
Fix invalid json issue[#11](https://github.com/leonchen83/redis-rdb-cli/issues/11).
11+
Fix invalid json [issue#11](https://github.com/leonchen83/redis-rdb-cli/issues/11).
812

913
### 0.3.0
1014

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ options:
8080
-e,--escape <escape> escape strings to encoding: raw (default),
8181
redis.
8282
-f,--format <format> format to export. valid formats are json,
83-
dump, diff, key, keyval, count, mem and resp
83+
jsonl, dump, diff, key, keyval, count, mem
84+
and resp
8485
-h,--help rct usage.
8586
-k,--key <regex regex...> keys to export. this can be a regex. if not
8687
specified, all keys will be returned.
@@ -391,11 +392,11 @@ docker-compose down
391392
```
392393

393394
`cd /path/to/redis-rdb-cli/conf/redis-rdb-cli.conf`
394-
Then change parameter [metric_gateway](https://github.com/leonchen83/redis-rdb-cli/blob/master/src/main/resources/redis-rdb-cli.conf#L154) from `none` to `influxdb`.
395+
Then change parameter [metric_gateway](https://github.com/leonchen83/redis-rdb-cli/blob/master/src/main/resources/redis-rdb-cli.conf#L161) from `none` to `influxdb`.
395396

396397
Open `http://localhost:3000` to check the `rct -f mem`'s result.
397398

398-
If you deployed this tool in multi instance, you need to change parameter [metric_instance](https://github.com/leonchen83/redis-rdb-cli/blob/master/src/main/resources/redis-rdb-cli.conf#L200) to make sure unique between instances.
399+
If you deployed this tool in multi instance, you need to change parameter [metric_instance](https://github.com/leonchen83/redis-rdb-cli/blob/master/src/main/resources/redis-rdb-cli.conf#L207) to make sure unique between instances.
399400

400401
## Redis 6
401402

@@ -413,8 +414,8 @@ $openssl pkcs12 -export -CAfile ca.crt -in redis.crt -inkey redis.key -out redis
413414
```
414415

415416
2. If source redis and target redis use the same keystore. then config following parameters
416-
[source_keystore_path](https://github.com/leonchen83/redis-rdb-cli/blob/master/src/main/resources/redis-rdb-cli.conf#L216) and [target_keystore_path](https://github.com/leonchen83/redis-rdb-cli/blob/master/src/main/resources/redis-rdb-cli.conf#L245) to point to `/path/to/redis-6.0-rc1/tests/tls/redis.p12`
417-
set [source_keystore_pass](https://github.com/leonchen83/redis-rdb-cli/blob/master/src/main/resources/redis-rdb-cli.conf#L224) and [target_keystore_pass](https://github.com/leonchen83/redis-rdb-cli/blob/master/src/main/resources/redis-rdb-cli.conf#L253)
417+
[source_keystore_path](https://github.com/leonchen83/redis-rdb-cli/blob/master/src/main/resources/redis-rdb-cli.conf#L223) and [target_keystore_path](https://github.com/leonchen83/redis-rdb-cli/blob/master/src/main/resources/redis-rdb-cli.conf#L252) to point to `/path/to/redis-6.0-rc1/tests/tls/redis.p12`
418+
set [source_keystore_pass](https://github.com/leonchen83/redis-rdb-cli/blob/master/src/main/resources/redis-rdb-cli.conf#L231) and [target_keystore_pass](https://github.com/leonchen83/redis-rdb-cli/blob/master/src/main/resources/redis-rdb-cli.conf#L260)
418419

419420
3. after config ssl parameters use `rediss://host:port` in your command to open ssl, for example: `rst -s rediss://127.0.0.1:6379 -m rediss://127.0.0.1:30001 -r -d 0`
420421

README.zh_CN.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ options:
8080
-e,--escape <escape> escape strings to encoding: raw (default),
8181
redis.
8282
-f,--format <format> format to export. valid formats are json,
83-
dump, diff, key, keyval, count, mem and resp
83+
jsonl, dump, diff, key, keyval, count, mem
84+
and resp
8485
-h,--help rct usage.
8586
-k,--key <regex regex...> keys to export. this can be a regex. if not
8687
specified, all keys will be returned.
@@ -391,11 +392,11 @@ docker-compose down
391392
```
392393

393394
`cd /path/to/redis-rdb-cli/conf/redis-rdb-cli.conf`
394-
[metric_gateway](https://github.com/leonchen83/redis-rdb-cli/blob/master/src/main/resources/redis-rdb-cli.conf#L154) 这个参数从 `none` 改成 `influxdb`
395+
[metric_gateway](https://github.com/leonchen83/redis-rdb-cli/blob/master/src/main/resources/redis-rdb-cli.conf#L161) 这个参数从 `none` 改成 `influxdb`
395396

396397
浏览器打开 `http://localhost:3000` 来查看 `rct -f mem` 命令的结果.
397398

398-
如果你把这个工具部署在多个实例上, 需要更改如下参数 [metric_instance](https://github.com/leonchen83/redis-rdb-cli/blob/master/src/main/resources/redis-rdb-cli.conf#L200) 并保证在每个实例上参数名唯一
399+
如果你把这个工具部署在多个实例上, 需要更改如下参数 [metric_instance](https://github.com/leonchen83/redis-rdb-cli/blob/master/src/main/resources/redis-rdb-cli.conf#L207) 并保证在每个实例上参数名唯一
399400

400401
## Redis 6
401402

@@ -413,8 +414,8 @@ $openssl pkcs12 -export -CAfile ca.crt -in redis.crt -inkey redis.key -out redis
413414
```
414415

415416
2. 如果源 redis 和目标 redis 使用同样的 keystore. 那么配置如下参数
416-
[source_keystore_path](https://github.com/leonchen83/redis-rdb-cli/blob/master/src/main/resources/redis-rdb-cli.conf#L216)[target_keystore_path](https://github.com/leonchen83/redis-rdb-cli/blob/master/src/main/resources/redis-rdb-cli.conf#L245) 指向 `/path/to/redis-6.0-rc1/tests/tls/redis.p12`
417-
设置 [source_keystore_pass](https://github.com/leonchen83/redis-rdb-cli/blob/master/src/main/resources/redis-rdb-cli.conf#L224)[target_keystore_pass](https://github.com/leonchen83/redis-rdb-cli/blob/master/src/main/resources/redis-rdb-cli.conf#L253)
417+
[source_keystore_path](https://github.com/leonchen83/redis-rdb-cli/blob/master/src/main/resources/redis-rdb-cli.conf#L223)[target_keystore_path](https://github.com/leonchen83/redis-rdb-cli/blob/master/src/main/resources/redis-rdb-cli.conf#L252) 指向 `/path/to/redis-6.0-rc1/tests/tls/redis.p12`
418+
设置 [source_keystore_pass](https://github.com/leonchen83/redis-rdb-cli/blob/master/src/main/resources/redis-rdb-cli.conf#L231)[target_keystore_pass](https://github.com/leonchen83/redis-rdb-cli/blob/master/src/main/resources/redis-rdb-cli.conf#L260)
418419

419420
3. 在配置完 ssl 参数之后, 在你的命令中使用 `rediss://host:port` 这样的URI来开启ssl, 比如: `rst -s rediss://127.0.0.1:6379 -m rediss://127.0.0.1:30001 -r -d 0`
420421

src/main/java/com/moilioncircle/redis/rdb/cli/cmd/RctCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class RctCommand extends AbstractCommand {
4242

4343
private static final Option HELP = Option.builder("h").longOpt("help").required(false).hasArg(false).desc("rct usage.").build();
4444
private static final Option VERSION = Option.builder("v").longOpt("version").required(false).hasArg(false).desc("rct version.").build();
45-
private static final Option FORMAT = Option.builder("f").longOpt("format").required(false).hasArg().argName("format").type(String.class).desc("format to export. valid formats are json, dump, diff, key, keyval, count, mem and resp").build();
45+
private static final Option FORMAT = Option.builder("f").longOpt("format").required(false).hasArg().argName("format").type(String.class).desc("format to export. valid formats are json, jsonl, dump, diff, key, keyval, count, mem and resp").build();
4646
private static final Option SOURCE = Option.builder("s").longOpt("source").required(false).hasArg().argName("source").type(String.class).desc("<source> eg:\n /path/to/dump.rdb redis://host:port?authPassword=foobar redis:///path/to/dump.rdb.").build();
4747
private static final Option OUTPUT = Option.builder("o").longOpt("out").required(false).hasArg().argName("file").type(File.class).desc("output file.").build();
4848
private static final Option DB = Option.builder("d").longOpt("db").required(false).hasArg().argName("num num...").valueSeparator(' ').type(Number.class).desc("database number. multiple databases can be provided. if not specified, all databases will be included.").build();

src/main/java/com/moilioncircle/redis/rdb/cli/conf/Configure.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ private Configure(Properties properties) {
8181
*/
8282
private byte delimiter = ',';
8383

84+
/**
85+
* rct export meta
86+
*/
87+
private boolean exportMeta = true;
88+
8489
/**
8590
* rmt --migrate
8691
*/
@@ -249,7 +254,15 @@ public byte getDelimiter() {
249254
public void setDelimiter(byte delimiter) {
250255
this.delimiter = delimiter;
251256
}
252-
257+
258+
public boolean isExportMeta() {
259+
return exportMeta;
260+
}
261+
262+
public void setExportMeta(boolean exportMeta) {
263+
this.exportMeta = exportMeta;
264+
}
265+
253266
public int getTimeout() {
254267
return timeout;
255268
}
@@ -548,6 +561,7 @@ public static Configure bind(Properties properties) {
548561
conf.dumpRdbVersion = getInt(conf, "dump_rdb_version", -1, true);
549562
conf.quote = (byte) getString(conf, "quote", "\"", true).charAt(0);
550563
conf.delimiter = (byte) getString(conf, "delimiter", ",", true).charAt(0);
564+
conf.exportMeta = getBool(conf, "export_meta", true, true);
551565
conf.retries = getInt(conf, "retries", 5, true);
552566
conf.retryInterval = getInt(conf, "retry_interval", 1000, true);
553567
conf.timeout = getInt(conf, "timeout", 30000, true);
@@ -753,6 +767,7 @@ public String toString() {
753767
"batchSize=" + batchSize +
754768
", quote=" + quote +
755769
", delimiter=" + delimiter +
770+
", exportMeta=" + exportMeta +
756771
", migrateBatchSize=" + migrateBatchSize +
757772
", migrateThreads=" + migrateThreads +
758773
", migrateRetries=" + migrateRetries +

0 commit comments

Comments
 (0)