当前位置:网站首页>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
边栏推荐
- CRM Customer Relationship Management System
- 疫情封控65天,我的居家办公心得分享 | 社区征文
- [QT] QPushButton creation
- Happy Lantern Festival! Tengyuanhu made you a bowl of hot dumplings!
- Research Report on the overall scale, major manufacturers, major regions, products and applications of swivel chair gas springs in the global market in 2022
- Research Report on the overall scale, major manufacturers, major regions, products and applications of sliding door dampers in the global market in 2022
- Research Report on the overall scale, major manufacturers, major regions, products and application segmentation of sound quality head simulators in the global market in 2022
- Adding data to the head or tail of the rar file can still decompress normally
- Number of DP schemes
- BitSet complement
猜你喜欢
pytorch 模型保存的完整例子+pytorch 模型保存只保存可训练参数吗?是(+解决方案)
Solution to blue screen after installing TIA botu V17 in notebook
Postman interface test practice, these five questions you must know
Customized Huawei hg8546m restores Huawei's original interface
Spark source code compilation, cluster deployment and SBT development environment integration in idea
6 pyspark Library
Roommate, a king of time, I took care of the C language structure memory alignment
Write the content into the picture with type or echo and view it with WinHex
[hands on deep learning]02 softmax regression
外包干了三年,废了...
随机推荐
1007 maximum subsequence sum (25 points) "PTA class a exercise"
[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
[hands on deep learning]02 softmax regression
在券商账户上买基金安全吗?哪里可以买基金
Research and Analysis on the current situation of China's clamping device market and forecast report on its development prospect
Postman interface test practice, these five questions you must know
When Valentine's Day falls on Monday
pytorch 模型保存的完整例子+pytorch 模型保存只保存可训练参数吗?是(+解决方案)
[cloud native topic -49]:kubesphere cloud Governance - operation - step by step deployment of microservice based business applications - basic processes and steps
Adding data to the head or tail of the rar file can still decompress normally
Who do you want to open a stock account? Is it safe to open a mobile account?
In depth understanding of modern web browsers (I)
想问问,现在开户有优惠吗?在线开户是安全么?
CS5268完美代替AG9321MCQ Typec多合一扩展坞方案
Longest public prefix of leetcode
证券如何在线开户?手机开户是安全么?
Number of DP schemes
Web3js method to obtain account information and balance
数据库模式笔记 --- 如何在开发中选择合适的数据库+关系型数据库是谁发明的?