因?yàn)闃I(yè)務(wù)需要在默認(rèn)賬號(hào)寫入數(shù)據(jù)后,前端需要用只讀賬號(hào)消費(fèi)數(shù)據(jù),在配置里設(shè)置了只讀賬號(hào)后服務(wù)器上能登錄這個(gè)賬號(hào),但在本地測(cè)試遠(yuǎn)程登錄時(shí)顯示
RedisException: WRONGPASS invalid username-password pair or user is disabled. in xxxx\vendor\illuminate\redis\Connectors\PhpRedisConnector.php:87
//redis.php
return [
'default' => [
'host' => 'xxxxxxxxxx',
'password' => 'xxxxxxxxxx',
'port' => 6379,
'database' => 5,
],
'readuser' => [
'host' => 'xxxxxxxxxx',
'password' => 'xxxxxxxxxx',
'port' => 6379,
'database' => 5,
],
];
//test.php
$redis = Redis::connection('readuser');
$redis->get("link");
網(wǎng)上沒有找到類似解決方案