jwenjian / ghiblog

GitHub Issues Blog, powered by GitHub Issues and GitHub Actions
https://1link.fun
350 stars 47 forks source link

Redis Mass Insertion Redis #233

Open jwenjian opened 4 years ago

jwenjian commented 4 years ago

Card Redis Mass Insertion – Redis added the to the 架构/中间件/数据库/MySQL list in the 遇见 board at May 13, 2020 at 11:21AM
 
> the preferred way to mass import data into Redis is to generate a text file containing the Redis protocol, in raw format, in order to call the commands needed to insert the required data. For instance if I need to generate a large data set where there are billions of keys in the form: `keyN -> ValueN' I will create a file containing the following commands in the Redis protocol format: SET Key0 Value0 SET Key1 Value1 ... SET KeyN ValueN Once this file is created, the remaining action is to feed it to Redis as fast as possible. In the past the way to do this was to use the netcat with the following command: (cat data.txt; sleep 10) | nc localhost 6379 > /dev/null
 
---
 
View on Trello