当前位置:网站首页>Import a large amount of data to redis in shell mode
Import a large amount of data to redis in shell mode
2022-07-02 20:57:00 【Why is it the same name】
Sometimes you need to import a large amount of data to redis in , How to operate quickly
Use redis-cli client
http://www.redis.cn/topics/batch-insert.html
server$ vim d1.txt
set myk12 v1
zadd zset12 0 a 1 b 3 c
sadd sset12 e f g hh
set myk22 v2
hset myset12 k1 v1
hmset myset22 k2 v2 k3 v3 k4 v4
set myk32 v3
server> unix2dos d1.txt
unix2dos: converting file d1.txt to DOS format...
server> cat d1.txt | redis-cli
OK
(integer) 3
(integer) 4
OK
(integer) 1
OK
OK
server> cat d1.txt | redis-cli --pipe
All data transferred. Waiting for the last reply...
Last reply received from server.
errors: 0, replies: 7
server> cat d1.txt | redis-cli -p 6380 -h 192.168.1.166 --pipe
All data transferred. Waiting for the last reply...
Last reply received from server.
errors: 0, replies: 7
programme 2
[[email protected] bin]# cat redis_commands.txt
12345678
76547654
32456475
87676543
[[email protected] bin]# cat open_status.sh
#!/bin/bash
while read X; do
# each command begins with *{number arguments in command}\r\n
printf "*4\r\n"
printf "\$4\r\n"
printf "hset\r\n"
printf "\$20\r\n"
echo -n "${X}.tos"
printf "\r\n"
printf "\$3\r\n"
printf "tom\r\n"
printf "\$4\r\n"
printf "\\x00\\00\\00\\01\r\n"
done < redis_commands.txt
[[email protected] bin]# sh switch_open_status.sh > dd.txt
[[email protected] bin]# cat dd.txt |redis-cli -p 6380 --pipe
All data transferred. Waiting for the last reply...
Last reply received from server.
errors: 0, replies: 9
边栏推荐
- Driverless learning (III): Kalman filter
- This team with billions of data access and open source dreams is waiting for you to join
- Codeforces round 651 (Div. 2) (a thinking, B thinking, C game, D dichotomy, e thinking)
- BitSet complement
- 笔记本安装TIA博途V17后出现蓝屏的解决办法
- Detailed upgrade process of AWS eks
- Customized Huawei hg8546m restores Huawei's original interface
- Structured text language XML
- 【QT】QPushButton创建
- 功能、作用、效能、功用、效用、功效
猜你喜欢

【871. 最低加油次数】

Jetson XAVIER NX上ResUnet-TensorRT8.2速度与显存记录表(后续不断补充)

Solution to blue screen after installing TIA botu V17 in notebook

5 environment construction spark on yarn

I did a craniotomy experiment: talk about macromolecule coding theory and Lao Wang's fallacy from corpus callosum and frontal leukotomy

The metamask method is used to obtain account information

Interested parties add me for private chat
![[shutter] the shutter plug-in is used in the shutter project (shutter plug-in management platform | search shutter plug-in | install shutter plug-in | use shutter plug-in)](/img/80/215499c66243d5a4453d8e6206c012.jpg)
[shutter] the shutter plug-in is used in the shutter project (shutter plug-in management platform | search shutter plug-in | install shutter plug-in | use shutter plug-in)

AMD's largest transaction ever, the successful acquisition of Xilinx with us $35billion

Talk about macromolecule coding theory and Lao Wang's fallacy from the perspective of evolution theory
随机推荐
Attack and defense world PWN question: Echo
Spark source code compilation, cluster deployment and SBT development environment integration in idea
Lantern Festival, come and guess lantern riddles to win the "year of the tiger Doll"!
Happy Lantern Festival! Tengyuanhu made you a bowl of hot dumplings!
想请教一下,究竟有哪些劵商推荐?手机开户是安全么?
在网上炒股开户安全吗?我是新手,还请指导
How to realize the function of detecting browser type in Web System
什么叫在线开户?现在网上开户安全么?
I did a craniotomy experiment: talk about macromolecule coding theory and Lao Wang's fallacy from corpus callosum and frontal leukotomy
[shutter] the shutter plug-in is used in the shutter project (shutter plug-in management platform | search shutter plug-in | install shutter plug-in | use shutter plug-in)
In the era of consumer Internet, a few head platforms have been born
SBT tutorial
【QT】QPushButton创建
证券如何在线开户?手机开户是安全么?
This team with billions of data access and open source dreams is waiting for you to join
在券商账户上买基金安全吗?哪里可以买基金
Longest public prefix of leetcode
Is it safe to buy funds on securities accounts? Where can I buy funds
功能、作用、效能、功用、效用、功效
Select function