Failed listening on port 6379 (tcp), aborting.

Problem description: Redis has been installed on the Mac, and an error is suddenly reported when starting redis on the terminal: Could not create server TCP listening socket *:6379: bind: Address already in use , the error is shown in the following figure:

View Image


prompts me for the port address of 6379 (Redis default port) is occupied.

Solution:
1) Use ps -ef and grep commands to find and display the process in the Mac terminal. The command statement is as follows:

ps -ef | grep -i redis

The search result is shown in the figure below:
View Image

2) Find the PID of 65947, use the kill -9 command to forcibly kill the process, the command statement is as follows:

kill -9 65947

The operation is shown in the figure below:
View Image

3) Enter the redis directory and restart redis, the statement is as follows:

src/redis-server

The result is shown below:

View Image

설치 방법 Redis 사이트: http://redis.io/topics/quickstart

wget http://download.redis.io/redis-stable.tar.gz

tar xvzf redis-stable.tar.gz

cd redis-stable

make

  • 서버 시작: redis-server
  • 서버 확인: redis-cli ping => 응답 결과: PONG
  • 서버 정지: redis-cli shutdown

예제

1. command 창에 redis-server 명령어 실행

Failed listening on port 6379 (tcp), aborting.

2. 새로운 터미널 윈도우 창을 하나 연 뒤, redis 서버가 실행 중인지 확인 (redis-cli ping)

3. Redis 명령창으로 접속

4. get, set 명령어 실행

127.0.0.1:6379> set mykey "myvalue"

127.0.0.1:6379> get mykey

5. Redis-server 정지 (redis-cli shutdown)

127.0.0.1:6379> shutdown save

// 서버 스탑, 지금까지 내용 저장하지 않음

127.0.0.1:6379> shutdown nosave

  • Redis 연결되지 않은 커맨드 창에서 서버 종료

6. redis-server 실행중 에러

  • 서버 실행 중, redis-server 명령어를 실행한 경우

10773:C 27 May 13:29:32.080 # Warning: no config file specfied, using the default config. In order to specify a config file use redis-server /path/to/redis.conf

10773:M 27 May 13:29:32.082 * Increased maximum number of open files to 10032 (it was originally set to 256).

10773:M 27 May 13:29:32.082 # Creating Server TCP listening socket *:6379: bind: Address already in use

글뷰관련 태그목록

더보기

   Start up redis Times wrong

# Creating Server TCP listening socket *:6379: bind: Address already in use

The reason for the error

  6379 The address is already in use (6379 yes redis Default port )

resolvent

  • Use the command to find the process that occupies the port number :

   Get information like this

501 2267 1 0 3 119 ?? 8:17.40 redis-server *:6379
501 48677 48662 0 3:17 Afternoon ttys002 0:00.00 grep -i redis

Be accomplished

48678:C 24 Jan 15:18:20.870 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 48678:C 24 Jan 15:18:20.871 # Redis version=4.0.11, bits=64, commit=00000000, modified=0, pid=48678, just started 48678:C 24 Jan 15:18:20.871 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf 48678:M 24 Jan 15:18:20.873 * Increased maximum number of open files to 10032 (it was originally set to 256). _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 4.0.11 (00000000/0) 64 bit .-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in standalone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 48678 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | http://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-' 48678:M 24 Jan 15:18:20.889 # Server initialized 48678:M 24 Jan 15:18:31.003 * DB loaded from disk: 10.114 seconds

48678:M 24 Jan 15:18:31.003 * Ready to accept connections

Random recommendation

  1. BZOJ 3261: The greatest exclusive or and

    Description A sequence , Two operations are supported . 1. Add a number to the end of the sequence . 2. inquiry [l,r] China and x The maximum number of exclusive or values . \(n\leqslant 3*10^5\) Sol Be persistent Trie Trees ...

  2. splitFile2SmallFile

    1. split file into several files """ this is aa customizable version of the standard ...

  3. ( turn )spring boot annotation [email protected] Asynchronous call

    original text :http://www.cnblogs.com/azhqiang/p/5609615.html EnableAsync Annotation means that it can be executed asynchronously , It means to turn on multithreading . It can be marked in the method . Class . @Co ...

  4. http load The use of and parameter interpretation

    http load The use of and parameter interpretation   1. Parameter meaning Parameters      Full name      meaning -p        -parallel      Number of concurrent user processes .-f        -fetches   ...

  5. list Of add() Methods and addAll() Method introduction

    A brief description : Read other people's code every month , I found something interesting ,list One way ,addAll(), Then I went to Du Niang , I found this useful . Make complaints about it : Why didn't you find this method ? Because I usually write by myself list When , The base ...

  6. appium+python automation adb shell Key operation

    Preface Then the last Introduction input The key operation inside keyevent event , Send some key operations commonly used on mobile phones keyevent 1.keyevent Events have a corresponding table , You can send the corresponding number directly , You can also use strings , There are two ways ...

  7. Vue.js Related knowledge ( Animation )

    1. brief introduction Vue In the insert . Update or remove DOM when , Provide a variety of different ways of transition effects , And provide transition Component to achieve animation effects ( use transition The component will wrap the elements that need to perform the transition effect ) grammar :&l ...

  8. Basic knowledge points About prototype __proto__

    Basic knowledge points About prototype  __proto__ for js Novice reference JavaScript Some basic knowledge of : stay JavaScript in , All objects o All have a hidden prototype object ( stay Fire ...

  9. iOS 11 Development tutorial ( seventeen )iOS11 Use the button of application view to receive user input

    iOS 11 Development tutorial ( seventeen )iOS11 Use the button of application view to receive user input stay iOS Provides a lot of controls and views to enrich the user interface , For these views and controls, we did a brief introduction in the previous chapter . In this chapter we'll explain these views in detail . ...

  10. Centos7 Install coexistence version under Python

    I have a problem recently , The local environment has Python2   Installed apps depend on Python2, Can't replace the original system Python Environmental Science , But newly installed applications need to rely on Python3 Two different versions need to be installed Python, solve ...

ps-ef | grep redis Check whether the port is occupied then kill -15 pid perhaps kill -9 pid

redis-server[230033]: 230033:C 19 Mar 2022 11:14:19.860 # Fatal error, can't open config file '/usr/

redis-cli -h 127.0.0.1 -p 6379 -a " password " linux above Start client Report errors :

as a result of : Has not started   Server side

redis Relevant command :

redis-cli -h 127.0.0.1 -p 6379 -a " password " Start client (/usr/local/bin Client startup path ) The premise of starting is to start Server side

redis Start from the root directory of

(/usr/local/redis/redis-6.2.6

) :    Executed under the root directory Instructions   :   ./src/redis-server redis.conf

Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. Could not connect to Redis at 127.0.0.1:6379: Connection refused

I am trying to install redis, according to the instructions here : https://redis.io/download, but getting the error :

Creating Server TCP listening socket *:6379: bind: Address already in use

when I run command ps -ef|grep redis i see :

nomi 1168 947 0 2434 ? 00:00:00 grep --color=auto redis

I type kill 1168 where 1168 is my PID and the process is not killed:

"bash: kill: (1168) - No such process"

next time i run the command ps -ef|grep redis i get diffrent PID number for example : 1170

How can I remove this process?

7