The easiest way is to get a mysql table dump and parse the corresponding data records into redis commands.
For example, a data dump will create something like the following:
CREATE TABLE carousel( id int(11), path varchar(200), title varchar(200), comments varchar(200) ); INSERT INTO carousel VALUES (3,'7.jpg','Inspirar','inspiration'); INSERT INTO carousel VALUES (4,'d.jpg','Pilotar','pilotar'); INSERT INTO carousel VALUES (5,'8.jpg','Sentir','sentir'); INSERT INTO carousel VALUES (6,'6.jpg','Volar','volar');
First you need to decide on the key structure that you want to use in redis. One idea is to use the table as a key and store the identifiers of each row in the set.
For each table you need to create a key that will contain identifiers, allows you to call them idx: $ table. Using our example, we will create idx: carousel.
When analyzing the file, we pull out the identifiers from the first column of values (in this case) and save them in idx: carousel. We will also store each INSERT as a hash. To do this, we will call the key carousel: $ id and use the hmset command. The first INSERT in the example will be stored as follows:
hmset carousel: 3 way '7.jpg' name 'inspiration' comments 'inspiration'
It probably sounds more complicated than it really is, but it's pretty simple. If you think this is too complicated, I am ready to write for you.
Hope this helps.
Lloyd moore
source share