{"id":20,"date":"2020-11-26T15:58:17","date_gmt":"2020-11-26T15:58:17","guid":{"rendered":"https:\/\/www.hostgento.com\/blog\/?p=20"},"modified":"2023-07-31T14:15:05","modified_gmt":"2023-07-31T14:15:05","slug":"como-configurar-redis-para-magento-2","status":"publish","type":"post","link":"https:\/\/www.bhoost.com\/es\/como-configurar-redis-para-magento-2\/","title":{"rendered":"C\u00f3mo configurar Redis para Magento 2"},"content":{"rendered":"<p>Redis es un m\u00e9todo de almacenamiento en cach\u00e9 que puede aumentar la velocidad del backend y el frontend de su tienda.<\/p>\n<p>Este art\u00edculo explicar\u00e1 c\u00f3mo configurar Redis en su tienda Magento 2 y c\u00f3mo trabajar con redis-cli.<\/p>\n<h2>Configurar Redis Cache para Magento 2<\/h2>\n<p>Hay dos formas de configurar Redis Cache para Magento 2. Puede ejecutar un comando que actualice\u00a0<i>env.php<\/i>\u00a0autom\u00e1ticamente\u00a0con los detalles correctos o puede editar manualmente el archivo\u00a0<i>env.php<\/i>\u00a0.<\/p>\n<h3><span style=\"font-weight: 400\">Configurar Redis Cache para Magento 2 a trav\u00e9s de la l\u00ednea de comando<\/span><\/h3>\n<p>Puede usar el siguiente comando para habilitar el almacenamiento en cach\u00e9 de backend de Redis:<\/p>\n<pre><span style=\"font-weight: 400\">cd \/data\/web\/magento2<\/span><\/pre>\n<pre><span style=\"font-weight: 400\">bin\/magento setup:config:set --cache-backend=redis --cache-backend-redis-server=127.0.0.1 --cache-backend-redis-db=0<\/span><\/pre>\n<h3><span style=\"font-weight: 400\">Configurar Redis Cache para Magento 2 modificando el archivo env.php<\/span><\/h3>\n<p><span style=\"font-weight: 400\">Para habilitar el almacenamiento en cach\u00e9 en Redis, ampl\u00ede su\u00a0<i>\/data\/web\/magento2\/app\/etc\/env.php<\/i>\u00a0con el siguiente fragmento.\u00a0Agr\u00e9guelo a sus claves de cach\u00e9.\u00a0(Sin la clave de cach\u00e9 en el\u00a0snippet.<\/span><\/p>\n<pre><span style=\"font-weight: 400\">'cache' =&gt; array(<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0'frontend' =&gt; array(<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'default' =&gt; array(<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'backend' \u00a0 \u00a0 \u00a0 \u00a0 =&gt; 'Cm_Cache_Backend_Redis',<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'backend_options' =&gt; array(<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'server' =&gt; '127.0.0.1',<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'port' \u00a0 =&gt; '6379',<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0),<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0),<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0),<\/span>\r\n\r\n<span style=\"font-weight: 400\">),<\/span><\/pre>\n<p>Ahora borre el cach\u00e9:<\/p>\n<pre><span style=\"font-weight: 400\">rm -rf \/data\/web\/magento2\/var\/cache\/*<\/span>\r\n\r\n<span style=\"font-weight: 400\">redis-cli flushall<\/span><\/pre>\n<h2><span style=\"font-weight: 400\">Configurar Redis Full Page Caching para Magento 2<\/span><\/h2>\n<p><span style=\"font-weight: 400\">Para habilitar el almacenamiento en cach\u00e9 de la p\u00e1gina de Redis, ampl\u00ede su <\/span><i><span style=\"font-weight: 400\">`\/ data \/ web \/ magento2 \/ app \/ etc \/ env.php`<\/span><\/i><span style=\"font-weight: 400\"> con el siguiente fragmento.<\/span><\/p>\n<p>Debes pegarlo entre las claves de `cach\u00e9`, as\u00ed que omite la etiqueta de cach\u00e9 en este fragmento.<\/p>\n<pre><span style=\"font-weight: 400\">'cache' =&gt; array (<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'frontend' =&gt; array (<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'default' =&gt; array (<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'backend' \u00a0 \u00a0 \u00a0 \u00a0 =&gt; 'Cm_Cache_Backend_Redis',<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'backend_options' =&gt; array (<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'server' =&gt; '127.0.0.1',<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'port' \u00a0 =&gt; '6379',<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0),<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0),<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ Start of snippet<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'page_cache' =&gt; array (<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'backend' \u00a0 \u00a0 \u00a0 \u00a0 =&gt; 'Cm_Cache_Backend_Redis',<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'backend_options' =&gt; array (<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'server'\u00a0 \u00a0 \u00a0 \u00a0 =&gt; '127.0.0.1',<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'port'\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 =&gt; '6379',<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'database'\u00a0 \u00a0 \u00a0 =&gt; '1',<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'compress_data' =&gt; '0',<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0),<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0),<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ End of snippet<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0),<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0),<\/span>\r\n\r\n<\/pre>\n<p>Se puede ver un ejemplo completo\u00a0<a href=\"https:\/\/gist.github.com\/hn-support\/4bf9575e7896abf57dff2b5ac15f05ef\">aqu\u00ed.<\/a><\/p>\n<p>Ahora borre el cach\u00e9:<\/p>\n<pre><span style=\"font-weight: 400\">rm -rf \/data\/web\/magento2\/var\/cache\/*<\/span>\r\n\r\n<span style=\"font-weight: 400\">redis-cli flushall<\/span><\/pre>\n<h2>Vaciar la cach\u00e9<\/h2>\n<p>Para borrar la cach\u00e9 de Magento, borre la base de datos de Redis correspondiente a la base de datos de Redis configurada:<\/p>\n<pre><span style=\"font-weight: 400\">redis-cli -n $db flushdb<\/span><\/pre>\n<p>o alternativamente<\/p>\n<p><i><span style=\"font-weight: 400\">n98-magerun2<\/span><\/i><span style=\"font-weight: 400\"> o la herramienta cli de Magento:<\/span><\/p>\n<p>&nbsp;<\/p>\n<pre><span style=\"font-weight: 400\">## Flush using n98-magerun2<\/span>\r\n\r\n<span style=\"font-weight: 400\">n98-magerun2 cache:flush<\/span>\r\n\r\n\r\n<\/pre>\n<pre><span style=\"font-weight: 400\">## Flush using magento cli<\/span>\r\n\r\n<span style=\"font-weight: 400\">cd \/data\/web\/magento2 &amp;&amp; php bin\/magento cache:flush<\/span><\/pre>\n<p>&nbsp;<\/p>\n<p>Para borrar todas las sesiones, cach\u00e9s, etc.\u00a0(Vaciar toda la instancia de Redis), use el siguiente comando:<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400\">redis-cli flushall<\/span><\/p>\n<h2>Modificaci\u00f3n de la biblioteca de compresi\u00f3n<\/h2>\n<p>Puede utilizar la biblioteca de compresi\u00f3n \u00abSnappy\u00bb.\u00a0Puede encontrar m\u00e1s informaci\u00f3n sobre Snappy en el registro de cambios:\u00a0<a href=\"https:\/\/changelog.hypernode.com\/changelog\/release-4224\/\">Release-4224<\/a>\u00a0.<\/p>\n<p>&nbsp;<\/p>\n<p>Para usar la biblioteca de compresi\u00f3n Snappy para la cach\u00e9 de Redis, debe agregar\u00a0<i>&#8216;compress_library&#8217; =&gt; &#8216;snappy&#8217;<\/i>\u00a0, en su\u00a0<i>env.php<\/i> en:<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400\">&#8216;page_cache&#8217; =&gt; array (<\/span><\/p>\n<p><span style=\"font-weight: 400\">&#8216;backend&#8217; \u00a0 \u00a0 \u00a0 \u00a0 =&gt; &#8216;Cm_Cache_Backend_Redis&#8217;,<\/span><\/p>\n<p><span style=\"font-weight: 400\">&#8216;backend_options&#8217; =&gt; array (<\/span><\/p>\n<h2><span style=\"font-weight: 400\">Configurar Magento 2 para utilizar Redis como Session Store<\/span><\/h2>\n<p>\u00a1Tambi\u00e9n puede usar Redis para memorizar sesiones!<\/p>\n<p>&nbsp;<\/p>\n<p>De esta manera, las sesiones se almacenan en la memoria, lo que hace que la tienda sea m\u00e1s r\u00e1pida y usa menos IO que cuando se usa MySQL o archivos como el archivo de sesi\u00f3n.<\/p>\n<h3><span style=\"font-weight: 400\">Configura Magento 2 per archiviare le sessioni in Redis<\/span><\/h3>\n<p><span style=\"font-weight: 400\">Poich\u00e9 Magento 2 supporta completamente Redis, non \u00e8 necessario installare estensioni aggiuntive per configurare Redis.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Todo lo que necesita hacer es extender su <\/span><i><span style=\"font-weight: 400\">app \/ etc \/ env.php<\/span><\/i><span style=\"font-weight: 400\"> \u00a0y borrar la cach\u00e9.<\/span><\/p>\n<p>Para habilitar el archivado de sesiones en Redis, ampl\u00ede su\u00a0<i>\/data\/web\/magento2\/app\/etc\/env.php<\/i>\u00a0con el siguiente fragmento:<\/p>\n<p><span style=\"font-weight: 400\">&#8216;session&#8217; =&gt; array(<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u00a0\u00a0\u00a0&#8216;save&#8217; =&gt; &#8216;redis&#8217;,<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u00a0\u00a0\u00a0&#8216;redis&#8217; =&gt; array(<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8216;host&#8217;\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 =&gt; &#8216;redismaster&#8217;,<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8216;port&#8217;\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 =&gt; &#8216;6379&#8217;,<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8216;password&#8217;\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 =&gt; \u00bb,<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8216;timeout&#8217; \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 =&gt; &#8216;2.5&#8217;,<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8216;persistent_identifier&#8217; =&gt; \u00bb,<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8216;database&#8217;\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 =&gt; &#8216;2&#8217;,<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8216;compression_threshold&#8217; =&gt; &#8216;2048&#8217;,<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8216;compression_library&#8217; \u00a0 =&gt; &#8216;gzip&#8217;,<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8216;log_level&#8217; \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 =&gt; &#8216;1&#8217;,<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8216;max_concurrency&#8217; \u00a0 \u00a0 \u00a0 =&gt; &#8216;6&#8217;,<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8216;break_after_frontend&#8217;\u00a0 =&gt; &#8216;5&#8217;,<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8216;break_after_adminhtml&#8217; =&gt; &#8217;30&#8217;,<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8216;first_lifetime&#8217;\u00a0 \u00a0 \u00a0 \u00a0 =&gt; &#8216;600&#8217;,<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8216;bot_first_lifetime&#8217;\u00a0 \u00a0 =&gt; &#8217;60&#8217;,<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8216;bot_lifetime&#8217;\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 =&gt; &#8216;7200&#8217;,<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8216;disable_locking&#8217; \u00a0 \u00a0 \u00a0 =&gt; &#8216;0&#8217;,<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8216;min_lifetime&#8217;\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 =&gt; &#8217;60&#8217;,<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8216;max_lifetime&#8217;\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 =&gt; &#8216;2592000&#8217;,<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u00a0\u00a0\u00a0),<\/span><\/p>\n<p><span style=\"font-weight: 400\">),<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>Ahora actualiza la cach\u00e9<\/p>\n<p><span style=\"font-weight: 400\">rm -rf \/data\/web\/magento2\/var\/cache\/*<\/span><\/p>\n<p><span style=\"font-weight: 400\">redis-cli flushall<\/span><\/p>\n<h2>Habilite la segunda instancia de Redis para las sesiones<\/h2>\n<p><span style=\"font-weight: 400\">Hemos hecho posible habilitar una segunda instancia de Redis m\u00e1s personalizada para guardar los datos de la sesi\u00f3n (se puede encontrar m\u00e1s informaci\u00f3n en nuestro changelog)<\/span><\/p>\n<p><span style=\"font-weight: 400\">Para habilitar la segunda instancia de Redis para las sesiones, ejecute el comando: <\/span><i><span style=\"font-weight: 400\">systemctl settings redis_persistent_instance &#8211;value True<\/span><\/i><\/p>\n<p><span style=\"font-weight: 400\">Despu\u00e9s de habilitar la segunda instancia de Redis, debe actualizar el archivo <\/span><i><span style=\"font-weight: 400\">\/data\/web\/public\/app\/etc\/local.xml<\/span><\/i><span style=\"font-weight: 400\"> y cambiar el valor del puerto a 6378 en lugar del 6379 predeterminado.\u00a0Tambi\u00e9n debe agregar la siguiente l\u00ednea a su crontab:<\/span><\/p>\n<pre><i><span style=\"font-weight: 400\">* * * * * redis-cli -p 6378 bgsave<\/span><\/i><\/pre>\n<h2>Compruebe si sus sesiones est\u00e1n archivadas en Redis<\/h2>\n<p>Para comprobar si su configuraci\u00f3n funciona correctamente, primero borre el almac\u00e9n de sesiones o session store:<\/p>\n<p><i><span style=\"font-weight: 400\">rm \/ data \/ web \/ public \/ var \/ sessions \/ *<\/span><\/i><\/p>\n<p>Ahora abra el sitio en su navegador y presione F5 varias veces o inicie sesi\u00f3n en el panel de administraci\u00f3n.<\/p>\n<p>Con suerte, no se deben escribir archivos de sesi\u00f3n adicionales en\u00a0<i>\/ data \/ web \/ var \/ sessions<\/i>\u00a0, sino en la base de datos de Redis:<\/p>\n<pre><span style=\"font-weight: 400\">redis-cli -n 2 keys \\*<\/span><\/pre>\n<h2>Soluci\u00f3n de problemas<\/h2>\n<p>Una nota r\u00e1pida, cuando se encuentre con el l\u00edmite m\u00e1ximo de memoria configurado, aseg\u00farese de que las claves de Redis necesarias est\u00e9n configuradas como vol\u00e1tiles (aseg\u00farese de que caduque).\u00a0De lo contrario, toda la memoria configurada asignada se llenar\u00e1 y Redis se \u00abcolgar\u00e1\u00bb.<\/p>\n<p>Cuando la memoria de la instancia de Redis est\u00e1 llena y llega una nueva escritura, Redis quita las claves para dejar espacio para la escritura de acuerdo con la pol\u00edtica de maxmemory de la instancia. Esto se llama pol\u00edtica de desalojo.<\/p>\n<p>En algunos casos, vemos que cuando Redis alcanza el l\u00edmite configurado e intenta caducar las claves para hacer espacio, la pol\u00edtica de desalojo se atasca en un bucle.\u00a0Esto significa que las claves no caducar\u00e1n y Redis alcanza el l\u00edmite.<\/p>\n<p>Una soluci\u00f3n alternativa es borrar la cach\u00e9 de Redis, puede hacerlo usando el comando flushall:<\/p>\n<pre><span style=\"font-weight: 400\">redis-cli flushall<\/span><\/pre>\n<p>Esto eliminar\u00e1 todas las bases de datos de Redis disponibles.\u00a0Tenga en cuenta que esta es solo una soluci\u00f3n temporal.\u00a0La causa subyacente est\u00e1 en el c\u00f3digo de la aplicaci\u00f3n y debe corregirse de forma permanente.<\/p>\n<p>Puede encontrar una gu\u00eda m\u00e1s extensa sobre la configuraci\u00f3n de cach\u00e9s de Redis en\u00a0<a href=\"https:\/\/devdocs.magento.com\/guides\/v2.3\/config-guide\/redis\/redis-pg-cache.html\">las p\u00e1ginas de ayuda de Magento<\/a>\u00a0.<\/p>\n<h2><span style=\"font-weight: 400\">Bot<\/span><\/h2>\n<p><span style=\"font-weight: 400\">Como sabe, las sesiones de su tienda en l\u00ednea tambi\u00e9n se pueden almacenar en Redis.\u00a0Si tambi\u00e9n usa el almacenamiento en cach\u00e9 de Redis y las sesiones de almacenamiento en Redis, deber\u00e1 compartir la memoria de Redis disponible.\u00a0Esto no deber\u00eda ser un problema, sin embargo, hemos visto escenarios en los que una tienda almacena sus sesiones en Redis y ha tenido algunos robot \/ crawler visitando la tienda.\u00a0Esto ha provocado que Redis almacene muchas m\u00e1s sesiones de lo habitual, lo que hace que Redis llene la memoria en poco tiempo y que Redis se bloquee.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Si desea tener una vista m\u00e1s detallada del tr\u00e1fico de bots, puede usar el comando pnl <\/span><i><span style=\"font-weight: 400\">&#8211;yesterday &#8211;php &#8211;bots &#8211;fields ua | ordina | uniq -c | sort -n <\/span><\/i><span style=\"font-weight: 400\">para obtener una descripci\u00f3n general de los 10 bots principales que visitaron su tienda en l\u00ednea ayer.\u00a0<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Redis es un m\u00e9todo de almacenamiento en cach\u00e9 que puede aumentar la velocidad del backend y el frontend de su [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[3],"tags":[15],"class_list":["post-20","post","type-post","status-publish","format-standard","hentry","category-sicurezza-magento","tag-magento"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>C\u00f3mo configurar Redis para Magento 2 | BHOOST<\/title>\n<meta name=\"description\" content=\"Te ense\u00f1amos paso a paso a configurar Redis en un e-commerce Magento y a solucionar los posibles errores de instalaci\u00f3n\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.bhoost.com\/es\/como-configurar-redis-para-magento-2\/\" \/>\n<meta property=\"og:locale\" content=\"es_ES\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C\u00f3mo configurar Redis para Magento 2 | BHOOST\" \/>\n<meta property=\"og:description\" content=\"Te ense\u00f1amos paso a paso a configurar Redis en un e-commerce Magento y a solucionar los posibles errores de instalaci\u00f3n\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.bhoost.com\/es\/como-configurar-redis-para-magento-2\/\" \/>\n<meta property=\"og:site_name\" content=\"BHOOST Hosting E-Commerce R\u00e1pido, Seguro y Optimizado\" \/>\n<meta property=\"article:published_time\" content=\"2020-11-26T15:58:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-31T14:15:05+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tiempo de lectura\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.bhoost.com\\\/es\\\/como-configurar-redis-para-magento-2\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bhoost.com\\\/es\\\/como-configurar-redis-para-magento-2\\\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\\\/\\\/www.bhoost.com\\\/es\\\/#\\\/schema\\\/person\\\/8b3f2008c39ed0798bd79da571f15d18\"},\"headline\":\"C\u00f3mo configurar Redis para Magento 2\",\"datePublished\":\"2020-11-26T15:58:17+00:00\",\"dateModified\":\"2023-07-31T14:15:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.bhoost.com\\\/es\\\/como-configurar-redis-para-magento-2\\\/\"},\"wordCount\":1091,\"commentCount\":0,\"keywords\":[\"magento\"],\"articleSection\":[\"Sicurezza Magento\"],\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.bhoost.com\\\/es\\\/como-configurar-redis-para-magento-2\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.bhoost.com\\\/es\\\/como-configurar-redis-para-magento-2\\\/\",\"url\":\"https:\\\/\\\/www.bhoost.com\\\/es\\\/como-configurar-redis-para-magento-2\\\/\",\"name\":\"C\u00f3mo configurar Redis para Magento 2 | BHOOST\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bhoost.com\\\/es\\\/#website\"},\"datePublished\":\"2020-11-26T15:58:17+00:00\",\"dateModified\":\"2023-07-31T14:15:05+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.bhoost.com\\\/es\\\/#\\\/schema\\\/person\\\/8b3f2008c39ed0798bd79da571f15d18\"},\"description\":\"Te ense\u00f1amos paso a paso a configurar Redis en un e-commerce Magento y a solucionar los posibles errores de instalaci\u00f3n\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.bhoost.com\\\/es\\\/como-configurar-redis-para-magento-2\\\/#breadcrumb\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.bhoost.com\\\/es\\\/como-configurar-redis-para-magento-2\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.bhoost.com\\\/es\\\/como-configurar-redis-para-magento-2\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.bhoost.com\\\/es\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C\u00f3mo configurar Redis para Magento 2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.bhoost.com\\\/es\\\/#website\",\"url\":\"https:\\\/\\\/www.bhoost.com\\\/es\\\/\",\"name\":\"BHOOST Hosting E-Commerce R\u00e1pido, Seguro y Optimizado\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.bhoost.com\\\/es\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"es\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.bhoost.com\\\/es\\\/#\\\/schema\\\/person\\\/8b3f2008c39ed0798bd79da571f15d18\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ba2d1dbd29575291b54a65b52c6a0f9064c2723f3c8612b0ecf18408b468c2ad?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ba2d1dbd29575291b54a65b52c6a0f9064c2723f3c8612b0ecf18408b468c2ad?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ba2d1dbd29575291b54a65b52c6a0f9064c2723f3c8612b0ecf18408b468c2ad?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"sameAs\":[\"https:\\\/\\\/www.bhoost.com\"],\"url\":\"https:\\\/\\\/www.bhoost.com\\\/es\\\/author\\\/andreasacca_vd0s1ik8\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"C\u00f3mo configurar Redis para Magento 2 | BHOOST","description":"Te ense\u00f1amos paso a paso a configurar Redis en un e-commerce Magento y a solucionar los posibles errores de instalaci\u00f3n","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.bhoost.com\/es\/como-configurar-redis-para-magento-2\/","og_locale":"es_ES","og_type":"article","og_title":"C\u00f3mo configurar Redis para Magento 2 | BHOOST","og_description":"Te ense\u00f1amos paso a paso a configurar Redis en un e-commerce Magento y a solucionar los posibles errores de instalaci\u00f3n","og_url":"https:\/\/www.bhoost.com\/es\/como-configurar-redis-para-magento-2\/","og_site_name":"BHOOST Hosting E-Commerce R\u00e1pido, Seguro y Optimizado","article_published_time":"2020-11-26T15:58:17+00:00","article_modified_time":"2023-07-31T14:15:05+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Escrito por":"admin","Tiempo de lectura":"5 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.bhoost.com\/es\/como-configurar-redis-para-magento-2\/#article","isPartOf":{"@id":"https:\/\/www.bhoost.com\/es\/como-configurar-redis-para-magento-2\/"},"author":{"name":"admin","@id":"https:\/\/www.bhoost.com\/es\/#\/schema\/person\/8b3f2008c39ed0798bd79da571f15d18"},"headline":"C\u00f3mo configurar Redis para Magento 2","datePublished":"2020-11-26T15:58:17+00:00","dateModified":"2023-07-31T14:15:05+00:00","mainEntityOfPage":{"@id":"https:\/\/www.bhoost.com\/es\/como-configurar-redis-para-magento-2\/"},"wordCount":1091,"commentCount":0,"keywords":["magento"],"articleSection":["Sicurezza Magento"],"inLanguage":"es","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.bhoost.com\/es\/como-configurar-redis-para-magento-2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.bhoost.com\/es\/como-configurar-redis-para-magento-2\/","url":"https:\/\/www.bhoost.com\/es\/como-configurar-redis-para-magento-2\/","name":"C\u00f3mo configurar Redis para Magento 2 | BHOOST","isPartOf":{"@id":"https:\/\/www.bhoost.com\/es\/#website"},"datePublished":"2020-11-26T15:58:17+00:00","dateModified":"2023-07-31T14:15:05+00:00","author":{"@id":"https:\/\/www.bhoost.com\/es\/#\/schema\/person\/8b3f2008c39ed0798bd79da571f15d18"},"description":"Te ense\u00f1amos paso a paso a configurar Redis en un e-commerce Magento y a solucionar los posibles errores de instalaci\u00f3n","breadcrumb":{"@id":"https:\/\/www.bhoost.com\/es\/como-configurar-redis-para-magento-2\/#breadcrumb"},"inLanguage":"es","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.bhoost.com\/es\/como-configurar-redis-para-magento-2\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.bhoost.com\/es\/como-configurar-redis-para-magento-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.bhoost.com\/es\/"},{"@type":"ListItem","position":2,"name":"C\u00f3mo configurar Redis para Magento 2"}]},{"@type":"WebSite","@id":"https:\/\/www.bhoost.com\/es\/#website","url":"https:\/\/www.bhoost.com\/es\/","name":"BHOOST Hosting E-Commerce R\u00e1pido, Seguro y Optimizado","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.bhoost.com\/es\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"es"},{"@type":"Person","@id":"https:\/\/www.bhoost.com\/es\/#\/schema\/person\/8b3f2008c39ed0798bd79da571f15d18","name":"admin","image":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/secure.gravatar.com\/avatar\/ba2d1dbd29575291b54a65b52c6a0f9064c2723f3c8612b0ecf18408b468c2ad?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/ba2d1dbd29575291b54a65b52c6a0f9064c2723f3c8612b0ecf18408b468c2ad?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ba2d1dbd29575291b54a65b52c6a0f9064c2723f3c8612b0ecf18408b468c2ad?s=96&d=mm&r=g","caption":"admin"},"sameAs":["https:\/\/www.bhoost.com"],"url":"https:\/\/www.bhoost.com\/es\/author\/andreasacca_vd0s1ik8\/"}]}},"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.bhoost.com\/es\/wp-json\/wp\/v2\/posts\/20","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bhoost.com\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bhoost.com\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bhoost.com\/es\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bhoost.com\/es\/wp-json\/wp\/v2\/comments?post=20"}],"version-history":[{"count":4,"href":"https:\/\/www.bhoost.com\/es\/wp-json\/wp\/v2\/posts\/20\/revisions"}],"predecessor-version":[{"id":1364,"href":"https:\/\/www.bhoost.com\/es\/wp-json\/wp\/v2\/posts\/20\/revisions\/1364"}],"wp:attachment":[{"href":"https:\/\/www.bhoost.com\/es\/wp-json\/wp\/v2\/media?parent=20"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bhoost.com\/es\/wp-json\/wp\/v2\/categories?post=20"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bhoost.com\/es\/wp-json\/wp\/v2\/tags?post=20"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}