![]() _copyleft_ = "Copyleft (c) 2013 Salimane Adjao Moustapha" ![]() _author_ = "Salimane Adjao Moustapha ( )" It accepts as input a pipe with redis commands formatted as "SET key value" or "DEL key".Įcho "SET,mykey1,value1\nSET,mykey2,value2" > data.txtĬat data.txt | python gen_redis_proto.py | redis-cli -pipe Generate the Redis protocol, in raw format, in order to use 'redis-cli -pipe' command to massively insert/delete. Raw GitHub link #!/usr/bin/env python -tt We will be using the redis mass insert method for that.Ĭopy and save the following script to gen_redis_proto.py. Here we will be generating the redis protocol to convert the redis commands for importing to redis. Step – 3 | Convert the Redis command generated to Redis protocol. However, you need to convert the Redis commands to Redis protocol to do that. Note: We will be using the Redis mass insert. ![]() (Counting start from 1 and not 0) awk -F, 'BEGIN ' input.csv | sed 's/\"//g' > output.txt This will print “SET, key1, key2” from the “input.csv” file and remove the double quotes. Let’s call this as input.csv 1, key1, value1, created_at, updated_atĬonvert the CSV to Redis commands. Step -2 | Convert the raw CSV data to Redis Commands (Generate the Redis commands from CSV) ![]() We used “sequel pro” to dump the data to CSV format. Here the data is exported to CSV format from the SQL data store using the favourite tools. Let’s see how can we convert that to CSV and then to redis. Since we already had a huge chunk of data in SQL database. When dealing with a huge amount of static data’s which are requested continuously, we need to have a fast key-value cache in place. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |