'Can't set large json to Redis (Ubuntu Server)

I have tried to store my json data in to redis database but it return

 events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: write ECONNRESET
    at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:94:16)
Emitted 'error' event on RedisClient instance at:
    at RedisClient.on_error (\redis\index.js:342:14)
    at Socket.<anonymous> (\redis\index.js:223:14)
    at Socket.emit (events.js:315:20)
    at emitErrorNT (internal/streams/destroy.js:106:8)
    at emitErrorCloseNT (internal/streams/destroy.js:74:3)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  errno: -4077,
  code: 'ECONNRESET',
  syscall: 'write'
}

But when I try to set the array of json with 3 objects. It worked

The large data is from https://jsonplaceholder.typicode.com/comments

This is the whole code

    const redis = require("redis");

//NOTE: REDIS UBUNTU
    const redisClient = redis.createClient({
    url: "redis://ip:6379",
  
  }); 

//NOTE: REDIS DOCKER
//const redisClient = redis.createClient();

(async () => {
  //NOTE: BIG DATA
  let mockup = [] // data from https://jsonplaceholder.typicode.com/comments

  //NOTE: SET DATA
  redisClient.set("bigdata", JSON.stringify(mockup), (err, reply) => {
    console.log(reply);
  });

  //NOTE: GET DATA
  redisClient.get("bigdata", async (err, res) => {
    if (err) {
      console.log(err);
    } else {
      console.log(res);
    }
  });
})();

I am not sure if I config something wrong in redis.conf file.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source