Skip to content

Restore and dump  #2659

Open
Open
@ferran-gutierrez

Description

@ferran-gutierrez

Description

Hello!

I'm trying to persist hyperloglog in my datbase. I was been doing some test fisrt with Redis cli in local.

Operation: DUMP key-hyperloglog
Value: "\x00\x15HYLL\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00Wn\x80h\x8f\x0b\x00\x13\xd9"\x80s%\xd0\x12"

And then:
RESTORE key-hyperloglog 0 "\x00\x15HYLL\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00Wn\x80h\x8f\x0b\x00\x13\xd9"\x80s%\xd0\x12"

This operations are working fine in redis cli in local.

After test this I was trying to replicate in my code. I've tested a different ways and not works any of them:

Redis version:
Platform: Linux
IDE: Intellij IDEA

Try 1:

await this.redisClient.sendCommand([
      'RESTORE',
      'key-hyperloglog',
      '0',
      '\x00\x15HYLL\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00Wn\x80h\x8f\x0b\x00\x13\xd9"\x80s%\xd0\x12'
    ]);

These command throw an error: "ERR DUMP payload version or checksum are wrong"

Try 2:

await this.redisClient.restore(
       'key-hyperloglog',
      '\x00\x15HYLL\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00Wn\x80h\x8f\x0b\x00\x13\xd9"\x80s%\xd0\x12'
    );

This command throw an error: "redisClient.restore is not a function"

How I'm building the redis cliente?

const client = redis.createClient({
  url: redisUrl,
  password: this.redisPassword,
  disableOfflineQueue: true,
  pingInterval: 1000
});

client.on('error', (err) => console.error('Redis Client Error', err));

await client.connect();
await client.ping();

this.redisClient = client;

I was trying this code here
But its throws me an error the restore as you can see.

Can anyone helps me?

Thank you

Node.js Version

16.20.0

Redis Server Version

7.2.1

Node Redis Version

4.6.8

Platform

Linux

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions