Neo4j启动失败ERROR Failed to start Neo4j on localhost:7474.java.lang.RuntimeException: Error starting N

文章描述了用户在尝试启动Neo4j服务器时遇到的错误,原因是端口被占用。文章提供了查找和解决问题的方法,即检查并杀死占用7474端口的进程,确保Neo4j服务成功启动。
摘要由CSDN通过智能技术生成

错误信息:

(base) usr@MacBook-Air ~ % sudo neo4j console
Password:
Directories in use:
home:         /opt/homebrew/Cellar/neo4j/5.18.1/libexec
config:       /opt/homebrew/Cellar/neo4j/5.18.1/libexec/conf
logs:         /opt/homebrew/var/log/neo4j
plugins:      /opt/homebrew/Cellar/neo4j/5.18.1/libexec/plugins
import:       /opt/homebrew/Cellar/neo4j/5.18.1/libexec/import
data:         /opt/homebrew/var/neo4j/data
certificates: /opt/homebrew/Cellar/neo4j/5.18.1/libexec/certificates
licenses:     /opt/homebrew/Cellar/neo4j/5.18.1/libexec/licenses
run:          /opt/homebrew/Cellar/neo4j/5.18.1/libexec/run
Starting Neo4j.
2024-03-24 06:18:20.098+0000 INFO  Logging config in use: File '/opt/homebrew/Cellar/neo4j/5.18.1/libexec/conf/user-logs.xml'
2024-03-24 06:18:20.104+0000 INFO  Starting...
2024-03-24 06:18:21.167+0000 INFO  This instance is ServerId{38d38472} (38d38472-ceec-4589-bbf6-88df46eb87a2)
2024-03-24 06:18:21.516+0000 INFO  ======== Neo4j 5.18.1 ========
2024-03-24 06:18:28.567+0000 ERROR Failed to start Neo4j on localhost:7474.
java.lang.RuntimeException: Error starting Neo4j database server at /opt/homebrew/var/neo4j/data/databases
	at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.startDatabaseServer(DatabaseManagementServiceFactory.java:276) ~[neo4j-5.18.1.jar:5.18.1]
	at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.build(DatabaseManagementServiceFactory.java:211) ~[neo4j-5.18.1.jar:5.18.1]
	at org.neo4j.server.CommunityBootstrapper.createNeo(CommunityBootstrapper.java:38) ~[neo4j-5.18.1.jar:5.18.1]
	at org.neo4j.server.NeoBootstrapper.start(NeoBootstrapper.java:184) [neo4j-5.18.1.jar:5.18.1]
	at org.neo4j.server.NeoBootstrapper.start(NeoBootstrapper.java:99) [neo4j-5.18.1.jar:5.18.1]
	at org.neo4j.server.CommunityEntryPoint.main(CommunityEntryPoint.java:30) [neo4j-5.18.1.jar:5.18.1]
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.bolt.protocol.common.connector.netty.SocketNettyConnector@1a06ec24' was successfully initialized, but failed to start. Please see the attached cause exception "bind(..) failed: Address already in use".
	at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:364) ~[neo4j-common-5.18.1.jar:5.18.1]
	at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:91) ~[neo4j-common-5.18.1.jar:5.18.1]
	at org.neo4j.bolt.BoltServer.start(BoltServer.java:354) ~[neo4j-bolt-5.18.1.jar:5.18.1]
	at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:347) ~[neo4j-common-5.18.1.jar:5.18.1]
	at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:91) ~[neo4j-common-5.18.1.jar:5.18.1]
	at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.startDatabaseServer(DatabaseManagementServiceFactory.java:267) ~[neo4j-5.18.1.jar:5.18.1]
	... 5 more
