NOAUTH Требуется аутентификация. [TCP: // Redis: 6379]. Как решить эту проблему, добавьте vm.overcommit_memory = 1 в мой докер-контейнер для redis? - PullRequest
0 голосов
/ 10 января 2019

Некоторое время сервер работает, но после определенного количества запросов я получаю ошибки php для всех соединений с redis

    Predis\Connection\ConnectionException: `SELECT` failed: NOAUTH Authentication required. [tcp://redis:6379]
    #66 vendor/predis/predis/src/Connection/AbstractConnection.php(155): onConnectionError
    #65 vendor/predis/predis/src/Connection/StreamConnection.php(263): connect
    #64 vendor/predis/predis/src/Connection/AbstractConnection.php(180): getResource
    #63 vendor/predis/predis/src/Connection/StreamConnection.php(288): write
    #62 vendor/predis/predis/src/Connection/StreamConnection.php(394): writeRequest
    #61 vendor/predis/predis/src/Connection/AbstractConnection.php(110): executeCommand
    #60 vendor/predis/predis/src/Client.php(331): executeCommand
    #59 vendor/predis/predis/src/Client.php(314): __call

Redis запускается на моем сервере в Docker-контейнере Docker

a45f25ed7ebb        laradock_redis        "docker-entrypoint.s…"   2 days ago          Up 30 minutes       0.0.0.0:6379->6379/tcp                     laradock_redis_1

docker-compose logs redis

redis_1       | 1:C 08 Jan 08:56:23.036 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis_1       | 1:C 08 Jan 08:56:23.036 # Redis version=4.0.8, bits=64, commit=00000000, modified=0, pid=1, just started
redis_1       | 1:C 08 Jan 08:56:23.036 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
redis_1       | 1:M 08 Jan 08:56:23.038 * Running mode=standalone, port=6379.
redis_1       | 1:M 08 Jan 08:56:23.038 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
redis_1       | 1:M 08 Jan 08:56:23.038 # Server initialized
redis_1       | 1:M 08 Jan 08:56:23.038 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis_1       | 1:M 08 Jan 08:56:23.038 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.

докер-compose.yml

version: '2'

services:
    redis:
      build: ./redis
      volumes:
        - ${DATA_SAVE_PATH}/redis:/data
      ports:
        - "${REDIS_PORT}:6379"
      networks:
        - backend

Dockerfile для redis

FROM redis:latest

LABEL maintainer="Mahmoud Zalt <mahmoud@zalt.me>"

RUN echo 'sysctl -w net.core.somaxconn=65535' >> /etc/rc.local
RUN echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf

VOLUME /data

EXPOSE 6379

CMD ["redis-server"]

Подскажите, как настроить redis для стабильной работы.

Спасибо

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...