Last active
August 29, 2015 14:18
-
-
Save wf9a5m75/48d8da38800bca3b3219 to your computer and use it in GitHub Desktop.
Redisで複数キーを操作する ref: http://qiita.com/wf9a5m75/items/79bb58f945520404b997
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ redis-cli | |
keys key:* | |
1) "key:01" | |
2) "key:02" | |
3) "key:03" | |
4) "key:04" | |
5) "key:05" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ redis-cli --raw -n 0 KEYS "key:*" | xargs redis-cli -n 0 DEL | |
(integer) 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
localhost >> keys export logs:2015:0404:1[7-8].* 20150404-from17to18.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
localhost >> keys import 20150404-from17to18.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$> (sudo) npm -g install redis-ex-cli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// redis-ex-cliコマンドに入る | |
$> redis-ex-cli | |
// サーバーに接続 | |
(disconnect) >> server localhost | |
// データベースのインデックスを選択(デフォルト:0) | |
localhost >> select 1 | |
// キーの一覧を確認する | |
localhost >> keys logs:2014:11* | |
logs:2014:1120:12-40-00 | |
logs:2014:1120:23-04-38 | |
logs:2014:1121:10-42-31 | |
logs:2014:1121:10-42-34 | |
logs:2014:1121:10-42-35 | |
// 11/21のデータだけまとめて削除 | |
localhost >> keys del logs:2014:1121:* | |
[del]logs:2014:1121:10-42-31 | |
[del]logs:2014:1121:10-42-34 | |
[del]logs:2014:1121:10-42-35 | |
Do you want to delete [N]/Y Y <!-- いきなり削除しない! ちゃんと確認できる |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
localhost >> keys logs:2015:0404:1[7-8].* | |
logs:2015:0404:17-40-42 | |
logs:2015:0404:17-41-55 | |
logs:2015:0404:17-56-05 | |
logs:2015:0404:18-01-36 | |
logs:2015:0404:18-06-26 | |
logs:2015:0404:18-11-17 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
redis 127.0.0.1:6379 > keys logs:2015:0404:17* | |
logs:2015:0404:17-40-42 | |
logs:2015:0404:17-41-55 | |
logs:2015:0404:17-56-05 | |
redis 127.0.0.1:6379 > keys logs:2015:0404:18* | |
logs:2015:0404:18-01-36 | |
logs:2015:0404:18-06-26 | |
logs:2015:0404:18-11-17 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
localhost >> keys copy logs:2015:04* logs:test: | |
[copy]logs:2015:0401:06-59-46 --> logs:test:01:06-59-46 | |
[copy]logs:2015:0406:07-09-22 --> logs:test:06:07-09-22 | |
[copy]logs:2015:0401:07-11-43 --> logs:test:01:07-11-43 | |
[copy]logs:2015:0401:07-12-36 --> logs:test:01:07-12-36 | |
Do you want to copy [N]/Y Y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
localhost >> keys rename logs:2014:04(.*) logs:2015:05$1:test | |
[rename]logs:2014:0401:06-59-46 --> logs:2015:0501:06-59-46:test | |
[rename]logs:2014:0401:07-11-43 --> logs:2015:0501:07-11-43:test | |
[rename]logs:2014:0401:07-12-36 --> logs:2015:0501:07-12-36:test | |
Do you want to rename [N]/Y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
localhost >>keys hset logs:2015:04* isTest true | |
[hset]logs:2015:0401:06-59-46 | |
[hset]logs:2015:0401:07-01-02 | |
[hset]logs:2015:0401:07-11-43 | |
[hset]logs:2015:0401:07-12-36 | |
Do you want to set values [N]/Y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
localhost >>keys hdel logs:* isTest | |
[hdel]logs:2015:0401:06-59-46 | |
[hdel]logs:2015:0401:07-01-02 | |
[hdel]logs:2015:0401:07-11-43 | |
[hdel]logs:2015:0401:07-12-36 | |
Do you want to delete [N]/Y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
localhost >>keys hsearch logs:2015:04* sendto ^310\-.* | |
logs:2015:0401:13-45-17 | |
logs:2015:0401:15-02-59 | |
logs:2015:0402:14-09-03 | |
logs:2015:0404:15-20-56 | |
logs:2015:0404:17-41-55 | |
logs:2015:0404:17-56-05 | |
logs:2015:0405:11-32-43 | |
logs:2015:0405:14-50-55 | |
logs:2015:0405:14-54-07 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment