We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在请求接口 /test的时候,报错。redis的host、port以及password都是正确的,不知道是哪里出现了问题 egg-redis版本:^2.5.0 egg版本:^3
报错信息
2023-06-16 16:59:34,096 ERROR 60949 nodejs.ReplyError: NOAUTH Authentication required. at parseError (/app/node_modules/redis-parser/lib/parser.js:179:12) at parseType (/app/node_modules/redis-parser/lib/parser.js:302:14) command: {"name":"info","args":[]} pid: 60949 hostname: sz-user.local
router.js
'use strict'; /** * @param {Egg.Application} app - egg application */ module.exports = app => { const { router, controller } = app; router.get('/test', controller.home.test); router.get('/', controller.home.index); };
controller/home.js
'use strict'; const { Controller } = require('egg'); class HomeController extends Controller { async index() { const { ctx } = this; ctx.body = 'hi, egg'; } async test() { const { ctx, app } = this; console.log('test start') // set await app.redis.set('foo', 'bar'); // get ctx.body = await app.redis.get('foo'); } } module.exports = HomeController;
plugin.js
'use strict'; /** @type Egg.EggPlugin */ module.exports = { // had enabled by egg // static: { // enable: true, // } redis: { enable: true, package: 'egg-redis' } };
config.default.js
/* eslint valid-jsdoc: "off" */ 'use strict'; /** * @param {Egg.EggAppInfo} appInfo app info */ module.exports = appInfo => { /** * built-in config * @type {Egg.EggAppConfig} **/ const config = exports = {}; // use for cookie sign key, should change to your own and keep security config.keys = appInfo.name + '_1686821889236_483'; // add your middleware config here config.middleware = []; config.redis ={ // Redis: require('ioredis'), client: { cluster: true, nodes: [{ host: '*.*.*.*.', port: '*', password: '*******', db: 0, // autoResubscribe: true }] }, } // add your user config here const userConfig = { // myAppName: 'egg', }; return { ...config, ...userConfig }; };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
在请求接口 /test的时候,报错。redis的host、port以及password都是正确的,不知道是哪里出现了问题
egg-redis版本:^2.5.0
egg版本:^3
报错信息
router.js
controller/home.js
plugin.js
config.default.js
The text was updated successfully, but these errors were encountered: