Ir al contenido
  • +31 653-919-302
Cafayate.Net
  • 0
  • 0
  • Inicia sesión
  • Nederlands English (US) Español (AR)
  • Contáctanos
  • Inicio
  • Blog
  • Empleos
  • Contáctanos
Cafayate.Net
  • 0
  • 0
    • Inicio
    • Blog
    • Empleos
    • Contáctanos
  • +31 653-919-302
  • Nederlands English (US) Español (AR)
  • Inicia sesión
  • Contáctanos

Deleting lots of keys in Redis, fast

  • Todos los blogs
  • Tech Blog
  • Deleting lots of keys in Redis, fast
  • 5 de marzo de 2021 por
    Administrator

     

    Here’s a snippet that has helped me whenever I’ve wanted to delete a large number of keys in Redis. This snippet can be run from a bash (or equivalent) shell. In this example i want to delete all keys that begin with ‘sessions’.


    redis-cli KEYS "sessions*" | xargs --max-args=100 --max-procs=8 redis-cli DEL

    The first part of the script runs the KEYS command searching for keys that begin with ‘sessions’. (NOTE: It’s obviously useless to delete ALL keys this way. You might as well delete the .rdb or .aof file and restart the server.)

    The second part runs the DEL command with a 100 arguments at a time. `–max-procs=8` means there are 8 processes running in parallel. Adjust –max-procs per the number of cores on your server.

    en Tech Blog
    Odoo Website Portal (Backported From v10)

    Diseñado para empresas

    Somos un equipo de personas apasionadas cuyo objetivo es mejorar la vida de todos a través de productos revolucionarios. Creamos grandes productos para resolver sus problemas empresariales. Nuestros productos están diseñados para pequeñas y medianas empresas dispuestas a optimizar su rendimiento.

    Contáctenos

    Plantexel
    Pedernera
    Salta Capital 
    Argenina

    • +31 653-919-302
    • [email protected]
    Síganos
    Copyright © Plantexel
    Nederlands | English (US) | Español (AR)