Comments (12)
启动的是哪个环境?配置 redis 的 IP 能正常访问吗
from service-mw2.
from service-mw2.
可以确定启动了,我单独创建一个项目,安装egg-redis后是正常的,以下是我的代码
import { Controller, Get, Provide } from '@midwayjs/decorator';
import { Context } from 'egg';
@provide()
@controller('/')
export class HomeController {
@get('/')
async home() {
return 'Hello Midwayjs!';
}
@get('/test')
async test(ctx:Context) {
console.log('ctx',await ctx.app.redis.get('a'));
const a = await ctx.app.redis.get('a')
return 'my test ' + a;
}
}
网页访问test方法能正常返回redis设置的值
from service-mw2.
我复现了你说的问题,一般这种情况,需要修改config文件中配置的IP
from service-mw2.
默认是127.0.0.1,我改成localhost,或192.168.1.x。还是不行
from service-mw2.
可能需要你自行排查下哪个环节有问题。
from service-mw2.
我的也连不上Redis,都修改了也不行,不知道为啥
from service-mw2.
麻烦提供一下复现步骤
from service-mw2.
from service-mw2.
from service-mw2.
我直接修改了 config.default.ts 文件中的配置
from service-mw2.
本地开发你需要修改config.local.ts这个文件
from service-mw2.
Related Issues (17)
- base model中id为string的意义? HOT 1
- 请问一下大佬们,我想了解一下接口响应统计中间件,相关具体代码在哪里呢?有没有一些推荐的参考demo 或者 学习资料哈~ (本人MQ小白一枚) HOT 4
- 会计划增加部署最佳实践吗? HOT 4
- 升级到 Midway.js 3.x 版本 HOT 2
- 在自己定义的函数里使用assert并用MyError抛错,没有被全局捕获到,报unhandledRejectionError HOT 1
- 数据库存储array list和string的转换 HOT 1
- 配套前端项目请求的接口跟此项目提供的接口对应不上 HOT 2
- 数据库连接失败 HOT 2
- 中间件redis启动报错(更新了对rabbitmq的支持之后) HOT 5
- 目录结构和midway(v2)文档里的不一致 HOT 3
- jwt问题 HOT 2
- Serverless 部署支持 HOT 1
- 对 jwt auth 示例的一点小小建议 HOT 2
- rabbitmq文件ts检查无法通过 HOT 7
- npm v7 执行 install 时会出现依赖报错 HOT 5
- 在文件src/config/config.default.ts 中, config.orm配置信息中port: process.env.MYSQL_HOST 写错了 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from service-mw2.