Last active
August 1, 2021 10:59
-
-
Save vlaskz/16f175a72443a63a0524e3feb2a1c5f0 to your computer and use it in GitHub Desktop.
Revisions
-
vlaskz renamed this gist
Aug 1, 2021 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
vlaskz created this gist
Aug 1, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ const PORT = //put the port number. 6379 by default const HOST = //host addres const PWD = //password const DB = //db instance to connect, it varies from 0-15 var rds = require("redis"); //client retornado. conexão se for usar ssl, se não, não precisa usar tls. var cli = rds.createClient(PORT, HOST, { auth_pass: PWD, tls: { servername: HOST } }); var fs = require("fs"); let keys = null; cli.on('connect', (err, res) => { cli.select(DB, () => { if (err) throw err; console.log('INFO:: DB ', DB, ' selected.') }) cli.KEYS("*", (err, reply) => { if (err) throw err; keys = reply; keys = JSON.stringify(keys); fs.writeFile("keys.json", keys, () => { console.log("Done!") }); console.log(reply.length); cli.quit(); }); });