You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@rocketmq.apache.org by Eason Chen <34...@qq.com> on 2017/08/31 03:56:29 UTC
回复: namesrv listen ip
thanks zhanhui , but usually listen on 0.0.0.0 is illegal , my purpose is to avoid it.
------------------ 原始邮件 ------------------
发件人: "Zhanhui Li";<li...@gmail.com>;
发送时间: 2017年8月31日(星期四) 中午11:44
收件人: "users"<us...@rocketmq.incubator.apache.org>;
主题: Re: namesrv listen ip
You question is: can name server bind to a configured IP address?
Short answer is: No.
The long answer is: name server binds to wild address and listens to the specified port number, aka, name server binds to 0.0.0.0 and accepts traffics from any interface.
Related code is
```java
ServerBootstrap childHandler =
this.serverBootstrap.group(this.eventLoopGroupBoss, this.eventLoopGroupSelector)
.channel(useEpoll() ? EpollServerSocketChannel.class : NioServerSocketChannel.class)
.option(ChannelOption.SO_BACKLOG, 1024)
.option(ChannelOption.SO_REUSEADDR, true)
.option(ChannelOption.SO_KEEPALIVE, false)
.childOption(ChannelOption.TCP_NODELAY, true)
.childOption(ChannelOption.SO_SNDBUF, nettyServerConfig.getServerSocketSndBufSize())
.childOption(ChannelOption.SO_RCVBUF, nettyServerConfig.getServerSocketRcvBufSize())
.localAddress(new InetSocketAddress(this.nettyServerConfig.getListenPort())) // <—This line answers your question.
.childHandler(new ChannelInitializer<SocketChannel>() {
@Override
public void initChannel(SocketChannel ch) throws Exception {
ch.pipeline().addLast(
defaultEventExecutorGroup,
new NettyEncoder(),
new NettyDecoder(),
new IdleStateHandler(0, 0, nettyServerConfig.getServerChannelMaxIdleTimeSeconds()),
new NettyConnectManageHandler(),
```
在 2017年8月30日,下午9:08,Eason Chen <34...@qq.com> 写道:
hi, guys
namesrv是否可以指定监听的ip?记得以前的版本是可以指定的?
谢谢
Re: namesrv listen ip
Posted by Zhanhui Li <li...@gmail.com>.
What do you mean by “illegal”? Note in most cases, Middleware is running in trust zone in terms of network. We are also developing and adding security features like SSL transportation, SASL authentication and authorization. Listens to a specified IP helps in a very limited way to make your cluster more secure.
> 在 2017年8月31日,上午11:56,Eason Chen <34...@qq.com> 写道:
>
> thanks zhanhui , but usually listen on 0.0.0.0 is illegal , my purpose is to avoid it.
>
>
> ------------------ 原始邮件 ------------------
> 发件人: "Zhanhui Li";<li...@gmail.com>;
> 发送时间: 2017年8月31日(星期四) 中午11:44
> 收件人: "users"<us...@rocketmq.incubator.apache.org>;
> 主题: Re: namesrv listen ip
>
> You question is: can name server bind to a configured IP address?
>
> Short answer is: No.
>
> The long answer is: name server binds to wild address and listens to the specified port number, aka, name server binds to 0.0.0.0 and accepts traffics from any interface.
>
> Related code is
>
> ```java
>
> ServerBootstrap childHandler =
> this.serverBootstrap.group(this.eventLoopGroupBoss, this.eventLoopGroupSelector)
> .channel(useEpoll() ? EpollServerSocketChannel.class : NioServerSocketChannel.class)
> .option(ChannelOption.SO_BACKLOG, 1024)
> .option(ChannelOption.SO_REUSEADDR, true)
> .option(ChannelOption.SO_KEEPALIVE, false)
> .childOption(ChannelOption.TCP_NODELAY, true)
> .childOption(ChannelOption.SO_SNDBUF, nettyServerConfig.getServerSocketSndBufSize())
> .childOption(ChannelOption.SO_RCVBUF, nettyServerConfig.getServerSocketRcvBufSize())
> .localAddress(new InetSocketAddress(this.nettyServerConfig.getListenPort())) // <—This line answers your question.
> .childHandler(new ChannelInitializer<SocketChannel>() {
> @Override
> public void initChannel(SocketChannel ch) throws Exception {
> ch.pipeline().addLast(
> defaultEventExecutorGroup,
> new NettyEncoder(),
> new NettyDecoder(),
> new IdleStateHandler(0, 0, nettyServerConfig.getServerChannelMaxIdleTimeSeconds()),
> new NettyConnectManageHandler(),
>
>
>
> ```
>
>
>
>> 在 2017年8月30日,下午9:08,Eason Chen <342407712@qq.com <ma...@qq.com>> 写道:
>>
>> hi, guys
>>
>> namesrv是否可以指定监听的ip?记得以前的版本是可以指定的?
>>
>> 谢谢
>