spring cloud gateway 启动报错,Failed to bind on [0.0.0.0:xxx] bind(..) failed: 权限不够

最近把操作系统迁移到了deepin,不得不说Linux中需要学习的还是有很多的,本地启动网关的时候就遇到一个坑,特此记录一下,报错信息。

Caused by: reactor.netty.ChannelBindException: Failed to bind on [0.0.0.0:188]
	Suppressed: java.lang.Exception: #block terminated with an error
		at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:133) ~[reactor-core-3.2.19.RELEASE.jar:3.2.19.RELEASE]
		at reactor.core.publisher.Mono.block(Mono.java:1531) ~[reactor-core-3.2.19.RELEASE.jar:3.2.19.RELEASE]
		at reactor.netty.http.server.HttpServer.bindNow(HttpServer.java:128) ~[reactor-netty-0.8.20.RELEASE.jar:0.8.20.RELEASE]
		at reactor.netty.http.server.HttpServer.bindNow(HttpServer.java:111) ~[reactor-netty-0.8.20.RELEASE.jar:0.8.20.RELEASE]
		at org.springframework.boot.web.embedded.netty.NettyWebServer.startHttpServer(NettyWebServer.java:102) ~[spring-boot-2.1.16.RELEASE.jar:2.1.16.RELEASE]
		at org.springframework.boot.web.embedded.netty.NettyWebServer.start(NettyWebServer.java:73) ~[spring-boot-2.1.16.RELEASE.jar:2.1.16.RELEASE]
		at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext$ServerManager.start(ReactiveWebServerApplicationContext.java:223) ~[spring-boot-2.1.16.RELEASE.jar:2.1.16.RELEASE]
		at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.startReactiveWebServer(ReactiveWebServerApplicationContext.java:124) ~[spring-boot-2.1.16.RELEASE.jar:2.1.16.RELEASE]
		at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.finishRefresh(ReactiveWebServerApplicationContext.java:116) ~[spring-boot-2.1.16.RELEASE.jar:2.1.16.RELEASE]
		at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553) ~[spring-context-5.1.17.RELEASE.jar:5.1.17.RELEASE]
		at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:66) ~[spring-boot-2.1.16.RELEASE.jar:2.1.16.RELEASE]
		at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) ~[spring-boot-2.1.16.RELEASE.jar:2.1.16.RELEASE]
		at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) ~[spring-boot-2.1.16.RELEASE.jar:2.1.16.RELEASE]
		at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-2.1.16.RELEASE.jar:2.1.16.RELEASE]
		at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) [spring-boot-2.1.16.RELEASE.jar:2.1.16.RELEASE]
		at org.muyuan.core.launch.MuyuanApplication.run(MuyuanApplication.java:35) [muyuan-core-launch-2.6.0.RELEASE.jar:na]
		at org.muyuan.gateway.GateWayApplication.main(GateWayApplication.java:18) [classes/:na]
Caused by: io.netty.channel.unix.Errors$NativeIoException: bind(..) failed: 权限不够

注意关键信息bind 188端口提示,权限不够。原来是Linux下1024以下的端口需要sudo,通过修改端口就可以正常启动了。

或者这样来授权你的可执行路径

setcap cap_net_bind_service=+eip /home/tengine/nginx/tengine/sbin/nginx

清除授权

setcap -r nginx
  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

星光Starsray

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值