mirror of
https://gitee.com/wujiawei1207537021/wu-lazy-cloud-network.git
synced 2025-06-03 03:47:55 +08:00
【fix】 优化使用 EventLoopGroup bossGroup = EventLoopGroupFactory.createBossGroup();
EventLoopGroup workerGroup = EventLoopGroupFactory.createWorkerGroup();
This commit is contained in:
parent
cf10347939
commit
2389a25e11
@ -438,21 +438,10 @@ data:
|
||||
skip-name-resolve
|
||||
|
||||
max_connections=100
|
||||
|
||||
thread_cache_size=10
|
||||
|
||||
innodb_buffer_pool_chunk_size=64M #效果不明显
|
||||
innodb_buffer_pool_size=64M #效果不明显
|
||||
|
||||
lower_case_table_names=0
|
||||
|
||||
table_open_cache=64
|
||||
|
||||
query_cache_type=0
|
||||
|
||||
query_cache_size=0
|
||||
|
||||
key_buffer_size=0
|
||||
|
||||
default-time-zone='+08:00'
|
||||
|
||||
@ -461,15 +450,40 @@ data:
|
||||
log_timestamps='SYSTEM'
|
||||
|
||||
performance_schema_max_table_instances=400 #设置效果不明显
|
||||
table_definition_cache=400
|
||||
|
||||
performance_schema=off #效果明显
|
||||
|
||||
table_definition_cache=400
|
||||
|
||||
slow_query_log=ON
|
||||
|
||||
|
||||
binlog_expire_logs_seconds = 2
|
||||
|
||||
innodb_flush_log_at_trx_commit=2
|
||||
|
||||
group_concat_max_len=512
|
||||
|
||||
# 全局参数
|
||||
|
||||
innodb_buffer_pool_size = 20M
|
||||
|
||||
innodb_buffer_pool_chunk_size=20M #效果不明显
|
||||
|
||||
key_buffer_size = 1M
|
||||
|
||||
# 排序和连接参数
|
||||
|
||||
sort_buffer_size = 256K
|
||||
|
||||
join_buffer_size = 256K
|
||||
|
||||
# 线程缓存参数
|
||||
|
||||
thread_cache_size = 4
|
||||
|
||||
# 日志参数
|
||||
|
||||
innodb_log_file_size = 5M
|
||||
|
||||
innodb_log_buffer_size = 1M
|
||||
|
||||
|
@ -55,10 +55,10 @@ public class ClientHandleTcpDistributeClientPermeateClientInitTypeAdvanced exten
|
||||
.builderClientTargetIp(clientTargetIp)
|
||||
.builderClientTargetPort(clientTargetPort)
|
||||
.builderVisitorPort(visitorPort)
|
||||
.builderNettyClientProperties(nettyClientProperties)
|
||||
// .builderChannelFlowAdapter(channelFlowAdapter)
|
||||
.builderNettyClientProperties(nettyClientProperties)
|
||||
//.builderChannelFlowAdapter(channelFlowAdapter)
|
||||
.builderToClientId(toClientId)
|
||||
.builderHandleChannelTypeAdvancedList(handleChannelTypeAdvancedList)
|
||||
.builderHandleChannelTypeAdvancedList(handleChannelTypeAdvancedList)
|
||||
|
||||
.build();
|
||||
try {
|
||||
|
@ -13,11 +13,13 @@ import org.framework.lazy.cloud.network.heartbeat.common.NettyClientVisitorConte
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyVisitorPortContext;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelFlowAdapter;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.factory.EventLoopGroupFactory;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.socket.PermeateVisitorSocket;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 内网穿透 客户端渗透客户端通道
|
||||
*
|
||||
@ -26,8 +28,6 @@ import java.util.List;
|
||||
*/
|
||||
@Slf4j
|
||||
public class NettyTcpClientPermeateClientVisitorSocket implements PermeateVisitorSocket {
|
||||
private final EventLoopGroup bossGroup = new NioEventLoopGroup();
|
||||
private final EventLoopGroup workerGroup = new NioEventLoopGroup();
|
||||
private final NettyTcpClientPermeateClientVisitorFilter nettyTcpClientPermeateClientVisitorFilter;
|
||||
@Getter
|
||||
private final String clientId;
|
||||
@ -50,6 +50,9 @@ public class NettyTcpClientPermeateClientVisitorSocket implements PermeateVisito
|
||||
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
||||
if (visitor == null) {
|
||||
ServerBootstrap bootstrap = new ServerBootstrap();
|
||||
|
||||
EventLoopGroup bossGroup = EventLoopGroupFactory.createBossGroup();
|
||||
EventLoopGroup workerGroup = EventLoopGroupFactory.createWorkerGroup();
|
||||
bootstrap
|
||||
.group(bossGroup, workerGroup)
|
||||
.channel(NioServerSocketChannel.class)
|
||||
@ -94,12 +97,6 @@ public class NettyTcpClientPermeateClientVisitorSocket implements PermeateVisito
|
||||
}
|
||||
@Override
|
||||
public void close() {
|
||||
if (!bossGroup.isShutdown()) {
|
||||
bossGroup.shutdownGracefully();
|
||||
}
|
||||
if (!workerGroup.isShutdown()) {
|
||||
workerGroup.shutdownGracefully();
|
||||
}
|
||||
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
||||
if (visitor != null) {
|
||||
|
||||
|
@ -12,6 +12,7 @@ import org.framework.lazy.cloud.network.heartbeat.client.netty.tcp.filter.NettyT
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyClientVisitorContext;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyVisitorPortContext;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.factory.EventLoopGroupFactory;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.socket.PermeateVisitorSocket;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
|
||||
@ -25,8 +26,7 @@ import java.util.List;
|
||||
*/
|
||||
@Slf4j
|
||||
public class NettyTcpClientPermeateServerVisitorSocket implements PermeateVisitorSocket {
|
||||
private final EventLoopGroup bossGroup = new NioEventLoopGroup();
|
||||
private final EventLoopGroup workerGroup = new NioEventLoopGroup();
|
||||
|
||||
private final NettyTcpClientPermeateServerVisitorFilter nettyTcpClientPermeateServerVisitorFilter;
|
||||
@Getter
|
||||
private final String clientId;
|
||||
@ -49,6 +49,8 @@ public class NettyTcpClientPermeateServerVisitorSocket implements PermeateVisito
|
||||
PermeateVisitorSocket visitor = NettyVisitorPortContext.getVisitorSocket(visitorPort);
|
||||
if (visitor == null) {
|
||||
ServerBootstrap bootstrap = new ServerBootstrap();
|
||||
EventLoopGroup bossGroup = EventLoopGroupFactory.createBossGroup();
|
||||
EventLoopGroup workerGroup = EventLoopGroupFactory.createWorkerGroup();
|
||||
bootstrap
|
||||
.group(bossGroup, workerGroup)
|
||||
.channel(NioServerSocketChannel.class)
|
||||
@ -91,12 +93,6 @@ public class NettyTcpClientPermeateServerVisitorSocket implements PermeateVisito
|
||||
}
|
||||
@Override
|
||||
public void close() {
|
||||
if (!bossGroup.isShutdown()) {
|
||||
bossGroup.shutdownGracefully();
|
||||
}
|
||||
if (!workerGroup.isShutdown()) {
|
||||
workerGroup.shutdownGracefully();
|
||||
}
|
||||
PermeateVisitorSocket permeateVisitorSocket = NettyVisitorPortContext.getVisitorSocket(visitorPort);
|
||||
if (permeateVisitorSocket != null) {
|
||||
log.warn("关闭客户端 :【{}】 访客户端口:【{}】", clientId, visitorPort);
|
||||
|
@ -13,6 +13,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.NettyClientVisitorConte
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyVisitorPortContext;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelFlowAdapter;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.factory.EventLoopGroupFactory;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.socket.PermeateVisitorSocket;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
|
||||
@ -26,8 +27,6 @@ import java.util.List;
|
||||
*/
|
||||
@Slf4j
|
||||
public class NettyUdpClientPermeateClientVisitorSocket implements PermeateVisitorSocket {
|
||||
private final EventLoopGroup bossGroup = new NioEventLoopGroup();
|
||||
private final EventLoopGroup workerGroup = new NioEventLoopGroup();
|
||||
private final NettyUdpClientPermeateClientVisitorFilter nettyUdpClientPermeateClientVisitorFilter;
|
||||
@Getter
|
||||
private final String clientId;
|
||||
@ -50,6 +49,8 @@ public class NettyUdpClientPermeateClientVisitorSocket implements PermeateVisito
|
||||
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
||||
if (visitor == null) {
|
||||
ServerBootstrap bootstrap = new ServerBootstrap();
|
||||
EventLoopGroup bossGroup = EventLoopGroupFactory.createBossGroup();
|
||||
EventLoopGroup workerGroup = EventLoopGroupFactory.createWorkerGroup();
|
||||
bootstrap
|
||||
.group(bossGroup, workerGroup)
|
||||
.channel(NioServerSocketChannel.class)
|
||||
@ -94,12 +95,7 @@ public class NettyUdpClientPermeateClientVisitorSocket implements PermeateVisito
|
||||
}
|
||||
@Override
|
||||
public void close() {
|
||||
if (!bossGroup.isShutdown()) {
|
||||
bossGroup.shutdownGracefully();
|
||||
}
|
||||
if (!workerGroup.isShutdown()) {
|
||||
workerGroup.shutdownGracefully();
|
||||
}
|
||||
|
||||
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
||||
if (visitor != null) {
|
||||
|
||||
|
@ -12,6 +12,7 @@ import org.framework.lazy.cloud.network.heartbeat.client.netty.udp.filter.NettyU
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyClientVisitorContext;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyVisitorPortContext;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.factory.EventLoopGroupFactory;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.socket.PermeateVisitorSocket;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
|
||||
@ -25,8 +26,7 @@ import java.util.List;
|
||||
*/
|
||||
@Slf4j
|
||||
public class NettyUdpClientPermeateServerVisitorSocket implements PermeateVisitorSocket {
|
||||
private final EventLoopGroup bossGroup = new NioEventLoopGroup();
|
||||
private final EventLoopGroup workerGroup = new NioEventLoopGroup();
|
||||
|
||||
private final NettyUdpClientPermeateServerVisitorFilter nettyUdpClientPermeateServerVisitorFilter;
|
||||
@Getter
|
||||
private final String clientId;
|
||||
@ -49,6 +49,8 @@ public class NettyUdpClientPermeateServerVisitorSocket implements PermeateVisito
|
||||
PermeateVisitorSocket visitor = NettyVisitorPortContext.getVisitorSocket(visitorPort);
|
||||
if (visitor == null) {
|
||||
ServerBootstrap bootstrap = new ServerBootstrap();
|
||||
EventLoopGroup bossGroup = EventLoopGroupFactory.createBossGroup();
|
||||
EventLoopGroup workerGroup = EventLoopGroupFactory.createWorkerGroup();
|
||||
bootstrap
|
||||
.group(bossGroup, workerGroup)
|
||||
.channel(NioServerSocketChannel.class)
|
||||
@ -91,12 +93,7 @@ public class NettyUdpClientPermeateServerVisitorSocket implements PermeateVisito
|
||||
}
|
||||
@Override
|
||||
public void close() {
|
||||
if (!bossGroup.isShutdown()) {
|
||||
bossGroup.shutdownGracefully();
|
||||
}
|
||||
if (!workerGroup.isShutdown()) {
|
||||
workerGroup.shutdownGracefully();
|
||||
}
|
||||
|
||||
PermeateVisitorSocket permeateVisitorSocket = NettyVisitorPortContext.getVisitorSocket(visitorPort);
|
||||
if (permeateVisitorSocket != null) {
|
||||
log.warn("关闭客户端 :【{}】 访客户端口:【{}】", clientId, visitorPort);
|
||||
|
@ -1,3 +1,3 @@
|
||||
org.framework.lazy.cloud.network.heartbeat.client.EnableClientAutoConfiguration
|
||||
org.framework.lazy.cloud.network.heartbeat.client.config.NettyClientProperties
|
||||
org.framework.lazy.cloud.network.heartbeat.client.config.ClientAutoConfiguration
|
||||
org.framework.lazy.cloud.network.heartbeat.client.config.ClientAutoConfiguration
|
@ -0,0 +1,21 @@
|
||||
package org.framework.lazy.cloud.network.heartbeat.common.factory;
|
||||
|
||||
import io.netty.channel.EventLoopGroup;
|
||||
import io.netty.channel.nio.NioEventLoopGroup;
|
||||
|
||||
public class EventLoopGroupFactory {
|
||||
|
||||
private static final EventLoopGroup bossGroup = new NioEventLoopGroup();
|
||||
private static final EventLoopGroup workerGroup = new NioEventLoopGroup();
|
||||
|
||||
|
||||
public static EventLoopGroup createBossGroup(){
|
||||
return bossGroup;
|
||||
}
|
||||
|
||||
public static EventLoopGroup createWorkerGroup(){
|
||||
return workerGroup;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -10,6 +10,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.InternalNetworkPenetrat
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyClientVisitorContext;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyVisitorPortContext;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelFlowAdapter;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.factory.EventLoopGroupFactory;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.socket.PermeateVisitorSocket;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.tcp.filter.NettyTcpServerPermeateClientVisitorFilter;
|
||||
|
||||
@ -21,8 +22,7 @@ import org.framework.lazy.cloud.network.heartbeat.server.netty.tcp.filter.NettyT
|
||||
*/
|
||||
@Slf4j
|
||||
public class NettyTcpServerPermeateClientVisitorSocket implements PermeateVisitorSocket {
|
||||
private final EventLoopGroup bossGroup = new NioEventLoopGroup();
|
||||
private final EventLoopGroup workerGroup = new NioEventLoopGroup();
|
||||
|
||||
private final NettyTcpServerPermeateClientVisitorFilter nettyTcpServerPermeateClientVisitorFilter;
|
||||
@Getter
|
||||
private final String clientId;
|
||||
@ -46,6 +46,8 @@ public class NettyTcpServerPermeateClientVisitorSocket implements PermeateVisito
|
||||
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
||||
if (visitor == null) {
|
||||
ServerBootstrap bootstrap = new ServerBootstrap();
|
||||
EventLoopGroup bossGroup = EventLoopGroupFactory.createBossGroup();
|
||||
EventLoopGroup workerGroup = EventLoopGroupFactory.createWorkerGroup();
|
||||
bootstrap
|
||||
.group(bossGroup, workerGroup)
|
||||
.channel(NioServerSocketChannel.class)
|
||||
@ -89,12 +91,6 @@ public class NettyTcpServerPermeateClientVisitorSocket implements PermeateVisito
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
if (!bossGroup.isShutdown()) {
|
||||
bossGroup.shutdownGracefully();
|
||||
}
|
||||
if (!workerGroup.isShutdown()) {
|
||||
workerGroup.shutdownGracefully();
|
||||
}
|
||||
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
||||
if (visitor != null) {
|
||||
|
||||
|
@ -11,6 +11,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.InternalNetworkServerPe
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyServerPermeateServerVisitorContext;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyVisitorPortContext;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelFlowAdapter;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.factory.EventLoopGroupFactory;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.tcp.filter.NettyTcpServerPermeateServerVisitorFilter;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -20,8 +21,6 @@ import java.io.IOException;
|
||||
*/
|
||||
@Slf4j
|
||||
public class NettyTcpServerPermeateServerConnectVisitorSocket {
|
||||
private final EventLoopGroup bossGroup = new NioEventLoopGroup();
|
||||
private final EventLoopGroup workerGroup = new NioEventLoopGroup();
|
||||
private final NettyTcpServerPermeateServerVisitorFilter nettyTcpServerPermeateServerVisitorFilter;
|
||||
|
||||
@Getter
|
||||
@ -45,6 +44,8 @@ public class NettyTcpServerPermeateServerConnectVisitorSocket {
|
||||
NettyTcpServerPermeateServerConnectVisitorSocket nettyTcpServerPermeateServerConnectVisitorSocket = NettyServerPermeateServerVisitorContext.getServerPermeateServerVisitorSocket(visitorPort);
|
||||
if (nettyTcpServerPermeateServerConnectVisitorSocket == null) {
|
||||
ServerBootstrap bootstrap = new ServerBootstrap();
|
||||
EventLoopGroup bossGroup = EventLoopGroupFactory.createBossGroup();
|
||||
EventLoopGroup workerGroup = EventLoopGroupFactory.createWorkerGroup();
|
||||
bootstrap
|
||||
.group(bossGroup, workerGroup)
|
||||
.channel(NioServerSocketChannel.class)
|
||||
@ -83,12 +84,6 @@ public class NettyTcpServerPermeateServerConnectVisitorSocket {
|
||||
}
|
||||
|
||||
public void close() throws IOException, InterruptedException {
|
||||
if (!bossGroup.isShutdown()) {
|
||||
bossGroup.shutdownGracefully();
|
||||
}
|
||||
if (!workerGroup.isShutdown()) {
|
||||
workerGroup.shutdownGracefully();
|
||||
}
|
||||
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
||||
if (visitor != null) {
|
||||
// close channel
|
||||
|
@ -10,6 +10,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.InternalNetworkPenetrat
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyClientVisitorContext;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyVisitorPortContext;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelFlowAdapter;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.factory.EventLoopGroupFactory;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.socket.PermeateVisitorSocket;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.udp.filter.NettyUdpServerPermeateClientVisitorFilter;
|
||||
|
||||
@ -21,8 +22,7 @@ import org.framework.lazy.cloud.network.heartbeat.server.netty.udp.filter.NettyU
|
||||
*/
|
||||
@Slf4j
|
||||
public class NettyUdpServerPermeateClientVisitorSocket implements PermeateVisitorSocket {
|
||||
private final EventLoopGroup bossGroup = new NioEventLoopGroup();
|
||||
private final EventLoopGroup workerGroup = new NioEventLoopGroup();
|
||||
|
||||
private final NettyUdpServerPermeateClientVisitorFilter nettyUdpServerPermeateClientVisitorFilter;
|
||||
@Getter
|
||||
private final String clientId;
|
||||
@ -46,6 +46,8 @@ public class NettyUdpServerPermeateClientVisitorSocket implements PermeateVisito
|
||||
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
||||
if (visitor == null) {
|
||||
ServerBootstrap bootstrap = new ServerBootstrap();
|
||||
EventLoopGroup bossGroup = EventLoopGroupFactory.createBossGroup();
|
||||
EventLoopGroup workerGroup = EventLoopGroupFactory.createWorkerGroup();
|
||||
bootstrap
|
||||
.group(bossGroup, workerGroup)
|
||||
.channel(NioServerSocketChannel.class)
|
||||
@ -89,12 +91,6 @@ public class NettyUdpServerPermeateClientVisitorSocket implements PermeateVisito
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
if (!bossGroup.isShutdown()) {
|
||||
bossGroup.shutdownGracefully();
|
||||
}
|
||||
if (!workerGroup.isShutdown()) {
|
||||
workerGroup.shutdownGracefully();
|
||||
}
|
||||
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
||||
if (visitor != null) {
|
||||
|
||||
|
@ -11,6 +11,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.InternalNetworkServerPe
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyServerPermeateServerVisitorContext;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyVisitorPortContext;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelFlowAdapter;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.factory.EventLoopGroupFactory;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.udp.filter.NettyUdpServerPermeateServerVisitorFilter;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -20,8 +21,6 @@ import java.io.IOException;
|
||||
*/
|
||||
@Slf4j
|
||||
public class NettyUdpServerPermeateServerConnectVisitorSocket {
|
||||
private final EventLoopGroup bossGroup = new NioEventLoopGroup();
|
||||
private final EventLoopGroup workerGroup = new NioEventLoopGroup();
|
||||
private final NettyUdpServerPermeateServerVisitorFilter nettyUdpServerPermeateServerVisitorFilter;
|
||||
|
||||
@Getter
|
||||
@ -45,6 +44,8 @@ public class NettyUdpServerPermeateServerConnectVisitorSocket {
|
||||
NettyUdpServerPermeateServerConnectVisitorSocket nettyUdpServerPermeateServerConnectVisitorSocket = NettyServerPermeateServerVisitorContext.getServerPermeateServerVisitorSocket(visitorPort);
|
||||
if (nettyUdpServerPermeateServerConnectVisitorSocket == null) {
|
||||
ServerBootstrap bootstrap = new ServerBootstrap();
|
||||
EventLoopGroup bossGroup = EventLoopGroupFactory.createBossGroup();
|
||||
EventLoopGroup workerGroup = EventLoopGroupFactory.createWorkerGroup();
|
||||
bootstrap
|
||||
.group(bossGroup, workerGroup)
|
||||
.channel(NioServerSocketChannel.class)
|
||||
@ -83,12 +84,6 @@ public class NettyUdpServerPermeateServerConnectVisitorSocket {
|
||||
}
|
||||
|
||||
public void close() throws IOException, InterruptedException {
|
||||
if (!bossGroup.isShutdown()) {
|
||||
bossGroup.shutdownGracefully();
|
||||
}
|
||||
if (!workerGroup.isShutdown()) {
|
||||
workerGroup.shutdownGracefully();
|
||||
}
|
||||
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
||||
if (visitor != null) {
|
||||
// close channel
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
|
||||
```shell
|
||||
mvn -Pnative -DskipTests clean package native:compile
|
||||
mvn -Pnative -DskipTests clean package native:compile
|
||||
```
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ docker run -d -it --privileged --name client -p 6004:6004 registry.cn-hangzhou.a
|
||||
```
|
||||
|
||||
```shell
|
||||
docker run -d -it --privileged --name client --restart=always -e spring.lazy.netty.client.inet-host=124.222.48.62 -e spring.lazy.netty.client.inet-port=30676 -e spring.lazy.netty.client.client-id="ziguang" registry.cn-hangzhou.aliyuncs.com/wu-lazy/wu-lazy-cloud-heartbeat-client-start:1.2.8-JDK17-NATIVE-SNAPSHOT
|
||||
docker run -d -it --privileged --name windows-client --restart=always -e spring.lazy.netty.client.inet-host=124.222.152.160 -e spring.lazy.netty.client.inet-port=30560 -e spring.lazy.netty.client.client-id="windows-11" registry.cn-hangzhou.aliyuncs.com/wu-lazy/wu-lazy-cloud-heartbeat-client-start:1.3.0-JDK17-SNAPSHOT
|
||||
```
|
||||
|
||||
```yaml
|
||||
|
@ -22,6 +22,11 @@
|
||||
<groupId>top.wu2020</groupId>
|
||||
<artifactId>wu-lazy-cloud-heartbeat-client</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.33</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
@ -4,10 +4,10 @@ spring:
|
||||
client:
|
||||
# inet-host: 124.222.48.62
|
||||
# inet-port: 30676
|
||||
# inet-host: 124.222.48.62
|
||||
# inet-port: 30560
|
||||
inet-host: 127.0.0.1
|
||||
inet-port: 7001
|
||||
inet-host: 124.222.152.160
|
||||
inet-port: 30560
|
||||
# inet-host: 192.168.2.105
|
||||
# inet-port: 7001
|
||||
inet-path: wu-lazy-cloud-heartbeat-server
|
||||
client-id: wujiawei # 客户端ID
|
||||
app-key: key
|
||||
@ -18,6 +18,8 @@ spring:
|
||||
# # inet-path: wu-lazy-cloud-heartbeat-server
|
||||
# client-id: shuhan # 客户端ID
|
||||
# client-id: temp_id # 客户端ID
|
||||
---
|
||||
spring:
|
||||
data:
|
||||
redis:
|
||||
host: 192.168.17.221
|
||||
@ -25,8 +27,17 @@ spring:
|
||||
password: wujiawei
|
||||
database: 2
|
||||
|
||||
---
|
||||
#spring:
|
||||
# datasource:
|
||||
# url: jdbc:h2:~/client_heartbeat;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE;DATABASE_TO_UPPER=true;MODE=MySQL;CASE_INSENSITIVE_IDENTIFIERS=TRUE
|
||||
# username: sa
|
||||
# driver-class-name: org.h2.Driver
|
||||
|
||||
---
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:h2:~/client_heartbeat;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE;DATABASE_TO_UPPER=true;MODE=MySQL;CASE_INSENSITIVE_IDENTIFIERS=TRUE
|
||||
username: sa
|
||||
driver-class-name: org.h2.Driver
|
||||
url: jdbc:mysql://127.0.0.1:3306/wu_lazy_cloud_heartbeat_client_start?allowMultiQueries=true&useUnicode=true&autoReconnect=true&useAffectedRows=true&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&databaseTerm=SCHEMA
|
||||
username: root
|
||||
password: wujiawei
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
|
@ -30,7 +30,7 @@ docker push registry.cn-hangzhou.aliyuncs.com/wu-lazy/wu-lazy-cloud-heartbeat-se
|
||||
|
||||
|
||||
```RUN
|
||||
docker run -d -it -p 6001:6001 -p 7001:7001 -e spring.profiles.active=prod -e MAIN_DB_HOST=localhost:3306 -e MAIN_DB_PASSWORD=root -e MAIN_DB_PASSWORD=root --name wu-lazy-cloud-heartbeat-server-start registry.cn-hangzhou.aliyuncs.com/wu-lazy/wu-lazy-cloud-heartbeat-server-start:1.3.0-JDK17-NATIVE-SNAPSHOT
|
||||
docker run -d -it -p 6001:6001 -p 7001:7001 -e spring.profiles.active=prod -e MAIN_DB_HOST=localhost:3306 -e MAIN_DB_PASSWORD=root -e MAIN_DB_PASSWORD=root --name wu-lazy-cloud-heartbeat-server-start registry.cn-hangzhou.aliyuncs.com/wu-lazy/wu-lazy-cloud-heartbeat-server-start:1.3.0-JDK17-SNAPSHOT
|
||||
|
||||
http://127.0.0.1:6001/swagger-ui/index.html
|
||||
|
||||
|
@ -7,7 +7,7 @@ metadata:
|
||||
k8s.kuboard.cn/layer: gateway
|
||||
k8s.kuboard.cn/name: wu-lazy-cloud-heartbeat-server
|
||||
name: wu-lazy-cloud-heartbeat-server
|
||||
namespace: default
|
||||
namespace: infrastructure-construction
|
||||
spec:
|
||||
progressDeadlineSeconds: 600
|
||||
replicas: 1
|
||||
@ -31,7 +31,7 @@ spec:
|
||||
- env:
|
||||
- name: spring.datasource.url
|
||||
value: >-
|
||||
jdbc:mysql://cloud-mysql:3306/wu_lazy_cloud_netty_server?allowMultiQueries=true&useUnicode=true&autoReconnect=true&useAffectedRows=true&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&databaseTerm=SCHEMA
|
||||
jdbc:mysql://cloud-mysql:3306/net_infrastructure_construction?allowMultiQueries=true&useUnicode=true&autoReconnect=true&useAffectedRows=true&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&databaseTerm=SCHEMA
|
||||
- name: JAVA_OPTS
|
||||
value: '-Xms64m -Xmx128m'
|
||||
- name: spring.datasource.username
|
||||
@ -41,7 +41,7 @@ spec:
|
||||
- name: spring.datasource.driver-class-name
|
||||
value: com.mysql.cj.jdbc.Driver
|
||||
image: >-
|
||||
registry.cn-hangzhou.aliyuncs.com/wu-lazy/wu-lazy-cloud-heartbeat-server-start:1.2.7-JDK17-NATIVE-SNAPSHOT
|
||||
registry.cn-hangzhou.aliyuncs.com/wu-lazy/wu-lazy-cloud-heartbeat-server-start:1.3.0-JDK17-SNAPSHOT
|
||||
imagePullPolicy: Always
|
||||
name: wu-lazy-cloud-heartbeat-server
|
||||
resources: {}
|
||||
@ -63,11 +63,11 @@ metadata:
|
||||
k8s.kuboard.cn/layer: gateway
|
||||
k8s.kuboard.cn/name: wu-lazy-cloud-heartbeat-server
|
||||
name: wu-lazy-cloud-heartbeat-server
|
||||
namespace: default
|
||||
namespace: infrastructure-construction
|
||||
spec:
|
||||
ports:
|
||||
- name: pecjjh
|
||||
nodePort: 30676
|
||||
nodePort: 30560
|
||||
port: 7001
|
||||
protocol: TCP
|
||||
targetPort: 7001
|
||||
@ -77,7 +77,7 @@ spec:
|
||||
protocol: TCP
|
||||
targetPort: 30273
|
||||
- name: wfcigf
|
||||
nodePort: 30576
|
||||
nodePort: 30550
|
||||
port: 6001
|
||||
protocol: TCP
|
||||
targetPort: 6001
|
||||
|
Loading…
x
Reference in New Issue
Block a user