Search code examples
rediscommand-line-interfaceredis-cli

Stroing large entry in redis using cli?


I am trying to store data of 5000 characters in redis via cli.

My command is SET MY_KEY "copy pasted the value"

But the whole value is not getting pasted in CLI. Is there any alternative to it.

I have redis version 3.0.54


Solution

  • But the whole value is not getting pasted in CLI. Is there any alternative to it.

    Yes, here is one which works with most modern shells: create a text file with your command(s) and use input redirection.

    For example, create a file named commands.txt with your Redis commands:

    SET MY_KEY "copy pasted the value"
    

    And pass it to the CLI through input redirection (Bash here, but the syntax is similar if not equal in most modern shells):

    redis-cli < commands.txt