P粉1781328282023-08-26 10:52:12
Redis is a schema-less key-value NOSQL database. There aren't any built-in solutions for moving data from Redis to a SQL database or CSV file. But you can write some code yourself to do this:
P粉8173547832023-08-26 10:04:03
Get answers with Node js and Redis.
For the import, I used the following command after shutting down the redis server
sudo cp /var/dump.rdb /home/etc/redis/dump.rdb
Use Nodejs to parse Redis data and connect to mysql at the same time.
var mysql = require('mysql'); var connection = mysql.createConnection({ host : 'localhost', port : '3306', database : 'db', user : 'root', password : 'password', insecureAuth : true, multipleStatements: true }); var post = {name: practice.name, practiceId: practice.id,type: practice.wid}; var query = connection.query('INSERT INTO facilities SET ?', post, function(err, result) { }); console.log(query.sql +';');