久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <small id='eCOH3'></small><noframes id='eCOH3'>

      <bdo id='eCOH3'></bdo><ul id='eCOH3'></ul>

    1. <tfoot id='eCOH3'></tfoot>

    2. <legend id='eCOH3'><style id='eCOH3'><dir id='eCOH3'><q id='eCOH3'></q></dir></style></legend>
    3. <i id='eCOH3'><tr id='eCOH3'><dt id='eCOH3'><q id='eCOH3'><span id='eCOH3'><b id='eCOH3'><form id='eCOH3'><ins id='eCOH3'></ins><ul id='eCOH3'></ul><sub id='eCOH3'></sub></form><legend id='eCOH3'></legend><bdo id='eCOH3'><pre id='eCOH3'><center id='eCOH3'></center></pre></bdo></b><th id='eCOH3'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='eCOH3'><tfoot id='eCOH3'></tfoot><dl id='eCOH3'><fieldset id='eCOH3'></fieldset></dl></div>

        如何讓 Laravel 與 AWS 上的 Redis 集群一起工作

        How to make Laravel work with Redis cluster on AWS(如何讓 Laravel 與 AWS 上的 Redis 集群一起工作)

              <small id='fn9wp'></small><noframes id='fn9wp'>

              <legend id='fn9wp'><style id='fn9wp'><dir id='fn9wp'><q id='fn9wp'></q></dir></style></legend>
                <tbody id='fn9wp'></tbody>

                <bdo id='fn9wp'></bdo><ul id='fn9wp'></ul>
                <i id='fn9wp'><tr id='fn9wp'><dt id='fn9wp'><q id='fn9wp'><span id='fn9wp'><b id='fn9wp'><form id='fn9wp'><ins id='fn9wp'></ins><ul id='fn9wp'></ul><sub id='fn9wp'></sub></form><legend id='fn9wp'></legend><bdo id='fn9wp'><pre id='fn9wp'><center id='fn9wp'></center></pre></bdo></b><th id='fn9wp'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='fn9wp'><tfoot id='fn9wp'></tfoot><dl id='fn9wp'><fieldset id='fn9wp'></fieldset></dl></div>
                  <tfoot id='fn9wp'></tfoot>
                • 本文介紹了如何讓 Laravel 與 AWS 上的 Redis 集群一起工作的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在嘗試將 Laravel (5.4) 與集群版本的 Redis 一起使用.我按照

                  I'm trying to use Laravel (5.4) with a clustered version of Redis. I followed the instructions form this post like so:

                  /*
                  |--------------------------------------------------------------------------
                  | Redis Databases
                  |--------------------------------------------------------------------------
                  |
                  | Redis is an open source, fast, and advanced key-value store that also
                  | provides a richer set of commands than a typical key-value systems
                  | such as APC or Memcached. Laravel makes it easy to dig right in.
                  |
                   */
                  
                  'redis' => [
                       'client' => 'predis',
                       'cluster' => 'true',
                  
                       'default' => [
                              'host' => env('REDIS_HOST_1', '127.0.0.1'),
                              'password' => env('REDIS_PASSWORD', null),
                              'port' => 6379,
                              'database' => 0,
                       ],
                  
                  
                      'clusters' => [
                           'default' => [
                              'host' => env('REDIS_HOST_1', '127.0.01'),
                              'password' => env('REDIS_PASSWORD', null),
                              'port' => 6379,
                              'database' => 0,
                          ],
                          'jobs' => [
                              'host' => env('REDIS_HOST_2', '127.0.0.1'),
                              'password' => env('REDIS_PASSWORD', null),
                              'port'     => 6379,
                              'database' => 0,
                          ],
                          'content' => [
                              'host' => env('REDIS_HOST_3', '127.0.0.1'),
                              'password' => env('REDIS_PASSWORD', null),
                              'port'     => 6379,
                              'database' => 0,
                          ]
                     ],
                  
                      'options' => [
                          'cluster' => 'redis'
                      ],
                  ]
                  

                  but I keep on getting this error

                  [2019-06-07 15:53:37] local.ERROR: PredisResponseServerException: MOVED 5873 127.0.0.1:7001 in /Users/Shared/dev/php/toters-api/vendor/predis/predis/src/Client.php:370 Stack trace: 
                  0 /Users/Shared/dev/php/toters-api/vendor/predis/predis/src/Client.php(335): PredisClient->onErrorResponse(Object(PredisCommandStringGet), Object(PredisResponseError)) 
                  1 /Users/Shared/dev/php/toters-api/vendor/predis/predis/src/Client.php(314): PredisClient->executeCommand(Object(PredisCommandStringGet)) 
                  2 /Users/Shared/dev/php/toters-api/vendor/laravel/framework/src/Illuminate/Redis/Connections/Connection.php(72): PredisClient->__call('get', Array) 
                  3 /Users/Shared/dev/php/toters-api/vendor/laravel/framework/src/Illuminate/Redis/Connections/Connection.php(84): IlluminateRedisConnectionsConnection->command('get', Array) 
                  4 /Users/Shared/dev/php/toters-api/vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php(54): IlluminateRedisConnectionsConnection->__call('get', Array) 
                  5 /Users/Shared/dev/php/toters-api/vendor/laravel/framework/src/Illuminate/Cache/Repository.php(84): IlluminateCacheRedisStore->get('cbwvtr3cxYIFP4H...') 
                  6 /Users/Shared/dev/php/toters-api/vendor/laravel/framework/src/Illuminate/Cache/Repository.php(68): IlluminateCacheRepository->get('cbwvtr3cxYIFP4H...') 
                  7 /Users/Shared/dev/php/toters-api/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php(305): IlluminateCacheRepository->has('cbwvtr3cxYIFP4H...') 
                  8 /Users/Shared/dev/php/toters-api/vendor/tymon/jwt-auth/src/Providers/Storage/IlluminateCacheAdapter.php(57): IlluminateCacheCacheManager->__call('has', Array) 
                  9 /Users/Shared/dev/php/toters-api/vendor/tymon/jwt-auth/src/Blacklist.php(74): TymonJWTAuthProvidersStorageIlluminateCacheAdapter->has('cbwvtr3cxYIFP4H...') 
                  10 /Users/Shared/dev/php/toters-api/vendor/tymon/jwt-auth/src/JWTManager.php(83): TymonJWTAuthBlacklist->has(Object(TymonJWTAuthPayload)) 
                  11 /Users/Shared/dev/php/toters-api/vendor/tymon/jwt-auth/src/JWTAuth.php(190): TymonJWTAuthJWTManager->decode(Object(TymonJWTAuthToken)) 
                  12 /Users/Shared/dev/php/toters-api/vendor/tymon/jwt-auth/src/JWTAuth.php(124): TymonJWTAuthJWTAuth->getPayload('eyJ0eXAiOiJKV1Q...') 
                  13 /Users/Shared/dev/php/toters-api/app/Http/Middleware/TokenAuthentication.php(25): TymonJWTAuthJWTAuth->authenticate('eyJ0eXAiOiJKV1Q...') 
                  14 /Users/Shared/dev/php/toters-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): AppHttpMiddlewareTokenAuthentication->handle(Object(IlluminateHttpRequest), Object(Closure)) 
                  15 /Users/Shared/dev/php/toters-api/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): IlluminatePipelinePipeline->IlluminatePipeline{closure}(Object(IlluminateHttpRequest)) 
                  16 /Users/Shared/dev/php/toters-api/app/Http/Middleware/WeakEtagMiddleware.php(22): IlluminateRoutingPipeline->IlluminateRouting{closure}(Object(IlluminateHttpRequest)) 
                  17 /Users/Shared/dev/php/toters-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): AppHttpMiddlewareWeakEtagMiddleware->handle(Object(IlluminateHttpRequest), Object(Closure)) 
                  

                  Note I didn't make any application data changes, so my Redis code still looks like this:

                  use IlluminateSupportFacadesRedis;
                  ..
                  
                  Redis::set('key', 'val');
                  

                  Further, If I remove the default from the above config so that it looks like so:

                  'redis' => [
                       'client' => 'predis',
                       'cluster' => 'true',
                  
                      'clusters' => [
                           'default' => [
                              'host' => env('REDIS_HOST_1', '127.0.01'),
                              'password' => env('REDIS_PASSWORD', null),
                              'port' => 6379,
                              'database' => 0,
                          ],
                          'jobs' => [
                              'host' => env('REDIS_HOST_2', '127.0.0.1'),
                              'password' => env('REDIS_PASSWORD', null),
                              'port'     => 6379,
                              'database' => 0,
                          ],
                          'content' => [
                              'host' => env('REDIS_HOST_3', '127.0.0.1'),
                              'password' => env('REDIS_PASSWORD', null),
                              'port'     => 6379,
                              'database' => 0,
                          ]
                     ],
                  
                      'options' => [
                          'cluster' => 'redis'
                      ],
                  ]
                  

                  I get this error

                  [2019-06-07 16:00:02] local.ERROR: SymfonyComponentDebugExceptionFatalThrowableError: Type error: Argument 1 passed to PredisConnectionParameters::__construct() must be of the type array, integer given, called in /Users/Shared/dev/php/toters-api/vendor/predis/predis/src/Connection/Factory.php on line 164 in /Users/Shared/dev/php/toters-api/vendor/predis/predis/src/Connection/Parameters.php:34 Stack trace: 
                  0 /Users/Shared/dev/php/toters-api/vendor/predis/predis/src/Connection/Factory.php(164): PredisConnectionParameters->__construct(6379) 
                  1 /Users/Shared/dev/php/toters-api/vendor/predis/predis/src/Connection/Factory.php(84): PredisConnectionFactory->createParameters(6379) 
                  2 /Users/Shared/dev/php/toters-api/vendor/predis/predis/src/Connection/Factory.php(118): PredisConnectionFactory->create(6379) 
                  3 /Users/Shared/dev/php/toters-api/vendor/predis/predis/src/Client.php(135): PredisConnectionFactory->aggregate(Object(PredisConnectionAggregateRedisCluster), Array) 
                  4 /Users/Shared/dev/php/toters-api/vendor/predis/predis/src/Client.php(56): PredisClient->createConnection(Array) 
                  5 /Users/Shared/dev/php/toters-api/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PredisConnector.php(41): PredisClient->__construct(Array, Array) 
                  6 /Users/Shared/dev/php/toters-api/vendor/laravel/framework/src/Illuminate/Redis/RedisManager.php(102): IlluminateRedisConnectorsPredisConnector->connectToCluster(Array, Array, Array) 
                  7 /Users/Shared/dev/php/toters-api/vendor/laravel/framework/src/Illuminate/Redis/RedisManager.php(83): IlluminateRedisRedisManager->resolveCluster('default') 
                  8 /Users/Shared/dev/php/toters-api/vendor/laravel/framework/src/Illuminate/Redis/RedisManager.php(61): IlluminateRedisRedisManager->resolve('default') 
                  9 /Users/Shared/dev/php/toters-api/vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php(211): IlluminateRedisRedisManager->connection('default') 
                  10 /Users/Shared/dev/php/toters-api/vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php(54): IlluminateCacheRedisStore->connection() 
                  11 /Users/Shared/dev/php/toters-api/vendor/laravel/framework/src/Illuminate/Cache/Repository.php(84): IlluminateCacheRedisStore->get('cbwvtr3cxYIFP4H...') 
                  12 /Users/Shared/dev/php/toters-api/vendor/laravel/framework/src/Illuminate/Cache/Repository.php(68): IlluminateCacheRepository->get('cbwvtr3cxYIFP4H...') 
                  13 /Users/Shared/dev/php/toters-api/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php(305): IlluminateCacheRepository->has('cbwvtr3cxYIFP4H...') 
                  14 /Users/Shared/dev/php/toters-api/vendor/tymon/jwt-auth/src/Providers/Storage/IlluminateCacheAdapter.php(57): IlluminateCacheCacheManager->__call('has', Array) 
                  15 /Users/Shared/dev/php/toters-api/vendor/tymon/jwt-auth/src/Blacklist.php(74): TymonJWTAuthProvidersStorageIlluminateCacheAdapter->has('cbwvtr3cxYIFP4H...') 
                  16 /Users/Shared/dev/php/toters-api/vendor/tymon/jwt-auth/src/JWTManager.php(83): TymonJWTAuthBlacklist->has(Object(TymonJWTAuthPayload)) 
                  17 /Users/Shared/dev/php/toters-api/vendor/tymon/jwt-auth/src/JWTAuth.php(190): TymonJWTAuthJWTManager->decode(Object(TymonJWTAuthToken)) 
                  

                  So from the error message it seems that Predis is simply ignoring my clustered configuration and reading straight from default, and default doesn't know how to deal with my clustered Redis data store. Ideas?

                  解決方案

                  after searching and debugging, this is what made it work:

                  'redis' => [
                      'client' => 'predis',
                      'cluster' => true,
                      'options' => [
                          'cluster' => 'redis',
                          'parameters' => [
                              'host' => env('REDIS_DEFAULT_HOST', '127.0.01'),
                              'password' => env('REDIS_PASSWORD', null),
                              'port' => env('REDIS_DEFAULT_PORT', 6379),
                              'database' => 0,
                              ],
                          ],
                      'clusters' => [
                           'default' => [
                              'host' => env('REDIS_DEFAULT_HOST', '127.0.01'),
                              'password' => env('REDIS_PASSWORD', null),
                              'port' => env('REDIS_DEFAULT_PORT', 6379),
                              'database' => 0,
                          ],
                          'jobs' => [
                              'host' => env('REDIS_JOBS_HOST', '127.0.01'),
                              'password' => env('REDIS_PASSWORD', null),
                              'port' => env('REDIS_JOBS_PORT', 6379),
                              'database' => 0,
                          ],
                          'content' => [
                              'host' => env('REDIS_CONTENT_HOST', '127.0.01'),
                              'password' => env('REDIS_PASSWORD', null),
                              'port' => env('REDIS_CONTENT_PORT', 6379),
                              'database' => 0,
                          ],
                          'options' => [
                              'cluster' => 'redis'
                          ],
                      ]
                  ]
                  

                  note: one obvious mistake in my config in the above question was that i combined the host and port, which i fixed here. this is what my .env file looks like:

                  REDIS_DEFAULT_HOST=127.0.0.1
                  REDIS_JOBS_HOST=127.0.0.1
                  REDIS_CONTENT_HOST=127.0.0.1
                  
                  REDIS_DEFAULT_PORT=7000
                  REDIS_JOBS_PORT=7001
                  REDIS_CONTENT_PORT=7002
                  

                  note: i created the cluster using the instructions here: https://redis.io/topics/cluster-tutorial#creating-the-cluster

                  Research Methodology

                  Due to the fact that: 1. The laravel/predis documentation on this is lacking 2. Most of the answers on stack overflow are along these lines: after googling and searching.. this is what worked out for me without much explanation of what's going on

                  I figured I can help out a bit by showing how I found my answer to the above.

                  1) Solving the error problem

                  To solve this bug

                  local.ERROR: SymfonyComponentDebugExceptionFatalThrowableError: Type error: Argument 1 passed to PredisConnectionParameters::__construct() must be of the type array, integer given, called in /Users/Shared/dev/php/toters-api/vendor/predis/predis/src/Connection/Factory.php on line 164 in /Users/Shared/dev/php/toters-api/vendor/predis/predis/src/Connection/Parameters.php:34 Stack trace:

                  I realized that my config/database.php format was simply wrong. Googling all over didn't give me any clear picture, so I decided to use xdebug and dive into the code. Note: I had the error stack trace (shown in the question above) printed in one doc, and I used that as a bird's eye view to guide me through the debug steps (ie stepping over/into/out etc while always printing the outputs in a separate doc and comparing it with my config/database.php as a sanity check/debug compass).

                  After digging and printig, I came across this:

                  [ *Locals ] [ Superglobals ] [ User defined constants ]
                  
                  - Locals at /Users/Shared/dev/php/toters-api/vendor/predis/predis/src/Client.php:55
                  
                   ? $options = (array [1])
                    
                     ? $options["cluster"] = (string [5]) `redis`
                    /
                   ? $parameters = (array [4])
                    
                     ? $parameters[0] = (string [14]) `127.0.0.1:7000`
                     |
                     ? $parameters[1] = (null)
                     |
                     ? $parameters[2] = (int) 6379
                     |
                     ? $parameters[3] = (int) 0
                    /
                   ? $this = (PredisClient [3])
                    
                     ? $this->connection = (null)
                     |
                     ? $this->options = (null)
                     |
                     ? $this->profile = (null)
                    /
                  

                  I compared this with my .env file's contents:

                  REDIS_DEFAULT_HOST=127.0.0.1:7000
                  REDIS_JOBS_HOST=127.0.0.1:7001
                  REDIS_CONTENT_HOST=127.0.0.1:7002
                  

                  and I realized that the format was wrong, I shouldn't put the host AND port in the same env variable.. so I put it like so instead:

                  REDIS_DEFAULT_HOST=127.0.0.1
                  REDIS_JOBS_HOST=127.0.0.1
                  REDIS_CONTENT_HOST=127.0.0.1
                  
                  REDIS_DEFAULT_PORT=7000
                  REDIS_JOBS_PORT=7001
                  REDIS_CONTENT_PORT=7002
                  

                  and that solved my first problem.

                  2) solving the other problems

                  after the above was fixed i got this

                  CLUSTERDOWN Hash slot not served

                  this was was quite easy, it was just a matter of googling the error message (since the error message was clearly a native redis error message, rather than some cryptic library wrapper like predis error message).. and i found this answer.

                  The rest was easy.

                  這篇關于如何讓 Laravel 與 AWS 上的 Redis 集群一起工作的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅動程序)

                        <tfoot id='Rh67D'></tfoot>

                          <small id='Rh67D'></small><noframes id='Rh67D'>

                            <bdo id='Rh67D'></bdo><ul id='Rh67D'></ul>
                            <i id='Rh67D'><tr id='Rh67D'><dt id='Rh67D'><q id='Rh67D'><span id='Rh67D'><b id='Rh67D'><form id='Rh67D'><ins id='Rh67D'></ins><ul id='Rh67D'></ul><sub id='Rh67D'></sub></form><legend id='Rh67D'></legend><bdo id='Rh67D'><pre id='Rh67D'><center id='Rh67D'></center></pre></bdo></b><th id='Rh67D'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Rh67D'><tfoot id='Rh67D'></tfoot><dl id='Rh67D'><fieldset id='Rh67D'></fieldset></dl></div>
                            <legend id='Rh67D'><style id='Rh67D'><dir id='Rh67D'><q id='Rh67D'></q></dir></style></legend>

                              <tbody id='Rh67D'></tbody>
                            主站蜘蛛池模板: 国产区在线免费观看 | 国产一区不卡 | 亚洲一区二区三区四区av | 91精品国产综合久久久久久漫画 | 在线精品亚洲欧美日韩国产 | 久久中文视频 | 免费视频久久久久 | 亚洲啊v在线| 一级毛片视频在线 | 天堂va在线观看 | 国产日韩91 | 久久草在线视频 | www四虎影视 | 91丨九色丨国产在线 | 爽爽免费视频 | 免费网站在线 | 九九九久久国产免费 | 精品视频在线免费观看 | 日韩欧美三级电影 | 国产精品视频播放 | 黄网站色大毛片 | 91一区二区在线观看 | 精品乱码一区二区三四区视频 | av一区二区三区四区 | 拍拍无遮挡人做人爱视频免费观看 | 精品成人免费一区二区在线播放 | 欧美一区二区三区久久精品 | 欧美综合在线视频 | 免费一级淫片aaa片毛片a级 | 91精品www | 日本a视频| 久日精品| 99在线观看视频 | 国产做a爱片久久毛片 | 免费看欧美一级片 | 日韩精品一区二区三区在线观看 | 久久久久久久久久影视 | 免费xxxx大片国产在线 | 一区二区免费在线视频 | 久草资源在线 | 欧美男人亚洲天堂 |