Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED
expressjs에서 node.js를 작업하고 있습니다.
계정을 세션에 저장하려고 합니다.그래서 expressjs에서 session with code를 사용하기 위해 테스트를 해보려 합니다.
var RedisStore = require('connect-redis')(express);
app.use(express.bodyParser());
app.use(express.cookieParser());
app.use(express.session({ secret: "keyboard cat", store: new RedisStore }));
하지만 나는 오류가 났습니다.Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED.
이 문제를 해결할 수 있도록 도와주세요.
After you install redis, type from terminal:
redis-server
and you'll have redis running
I solve this problem in next way:
sudo apt-get install redis-server
then run command to confirm that everything ok:
sudo service redis-server status
출력은 다음과 같습니다.redis-server is running- 그것은 문제가 해결되었다는 것을 의미합니다.
Install redis on your system first -
brew install redis
then start the redis server -
redis-server
창문에 있는데 여기서 레디스를 설치하고 실행해야 했어요redis-server.exe.
From the top of this SO question.
For those of you who are using docker with docker-compose and Typescript my solution was
import { RedisClient } from 'redis';
const pubClient = new RedisClient({ url: 'redis://redis:6379' });
to
import { createClient } from 'redis';
const pubClient = createClient({ url: 'redis://redis:6379' });
docker-compose.yml
version: '3.9'
services:
main:
build:
context: .
target: development
ports:
- ${PORT}:${PORT}
volumes:
- ./src:/usr/src/app/src
- /app/node_modules
env_file:
- .env
command: npm run start:dev
depends_on:
- mongo
- redis
mongo:
image: mongo:5.0.2-focal
volumes:
- mongo-data:/data/db
mongo-express:
image: mongo-express:0.54.0
ports:
- 8081:8081
depends_on:
- mongo
redis:
image: redis:6.2.5-alpine
volumes:
mongo-data:
Simple solution:
only hit below commend once and restart your server again
redis-server
Using Windows 10? Go here: https://learn.microsoft.com/en-us/windows/wsl/wsl2-install
Then run...
$ wget https://github.com/antirez/redis/archive/5.0.5.tar.gz <- change this to whatever Redis version you want (https://github.com/antirez/redis/releases)
$ tar xzf redis-5.0.5.tar.gz
$ cd redis-5.0.5
$ make
for Windows users, you can use chocolatey to install Redis
choco install redis-64
then run server from
C:\ProgramData\chocolatey\lib\redis-64\redis-server.exe
저도 같은 문제가 있습니다. 먼저 redis-server를 재시작하려고 했습니다.sudo service restart문제는 여전히 남아 있었습니다.그 다음에 제거했습니다.redis-server타고sudo apt-get purge redis-server다시 설치합니다.sudo apt-get install redis-server그리고 다시 레디스가 작동하고 있었습니다.이 곳에 위치한 리디스로그도 볼만합니다./var/log/redis/redis-server.log
I used ubuntu 12.04 I solved that problem by installing redis-server
redis-server installation for ubuntu 12.04
some configuration will new root permission Also listed manuals for other OS
Thanks
For me I had this issue on Ubuntu 18.x, but my problem was that my redis-server was running on 127.0.0.1 but I found out I needed to run it on my IP address xxx.xx.xx.xx
I went into my Ubuntu machine and did the following.
cd /etc/redis/
sudo vim redis.conf
Then I edited this part.
################################## NETWORK #####################################
# By default, if no "bind" configuration directive is specified, Redis listens
# for connections from all the network interfaces available on the server.
# It is possible to listen to just one or multiple selected interfaces using
# the "bind" configuration directive, followed by one or more IP addresses.
#
# Examples:
#
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1 ::1
#
# ~~~ WARNING ~~~ If the computer running Redis is directly exposed to the
# internet, binding to all the interfaces is dangerous and will expose the
# instance to everybody on the internet. So by default we uncomment the
# following bind directive, that will force Redis to listen only into
# the IPv4 loopback interface address (this means Redis will be able to
# accept connections only from clients running into the same computer it
# is running).le to listen to just one or multiple selected interfaces using
#
# IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
# JUST COMMENT THE FOLLOWING LINE.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# bind 127.0.0.1 ::1 10.0.0.1
bind 127.0.0.1 ::1 # <<-------- change this to what your iP address is something like (bind 192.168.2.2)
Save that, and then restart redis-server.
sudo service redis-server restart아니면 그냥 달리거나,redis-server
윈도우 플랫폼의 경우 다음을 확인해야 합니다.redis-server지정된 ip:port에서 실행되고 있습니다. redis 구성은 설치 디렉토리에서 찾을 수 있습니다./conf/redis.conf. 기본적으로 클라이언트 수락127.0.0.1:6379.
I'm on MBP , and install redis detail my problem was resolved .Fixed the Download, extract and compile Redis with:
$ wget http://download.redis.io/releases/redis-3.0.2.tar.gz
$ tar xzf redis-3.0.2.tar.gz
$ cd redis-3.0.2
$ make
이제 컴파일된 이진 파일은 src 디렉토리에서 사용할 수 있습니다.
Redis 실행 위치:
$ src/redis-server
아마도 소스코드로 redis를 설치하신 것 같습니다.source-code-path하고 --/을 실행하기 위해 위치를 sudo install_server.sh◦ 그가 시스템의 서비스로 합니다. 그 redis-server 시스템에 redis-server 가 redis-server 확인합니다 redis-server 실행되었는지 redis-server 서비스로 대한 redis-server 지휘 redis-server 후 redsudo service redis-server status
PS: 데비안/우분투 기반
우분투의 경우 redis-server가 설정되어 있지 않기 때문에 오류가 발생합니다.redis-server를 다시 설치한 다음 상태를 확인합니다.
오류가 없으면 다음과 같은 메시지가 표시됩니다:-
● redis-server.service - Advanced key-value storeLoaded: loaded(/lib/systemd/system/redis-server.service; 사용; 벤더 사전 설정: 사용)활성: 2018-01-17 수요일 20:07:27 IST 이후 활성(실행); 16s ago 문서: http://redis.io/documentation, man:redis-server(1) 메인 PID: 4327 (redis-server) CG그룹: /systemslice/redis-server.service └─4327 /usr/bin/redis-server 127.0.0.1:6379
redis 서버를 먼저 설치해야 합니다.
mac에 redis 서버를 설치할 수 있는 방법은 다음과 같습니다. -
$ curl -O http://download.redis.io/redis-stable.tar.gz
$ tar xzvf redis-stable.tar.gz
$ cd redis-stable
$ make
$ make test
$ sudo make install
$ redis-server
행운을 빌어요.
redis에 연결할 수 없습니다.redis 서버를 재시작한 다음 다음 다음 세 가지 명령을 실행하여 클라이언트를 다시 시작해 봅니다.
sudo service redis-server restart
redis-server
redis-cli
윈도우의 경우 이 문제를 해결했습니다.
사용...
let redisClient = createClient({
legacyMode: true ,
url: 'redis://redis:6379',
});
> redispersion > 4.0 에 합니다.
아래 이미지를 참고하시면 됩니다.

당신의 프로젝트가 윈도우에서 실행된다면,
- 창에서 redis-server를 설정하고 실행해야 합니다.
- 프로젝트에서 'npm imiredis'를 실행하면 올바르게 작동합니다.
노드를 최신 버전으로 업그레이드해 보십시오.
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
버전 0.4가 제대로 작동하지 않을 수 있습니다.
언급URL : https://stackoverflow.com/questions/8754304/redis-connection-to-127-0-0-16379-failed-connect-econnrefused
'codememo' 카테고리의 다른 글
| 폰트 어썸(Chrome) 경고: "청렴도 불일치", "적절한" 값, "요청 자격 증명이 일치하지 않음" (0) | 2023.09.20 |
|---|---|
| pthread mutex로 변수를 보호하면 캐시되지 않는 것이 보장됩니까? (0) | 2023.09.15 |
| Sequelize와 중첩 관계 (0) | 2023.09.15 |
| 아약스는 php에서 반환 값을 얻습니까? (0) | 2023.09.15 |
| 게시물 유형별 카테고리 구분 (0) | 2023.09.15 |