当前位置:网站首页>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
边栏推荐
- Research Report on the overall scale, major manufacturers, major regions, products and applications of hollow porcelain insulators in the global market in 2022
- 1007 maximum subsequence sum (25 points) "PTA class a exercise"
- 想请教一下,究竟有哪些劵商推荐?手机开户是安全么?
- Research Report on the overall scale, major manufacturers, major regions, products and application segmentation of power management units in the global market in 2022
- Common routines of compressed packets in CTF
- Detailed upgrade process of AWS eks
- In depth understanding of modern web browsers (I)
- Complete example of pytorch model saving +does pytorch model saving only save trainable parameters? Yes (+ solution)
- JDBC | Chapter 4: transaction commit and rollback
- I would like to ask what securities dealers recommend? Is it safe to open a mobile account?
猜你喜欢

5 environment construction spark on yarn

26 FPS video super-resolution model DAP! Output 720p Video Online

API documentation tool knife4j usage details

Sometimes only one line of statements are queried, and the execution is slow

八年测开经验,面试28K公司后,吐血整理出高频面试题和答案

Driverless learning (4): Bayesian filtering

How to realize the function of detecting browser type in Web System

接口测试到底怎么做?看完这篇文章就能清晰明了

【871. 最低加油次数】

Roommate, a king of time, I took care of the C language structure memory alignment
随机推荐
Solution to blue screen after installing TIA botu V17 in notebook
Implementing yolox from scratch: dataset class
[source code analysis] model parallel distributed training Megatron (5) -- pipestream flush
Roommate, a king of time, I took care of the C language structure memory alignment
Driverless learning (4): Bayesian filtering
[hands on deep learning]02 softmax regression
Why do I have a passion for process?
This team with billions of data access and open source dreams is waiting for you to join
Exemple complet d'enregistrement du modèle pytoch + enregistrement du modèle pytoch seuls les paramètres d'entraînement sont - ils enregistrés? Oui (+ Solution)
Postman interface test practice, these five questions you must know
How my mother-in-law and daughter-in-law get along
【Kubernetes系列】kubeadm reset初始化前后空间、内存使用情况对比
功能、作用、效能、功用、效用、功效
[kubernetes series] comparison of space and memory usage before and after kubedm reset initialization
Research Report on the overall scale, major manufacturers, major regions, products and applications of battery control units in the global market in 2022
Want to ask, is there any discount for opening an account now? Is it safe to open an account online?
How can testers do without missing tests? Seven o'clock is enough
How to do interface testing? After reading this article, it will be clear
[question brushing diary] classic questions of dynamic planning
Burp install license key not recognized