Как я могу устранить ошибку redis при проблеме подключения? - PullRequest
0 голосов
/ 22 февраля 2019

Недавно я обновляю свое приложение с Symfony 3.4 до Symfony 4.2.Я сталкиваюсь с ошибкой, сообщающей, что read error on connection.

Вот трассировка стека:

at var/cache/dev/ContainerRUEbk9e/Redis_ca5fc0f.php:312
  at Redis->get('DoctrineNamespaceCacheKey[]')
     (var/cache/dev/ContainerRUEbk9e/Redis_ca5fc0f.php:312)
  at Redis_ca5fc0f->get('DoctrineNamespaceCacheKey[]')
     (vendor/doctrine/cache/lib/Doctrine/Common/Cache/RedisCache.php:47)
  at Doctrine\Common\Cache\RedisCache->doFetch('DoctrineNamespaceCacheKey[]')
     (vendor/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php:200)
  at Doctrine\Common\Cache\CacheProvider->getNamespaceVersion()
     (vendor/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php:177)
  at Doctrine\Common\Cache\CacheProvider->getNamespacedId('9f7b27184e58ac025013b8c22fbdfa8a')
     (vendor/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php:60)
  at Doctrine\Common\Cache\CacheProvider->fetch('9f7b27184e58ac025013b8c22fbdfa8a')
     (vendor/doctrine/orm/lib/Doctrine/ORM/Query.php:271)
  at Doctrine\ORM\Query->_parse()
     (vendor/doctrine/orm/lib/Doctrine/ORM/Query.php:295)
  at Doctrine\ORM\Query->_doExecute()
     (vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php:967)
  at Doctrine\ORM\AbstractQuery->executeIgnoreQueryCache(null, 1)
     (vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php:922)
  at Doctrine\ORM\AbstractQuery->execute(null, 1)
     (vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php:726)
  at Doctrine\ORM\AbstractQuery->getResult()
     (src/Acme/AcmeBundle/Controller/AcmeController.php:1461)
  at Acme\AcmeBundle\Controller\AcmeController->acmeAction(object(Request))
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:150)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:67)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:198)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
     (public/app_dev.php:35)
  at runSymfony()
     (public/app_dev.php:39)
  at require('/var/www/html/project/Website/public/app_dev.php')
     (vendor/symfony/symfony/src/Symfony/Bundle/WebServerBundle/Resources/router.php:42)

Пожалуйста, посмотрите на проблему

1 Ответ

0 голосов
/ 25 февраля 2019

это может быть полезно.Ранее мои конфигурации были такими:

snc_redis:
    clients:
        default:
            type: predis
            alias: default
            dsn: "%redis_dsn%"
            options:
                read_write_timeout: "%redis_read_write_timeout%"
        session:
            type: phpredis
            alias: session
            dsn: "%redis_dsn%"
            options:
                read_write_timeout: "%redis_read_write_timeout%"
        doctrine:
            type: phpredis
            alias: doctrine
            dsn: "%redis_dsn%"
            options:
                read_write_timeout: "%redis_read_write_timeout%"
    session:
        client: session
        prefix: session:main

    doctrine:
        metadata_cache:
            client: doctrine
            entity_manager: default          # the name of your entity_manager connection
            document_manager: default        # the name of your document_manager connection
            namespace: "%kernel.root_dir%"
        result_cache:
            client: doctrine
            entity_manager: [default, read]  # you may specify multiple entity_managers
        query_cache:
            client: doctrine
            entity_manager: default

изменено на следующее

snc_redis:
    clients:
        default:
            type: predis
            alias: default
            dsn: "%redis_dsn%"
            options:
                read_write_timeout: "%redis_read_write_timeout%"
        session:
            type: predis
            alias: session
            dsn: "%redis_dsn%"
            options:
                read_write_timeout: "%redis_read_write_timeout%"
        doctrine:
            type: predis
            alias: doctrine
            dsn: "%redis_dsn%"
            options:
                read_write_timeout: "%redis_read_write_timeout%"
    session:
        client: session
        prefix: session:main

    doctrine:
        metadata_cache:
            client: doctrine
            entity_manager: default          # the name of your entity_manager connection
            document_manager: default        # the name of your document_manager connection
            namespace: "%kernel.root_dir%"
        result_cache:
            client: doctrine
            entity_manager: [default, read]  # you may specify multiple entity_managers
        query_cache:
            client: doctrine
            entity_manager: default

Может помочь другим.

...