Caused by: org.neo4j.configuration.helpers.PortBindException: An error occurred while trying to bind to the socket localhost/127.0.0.1:7687
	at org.neo4j.bolt.protocol.common.connector.netty.AbstractNettyConnector.start(AbstractNettyConnector.java:199) ~[neo4j-bolt-5.18.1.jar:5.18.1]
	at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:347) ~[neo4j-common-5.18.1.jar:5.18.1]
	at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:91) ~[neo4j-common-5.18.1.jar:5.18.1]
	at org.neo4j.bolt.BoltServer.start(BoltServer.java:354) ~[neo4j-bolt-5.18.1.jar:5.18.1]
	at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:347) ~[neo4j-common-5.18.1.jar:5.18.1]
	at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:91) ~[neo4j-common-5.18.1.jar:5.18.1]
	at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.startDatabaseServer(DatabaseManagementServiceFactory.java:267) ~[neo4j-5.18.1.jar:5.18.1]
	... 5 more
Caused by: io.netty.channel.unix.Errors$NativeIoException: bind(..) failed: Address already in use
2024-03-24 06:18:28.570+0000 INFO  Neo4j Server shutdown initiated by request
2024-03-24 06:18:28.571+0000 INFO  Stopped.
Neo4j web server failed to start. See log for more info.
Run with '--verbose' for a more detailed error message.

解决办法:

找了很多国内外的经验贴,有说权限不够加sudo的,也有说把/labs目录下的apoc-5.18.1-core.jar移动到/plugins目录下的(Facing Issue while installing 5.15 apoc - Desktop - Neo4j Online Community),但对我来说都没有用

最终的原因是端口7474已经有一个进程在运行了,把这个进程kill掉就可以了(Database failed to start, exited with status 'KILLED" - `Caused by: ... bind(..) failed: Address already in use` - Desktop - Neo4j Online Community

(base) usr@MacBook-Air ~ % lsof -i :7474
COMMAND     PID    USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
Code\x20H 67013 usr  118u  IPv4 0x88e6dff3e36ec84b      0t0  TCP localhost:7474 (LISTEN)
(base) usr@MacBook-Air ~ % kill 67013 
(base) usr@MacBook-Air ~ % lsof -i :7474
(base) usr@MacBook-Air ~ % sudo neo4j console
Directories in use:
home:         /opt/homebrew/Cellar/neo4j/5.18.1/libexec
config:       /opt/homebrew/Cellar/neo4j/5.18.1/libexec/conf
logs:         /opt/homebrew/var/log/neo4j
plugins:      /opt/homebrew/Cellar/neo4j/5.18.1/libexec/plugins
import:       /opt/homebrew/Cellar/neo4j/5.18.1/libexec/import
data:         /opt/homebrew/var/neo4j/data
certificates: /opt/homebrew/Cellar/neo4j/5.18.1/libexec/certificates
licenses:     /opt/homebrew/Cellar/neo4j/5.18.1/libexec/licenses
run:          /opt/homebrew/Cellar/neo4j/5.18.1/libexec/run
Starting Neo4j.
2024-03-24 06:22:05.901+0000 INFO  Logging config in use: File '/opt/homebrew/Cellar/neo4j/5.18.1/libexec/conf/user-logs.xml'
2024-03-24 06:22:05.907+0000 INFO  Starting...
2024-03-24 06:22:06.760+0000 INFO  This instance is ServerId{38d38472} (38d38472-ceec-4589-bbf6-88df46eb87a2)
2024-03-24 06:22:07.114+0000 INFO  ======== Neo4j 5.18.1 ========
2024-03-24 06:22:08.446+0000 INFO  Bolt enabled on localhost:7687.
2024-03-24 06:22:08.784+0000 INFO  HTTP enabled on localhost:7474.
2024-03-24 06:22:08.784+0000 INFO  Remote interface available at http://localhost:7474/
2024-03-24 06:22:08.785+0000 INFO  id: 1E401ADFCA86EEFC56F543E68E9D9A6BF22C149E054843C74785E1CCA20E57DF
2024-03-24 06:22:08.785+0000 INFO  name: system
2024-03-24 06:22:08.785+0000 INFO  creationDate: 2024-03-24T04:31:41.977Z
2024-03-24 06:22:08.785+0000 INFO  Started.

顺利启动

  • 5
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值