mirror of
https://gitee.com/wujiawei1207537021/wu-lazy-cloud-network.git
synced 2025-06-06 13:27:55 +08:00
【fix】 优化使用 EventLoopGroup bossGroup = EventLoopGroupFactory.createBossGroup();
EventLoopGroup workerGroup = EventLoopGroupFactory.createWorkerGroup();
This commit is contained in:
parent
cf10347939
commit
2389a25e11
@ -439,21 +439,10 @@ data:
|
|||||||
|
|
||||||
max_connections=100
|
max_connections=100
|
||||||
|
|
||||||
thread_cache_size=10
|
|
||||||
|
|
||||||
innodb_buffer_pool_chunk_size=64M #效果不明显
|
|
||||||
innodb_buffer_pool_size=64M #效果不明显
|
|
||||||
|
|
||||||
lower_case_table_names=0
|
lower_case_table_names=0
|
||||||
|
|
||||||
table_open_cache=64
|
table_open_cache=64
|
||||||
|
|
||||||
query_cache_type=0
|
|
||||||
|
|
||||||
query_cache_size=0
|
|
||||||
|
|
||||||
key_buffer_size=0
|
|
||||||
|
|
||||||
default-time-zone='+08:00'
|
default-time-zone='+08:00'
|
||||||
|
|
||||||
sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'
|
sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'
|
||||||
@ -461,11 +450,12 @@ data:
|
|||||||
log_timestamps='SYSTEM'
|
log_timestamps='SYSTEM'
|
||||||
|
|
||||||
performance_schema_max_table_instances=400 #设置效果不明显
|
performance_schema_max_table_instances=400 #设置效果不明显
|
||||||
table_definition_cache=400
|
|
||||||
performance_schema=off #效果明显
|
performance_schema=off #效果明显
|
||||||
|
|
||||||
slow_query_log=ON
|
table_definition_cache=400
|
||||||
|
|
||||||
|
slow_query_log=ON
|
||||||
|
|
||||||
binlog_expire_logs_seconds = 2
|
binlog_expire_logs_seconds = 2
|
||||||
|
|
||||||
@ -473,3 +463,27 @@ data:
|
|||||||
|
|
||||||
group_concat_max_len=512
|
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
|
||||||
|
|
||||||
|
@ -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.NettyVisitorPortContext;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelFlowAdapter;
|
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.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.socket.PermeateVisitorSocket;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 内网穿透 客户端渗透客户端通道
|
* 内网穿透 客户端渗透客户端通道
|
||||||
*
|
*
|
||||||
@ -26,8 +28,6 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class NettyTcpClientPermeateClientVisitorSocket implements PermeateVisitorSocket {
|
public class NettyTcpClientPermeateClientVisitorSocket implements PermeateVisitorSocket {
|
||||||
private final EventLoopGroup bossGroup = new NioEventLoopGroup();
|
|
||||||
private final EventLoopGroup workerGroup = new NioEventLoopGroup();
|
|
||||||
private final NettyTcpClientPermeateClientVisitorFilter nettyTcpClientPermeateClientVisitorFilter;
|
private final NettyTcpClientPermeateClientVisitorFilter nettyTcpClientPermeateClientVisitorFilter;
|
||||||
@Getter
|
@Getter
|
||||||
private final String clientId;
|
private final String clientId;
|
||||||
@ -50,6 +50,9 @@ public class NettyTcpClientPermeateClientVisitorSocket implements PermeateVisito
|
|||||||
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
||||||
if (visitor == null) {
|
if (visitor == null) {
|
||||||
ServerBootstrap bootstrap = new ServerBootstrap();
|
ServerBootstrap bootstrap = new ServerBootstrap();
|
||||||
|
|
||||||
|
EventLoopGroup bossGroup = EventLoopGroupFactory.createBossGroup();
|
||||||
|
EventLoopGroup workerGroup = EventLoopGroupFactory.createWorkerGroup();
|
||||||
bootstrap
|
bootstrap
|
||||||
.group(bossGroup, workerGroup)
|
.group(bossGroup, workerGroup)
|
||||||
.channel(NioServerSocketChannel.class)
|
.channel(NioServerSocketChannel.class)
|
||||||
@ -94,12 +97,6 @@ public class NettyTcpClientPermeateClientVisitorSocket implements PermeateVisito
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
if (!bossGroup.isShutdown()) {
|
|
||||||
bossGroup.shutdownGracefully();
|
|
||||||
}
|
|
||||||
if (!workerGroup.isShutdown()) {
|
|
||||||
workerGroup.shutdownGracefully();
|
|
||||||
}
|
|
||||||
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
||||||
if (visitor != null) {
|
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.NettyClientVisitorContext;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyVisitorPortContext;
|
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.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.socket.PermeateVisitorSocket;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||||
|
|
||||||
@ -25,8 +26,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class NettyTcpClientPermeateServerVisitorSocket implements PermeateVisitorSocket {
|
public class NettyTcpClientPermeateServerVisitorSocket implements PermeateVisitorSocket {
|
||||||
private final EventLoopGroup bossGroup = new NioEventLoopGroup();
|
|
||||||
private final EventLoopGroup workerGroup = new NioEventLoopGroup();
|
|
||||||
private final NettyTcpClientPermeateServerVisitorFilter nettyTcpClientPermeateServerVisitorFilter;
|
private final NettyTcpClientPermeateServerVisitorFilter nettyTcpClientPermeateServerVisitorFilter;
|
||||||
@Getter
|
@Getter
|
||||||
private final String clientId;
|
private final String clientId;
|
||||||
@ -49,6 +49,8 @@ public class NettyTcpClientPermeateServerVisitorSocket implements PermeateVisito
|
|||||||
PermeateVisitorSocket visitor = NettyVisitorPortContext.getVisitorSocket(visitorPort);
|
PermeateVisitorSocket visitor = NettyVisitorPortContext.getVisitorSocket(visitorPort);
|
||||||
if (visitor == null) {
|
if (visitor == null) {
|
||||||
ServerBootstrap bootstrap = new ServerBootstrap();
|
ServerBootstrap bootstrap = new ServerBootstrap();
|
||||||
|
EventLoopGroup bossGroup = EventLoopGroupFactory.createBossGroup();
|
||||||
|
EventLoopGroup workerGroup = EventLoopGroupFactory.createWorkerGroup();
|
||||||
bootstrap
|
bootstrap
|
||||||
.group(bossGroup, workerGroup)
|
.group(bossGroup, workerGroup)
|
||||||
.channel(NioServerSocketChannel.class)
|
.channel(NioServerSocketChannel.class)
|
||||||
@ -91,12 +93,6 @@ public class NettyTcpClientPermeateServerVisitorSocket implements PermeateVisito
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
if (!bossGroup.isShutdown()) {
|
|
||||||
bossGroup.shutdownGracefully();
|
|
||||||
}
|
|
||||||
if (!workerGroup.isShutdown()) {
|
|
||||||
workerGroup.shutdownGracefully();
|
|
||||||
}
|
|
||||||
PermeateVisitorSocket permeateVisitorSocket = NettyVisitorPortContext.getVisitorSocket(visitorPort);
|
PermeateVisitorSocket permeateVisitorSocket = NettyVisitorPortContext.getVisitorSocket(visitorPort);
|
||||||
if (permeateVisitorSocket != null) {
|
if (permeateVisitorSocket != null) {
|
||||||
log.warn("关闭客户端 :【{}】 访客户端口:【{}】", clientId, visitorPort);
|
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.NettyVisitorPortContext;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelFlowAdapter;
|
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.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.socket.PermeateVisitorSocket;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||||
|
|
||||||
@ -26,8 +27,6 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class NettyUdpClientPermeateClientVisitorSocket implements PermeateVisitorSocket {
|
public class NettyUdpClientPermeateClientVisitorSocket implements PermeateVisitorSocket {
|
||||||
private final EventLoopGroup bossGroup = new NioEventLoopGroup();
|
|
||||||
private final EventLoopGroup workerGroup = new NioEventLoopGroup();
|
|
||||||
private final NettyUdpClientPermeateClientVisitorFilter nettyUdpClientPermeateClientVisitorFilter;
|
private final NettyUdpClientPermeateClientVisitorFilter nettyUdpClientPermeateClientVisitorFilter;
|
||||||
@Getter
|
@Getter
|
||||||
private final String clientId;
|
private final String clientId;
|
||||||
@ -50,6 +49,8 @@ public class NettyUdpClientPermeateClientVisitorSocket implements PermeateVisito
|
|||||||
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
||||||
if (visitor == null) {
|
if (visitor == null) {
|
||||||
ServerBootstrap bootstrap = new ServerBootstrap();
|
ServerBootstrap bootstrap = new ServerBootstrap();
|
||||||
|
EventLoopGroup bossGroup = EventLoopGroupFactory.createBossGroup();
|
||||||
|
EventLoopGroup workerGroup = EventLoopGroupFactory.createWorkerGroup();
|
||||||
bootstrap
|
bootstrap
|
||||||
.group(bossGroup, workerGroup)
|
.group(bossGroup, workerGroup)
|
||||||
.channel(NioServerSocketChannel.class)
|
.channel(NioServerSocketChannel.class)
|
||||||
@ -94,12 +95,7 @@ public class NettyUdpClientPermeateClientVisitorSocket implements PermeateVisito
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
if (!bossGroup.isShutdown()) {
|
|
||||||
bossGroup.shutdownGracefully();
|
|
||||||
}
|
|
||||||
if (!workerGroup.isShutdown()) {
|
|
||||||
workerGroup.shutdownGracefully();
|
|
||||||
}
|
|
||||||
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
||||||
if (visitor != null) {
|
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.NettyClientVisitorContext;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyVisitorPortContext;
|
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.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.socket.PermeateVisitorSocket;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||||
|
|
||||||
@ -25,8 +26,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class NettyUdpClientPermeateServerVisitorSocket implements PermeateVisitorSocket {
|
public class NettyUdpClientPermeateServerVisitorSocket implements PermeateVisitorSocket {
|
||||||
private final EventLoopGroup bossGroup = new NioEventLoopGroup();
|
|
||||||
private final EventLoopGroup workerGroup = new NioEventLoopGroup();
|
|
||||||
private final NettyUdpClientPermeateServerVisitorFilter nettyUdpClientPermeateServerVisitorFilter;
|
private final NettyUdpClientPermeateServerVisitorFilter nettyUdpClientPermeateServerVisitorFilter;
|
||||||
@Getter
|
@Getter
|
||||||
private final String clientId;
|
private final String clientId;
|
||||||
@ -49,6 +49,8 @@ public class NettyUdpClientPermeateServerVisitorSocket implements PermeateVisito
|
|||||||
PermeateVisitorSocket visitor = NettyVisitorPortContext.getVisitorSocket(visitorPort);
|
PermeateVisitorSocket visitor = NettyVisitorPortContext.getVisitorSocket(visitorPort);
|
||||||
if (visitor == null) {
|
if (visitor == null) {
|
||||||
ServerBootstrap bootstrap = new ServerBootstrap();
|
ServerBootstrap bootstrap = new ServerBootstrap();
|
||||||
|
EventLoopGroup bossGroup = EventLoopGroupFactory.createBossGroup();
|
||||||
|
EventLoopGroup workerGroup = EventLoopGroupFactory.createWorkerGroup();
|
||||||
bootstrap
|
bootstrap
|
||||||
.group(bossGroup, workerGroup)
|
.group(bossGroup, workerGroup)
|
||||||
.channel(NioServerSocketChannel.class)
|
.channel(NioServerSocketChannel.class)
|
||||||
@ -91,12 +93,7 @@ public class NettyUdpClientPermeateServerVisitorSocket implements PermeateVisito
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
if (!bossGroup.isShutdown()) {
|
|
||||||
bossGroup.shutdownGracefully();
|
|
||||||
}
|
|
||||||
if (!workerGroup.isShutdown()) {
|
|
||||||
workerGroup.shutdownGracefully();
|
|
||||||
}
|
|
||||||
PermeateVisitorSocket permeateVisitorSocket = NettyVisitorPortContext.getVisitorSocket(visitorPort);
|
PermeateVisitorSocket permeateVisitorSocket = NettyVisitorPortContext.getVisitorSocket(visitorPort);
|
||||||
if (permeateVisitorSocket != null) {
|
if (permeateVisitorSocket != null) {
|
||||||
log.warn("关闭客户端 :【{}】 访客户端口:【{}】", clientId, visitorPort);
|
log.warn("关闭客户端 :【{}】 访客户端口:【{}】", clientId, visitorPort);
|
||||||
|
@ -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.NettyClientVisitorContext;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyVisitorPortContext;
|
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.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.common.socket.PermeateVisitorSocket;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.tcp.filter.NettyTcpServerPermeateClientVisitorFilter;
|
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
|
@Slf4j
|
||||||
public class NettyTcpServerPermeateClientVisitorSocket implements PermeateVisitorSocket {
|
public class NettyTcpServerPermeateClientVisitorSocket implements PermeateVisitorSocket {
|
||||||
private final EventLoopGroup bossGroup = new NioEventLoopGroup();
|
|
||||||
private final EventLoopGroup workerGroup = new NioEventLoopGroup();
|
|
||||||
private final NettyTcpServerPermeateClientVisitorFilter nettyTcpServerPermeateClientVisitorFilter;
|
private final NettyTcpServerPermeateClientVisitorFilter nettyTcpServerPermeateClientVisitorFilter;
|
||||||
@Getter
|
@Getter
|
||||||
private final String clientId;
|
private final String clientId;
|
||||||
@ -46,6 +46,8 @@ public class NettyTcpServerPermeateClientVisitorSocket implements PermeateVisito
|
|||||||
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
||||||
if (visitor == null) {
|
if (visitor == null) {
|
||||||
ServerBootstrap bootstrap = new ServerBootstrap();
|
ServerBootstrap bootstrap = new ServerBootstrap();
|
||||||
|
EventLoopGroup bossGroup = EventLoopGroupFactory.createBossGroup();
|
||||||
|
EventLoopGroup workerGroup = EventLoopGroupFactory.createWorkerGroup();
|
||||||
bootstrap
|
bootstrap
|
||||||
.group(bossGroup, workerGroup)
|
.group(bossGroup, workerGroup)
|
||||||
.channel(NioServerSocketChannel.class)
|
.channel(NioServerSocketChannel.class)
|
||||||
@ -89,12 +91,6 @@ public class NettyTcpServerPermeateClientVisitorSocket implements PermeateVisito
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
if (!bossGroup.isShutdown()) {
|
|
||||||
bossGroup.shutdownGracefully();
|
|
||||||
}
|
|
||||||
if (!workerGroup.isShutdown()) {
|
|
||||||
workerGroup.shutdownGracefully();
|
|
||||||
}
|
|
||||||
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
||||||
if (visitor != null) {
|
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.NettyServerPermeateServerVisitorContext;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyVisitorPortContext;
|
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.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 org.framework.lazy.cloud.network.heartbeat.server.netty.tcp.filter.NettyTcpServerPermeateServerVisitorFilter;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -20,8 +21,6 @@ import java.io.IOException;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class NettyTcpServerPermeateServerConnectVisitorSocket {
|
public class NettyTcpServerPermeateServerConnectVisitorSocket {
|
||||||
private final EventLoopGroup bossGroup = new NioEventLoopGroup();
|
|
||||||
private final EventLoopGroup workerGroup = new NioEventLoopGroup();
|
|
||||||
private final NettyTcpServerPermeateServerVisitorFilter nettyTcpServerPermeateServerVisitorFilter;
|
private final NettyTcpServerPermeateServerVisitorFilter nettyTcpServerPermeateServerVisitorFilter;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@ -45,6 +44,8 @@ public class NettyTcpServerPermeateServerConnectVisitorSocket {
|
|||||||
NettyTcpServerPermeateServerConnectVisitorSocket nettyTcpServerPermeateServerConnectVisitorSocket = NettyServerPermeateServerVisitorContext.getServerPermeateServerVisitorSocket(visitorPort);
|
NettyTcpServerPermeateServerConnectVisitorSocket nettyTcpServerPermeateServerConnectVisitorSocket = NettyServerPermeateServerVisitorContext.getServerPermeateServerVisitorSocket(visitorPort);
|
||||||
if (nettyTcpServerPermeateServerConnectVisitorSocket == null) {
|
if (nettyTcpServerPermeateServerConnectVisitorSocket == null) {
|
||||||
ServerBootstrap bootstrap = new ServerBootstrap();
|
ServerBootstrap bootstrap = new ServerBootstrap();
|
||||||
|
EventLoopGroup bossGroup = EventLoopGroupFactory.createBossGroup();
|
||||||
|
EventLoopGroup workerGroup = EventLoopGroupFactory.createWorkerGroup();
|
||||||
bootstrap
|
bootstrap
|
||||||
.group(bossGroup, workerGroup)
|
.group(bossGroup, workerGroup)
|
||||||
.channel(NioServerSocketChannel.class)
|
.channel(NioServerSocketChannel.class)
|
||||||
@ -83,12 +84,6 @@ public class NettyTcpServerPermeateServerConnectVisitorSocket {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void close() throws IOException, InterruptedException {
|
public void close() throws IOException, InterruptedException {
|
||||||
if (!bossGroup.isShutdown()) {
|
|
||||||
bossGroup.shutdownGracefully();
|
|
||||||
}
|
|
||||||
if (!workerGroup.isShutdown()) {
|
|
||||||
workerGroup.shutdownGracefully();
|
|
||||||
}
|
|
||||||
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
||||||
if (visitor != null) {
|
if (visitor != null) {
|
||||||
// close channel
|
// 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.NettyClientVisitorContext;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyVisitorPortContext;
|
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.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.common.socket.PermeateVisitorSocket;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.udp.filter.NettyUdpServerPermeateClientVisitorFilter;
|
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
|
@Slf4j
|
||||||
public class NettyUdpServerPermeateClientVisitorSocket implements PermeateVisitorSocket {
|
public class NettyUdpServerPermeateClientVisitorSocket implements PermeateVisitorSocket {
|
||||||
private final EventLoopGroup bossGroup = new NioEventLoopGroup();
|
|
||||||
private final EventLoopGroup workerGroup = new NioEventLoopGroup();
|
|
||||||
private final NettyUdpServerPermeateClientVisitorFilter nettyUdpServerPermeateClientVisitorFilter;
|
private final NettyUdpServerPermeateClientVisitorFilter nettyUdpServerPermeateClientVisitorFilter;
|
||||||
@Getter
|
@Getter
|
||||||
private final String clientId;
|
private final String clientId;
|
||||||
@ -46,6 +46,8 @@ public class NettyUdpServerPermeateClientVisitorSocket implements PermeateVisito
|
|||||||
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
||||||
if (visitor == null) {
|
if (visitor == null) {
|
||||||
ServerBootstrap bootstrap = new ServerBootstrap();
|
ServerBootstrap bootstrap = new ServerBootstrap();
|
||||||
|
EventLoopGroup bossGroup = EventLoopGroupFactory.createBossGroup();
|
||||||
|
EventLoopGroup workerGroup = EventLoopGroupFactory.createWorkerGroup();
|
||||||
bootstrap
|
bootstrap
|
||||||
.group(bossGroup, workerGroup)
|
.group(bossGroup, workerGroup)
|
||||||
.channel(NioServerSocketChannel.class)
|
.channel(NioServerSocketChannel.class)
|
||||||
@ -89,12 +91,6 @@ public class NettyUdpServerPermeateClientVisitorSocket implements PermeateVisito
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
if (!bossGroup.isShutdown()) {
|
|
||||||
bossGroup.shutdownGracefully();
|
|
||||||
}
|
|
||||||
if (!workerGroup.isShutdown()) {
|
|
||||||
workerGroup.shutdownGracefully();
|
|
||||||
}
|
|
||||||
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
||||||
if (visitor != null) {
|
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.NettyServerPermeateServerVisitorContext;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyVisitorPortContext;
|
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.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 org.framework.lazy.cloud.network.heartbeat.server.netty.udp.filter.NettyUdpServerPermeateServerVisitorFilter;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -20,8 +21,6 @@ import java.io.IOException;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class NettyUdpServerPermeateServerConnectVisitorSocket {
|
public class NettyUdpServerPermeateServerConnectVisitorSocket {
|
||||||
private final EventLoopGroup bossGroup = new NioEventLoopGroup();
|
|
||||||
private final EventLoopGroup workerGroup = new NioEventLoopGroup();
|
|
||||||
private final NettyUdpServerPermeateServerVisitorFilter nettyUdpServerPermeateServerVisitorFilter;
|
private final NettyUdpServerPermeateServerVisitorFilter nettyUdpServerPermeateServerVisitorFilter;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@ -45,6 +44,8 @@ public class NettyUdpServerPermeateServerConnectVisitorSocket {
|
|||||||
NettyUdpServerPermeateServerConnectVisitorSocket nettyUdpServerPermeateServerConnectVisitorSocket = NettyServerPermeateServerVisitorContext.getServerPermeateServerVisitorSocket(visitorPort);
|
NettyUdpServerPermeateServerConnectVisitorSocket nettyUdpServerPermeateServerConnectVisitorSocket = NettyServerPermeateServerVisitorContext.getServerPermeateServerVisitorSocket(visitorPort);
|
||||||
if (nettyUdpServerPermeateServerConnectVisitorSocket == null) {
|
if (nettyUdpServerPermeateServerConnectVisitorSocket == null) {
|
||||||
ServerBootstrap bootstrap = new ServerBootstrap();
|
ServerBootstrap bootstrap = new ServerBootstrap();
|
||||||
|
EventLoopGroup bossGroup = EventLoopGroupFactory.createBossGroup();
|
||||||
|
EventLoopGroup workerGroup = EventLoopGroupFactory.createWorkerGroup();
|
||||||
bootstrap
|
bootstrap
|
||||||
.group(bossGroup, workerGroup)
|
.group(bossGroup, workerGroup)
|
||||||
.channel(NioServerSocketChannel.class)
|
.channel(NioServerSocketChannel.class)
|
||||||
@ -83,12 +84,6 @@ public class NettyUdpServerPermeateServerConnectVisitorSocket {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void close() throws IOException, InterruptedException {
|
public void close() throws IOException, InterruptedException {
|
||||||
if (!bossGroup.isShutdown()) {
|
|
||||||
bossGroup.shutdownGracefully();
|
|
||||||
}
|
|
||||||
if (!workerGroup.isShutdown()) {
|
|
||||||
workerGroup.shutdownGracefully();
|
|
||||||
}
|
|
||||||
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
Channel visitor = NettyVisitorPortContext.getVisitorChannel(visitorPort);
|
||||||
if (visitor != null) {
|
if (visitor != null) {
|
||||||
// close channel
|
// close channel
|
||||||
|
@ -38,7 +38,7 @@ docker run -d -it --privileged --name client -p 6004:6004 registry.cn-hangzhou.a
|
|||||||
```
|
```
|
||||||
|
|
||||||
```shell
|
```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
|
```yaml
|
||||||
|
@ -22,6 +22,11 @@
|
|||||||
<groupId>top.wu2020</groupId>
|
<groupId>top.wu2020</groupId>
|
||||||
<artifactId>wu-lazy-cloud-heartbeat-client</artifactId>
|
<artifactId>wu-lazy-cloud-heartbeat-client</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<version>8.0.33</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@ -4,10 +4,10 @@ spring:
|
|||||||
client:
|
client:
|
||||||
# inet-host: 124.222.48.62
|
# inet-host: 124.222.48.62
|
||||||
# inet-port: 30676
|
# inet-port: 30676
|
||||||
# inet-host: 124.222.48.62
|
inet-host: 124.222.152.160
|
||||||
# inet-port: 30560
|
inet-port: 30560
|
||||||
inet-host: 127.0.0.1
|
# inet-host: 192.168.2.105
|
||||||
inet-port: 7001
|
# inet-port: 7001
|
||||||
inet-path: wu-lazy-cloud-heartbeat-server
|
inet-path: wu-lazy-cloud-heartbeat-server
|
||||||
client-id: wujiawei # 客户端ID
|
client-id: wujiawei # 客户端ID
|
||||||
app-key: key
|
app-key: key
|
||||||
@ -18,6 +18,8 @@ spring:
|
|||||||
# # inet-path: wu-lazy-cloud-heartbeat-server
|
# # inet-path: wu-lazy-cloud-heartbeat-server
|
||||||
# client-id: shuhan # 客户端ID
|
# client-id: shuhan # 客户端ID
|
||||||
# client-id: temp_id # 客户端ID
|
# client-id: temp_id # 客户端ID
|
||||||
|
---
|
||||||
|
spring:
|
||||||
data:
|
data:
|
||||||
redis:
|
redis:
|
||||||
host: 192.168.17.221
|
host: 192.168.17.221
|
||||||
@ -25,8 +27,17 @@ spring:
|
|||||||
password: wujiawei
|
password: wujiawei
|
||||||
database: 2
|
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:
|
datasource:
|
||||||
url: jdbc:h2:~/client_heartbeat;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE;DATABASE_TO_UPPER=true;MODE=MySQL;CASE_INSENSITIVE_IDENTIFIERS=TRUE
|
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: sa
|
username: root
|
||||||
driver-class-name: org.h2.Driver
|
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
|
```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
|
http://127.0.0.1:6001/swagger-ui/index.html
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ metadata:
|
|||||||
k8s.kuboard.cn/layer: gateway
|
k8s.kuboard.cn/layer: gateway
|
||||||
k8s.kuboard.cn/name: wu-lazy-cloud-heartbeat-server
|
k8s.kuboard.cn/name: wu-lazy-cloud-heartbeat-server
|
||||||
name: wu-lazy-cloud-heartbeat-server
|
name: wu-lazy-cloud-heartbeat-server
|
||||||
namespace: default
|
namespace: infrastructure-construction
|
||||||
spec:
|
spec:
|
||||||
progressDeadlineSeconds: 600
|
progressDeadlineSeconds: 600
|
||||||
replicas: 1
|
replicas: 1
|
||||||
@ -31,7 +31,7 @@ spec:
|
|||||||
- env:
|
- env:
|
||||||
- name: spring.datasource.url
|
- name: spring.datasource.url
|
||||||
value: >-
|
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
|
- name: JAVA_OPTS
|
||||||
value: '-Xms64m -Xmx128m'
|
value: '-Xms64m -Xmx128m'
|
||||||
- name: spring.datasource.username
|
- name: spring.datasource.username
|
||||||
@ -41,7 +41,7 @@ spec:
|
|||||||
- name: spring.datasource.driver-class-name
|
- name: spring.datasource.driver-class-name
|
||||||
value: com.mysql.cj.jdbc.Driver
|
value: com.mysql.cj.jdbc.Driver
|
||||||
image: >-
|
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
|
imagePullPolicy: Always
|
||||||
name: wu-lazy-cloud-heartbeat-server
|
name: wu-lazy-cloud-heartbeat-server
|
||||||
resources: {}
|
resources: {}
|
||||||
@ -63,11 +63,11 @@ metadata:
|
|||||||
k8s.kuboard.cn/layer: gateway
|
k8s.kuboard.cn/layer: gateway
|
||||||
k8s.kuboard.cn/name: wu-lazy-cloud-heartbeat-server
|
k8s.kuboard.cn/name: wu-lazy-cloud-heartbeat-server
|
||||||
name: wu-lazy-cloud-heartbeat-server
|
name: wu-lazy-cloud-heartbeat-server
|
||||||
namespace: default
|
namespace: infrastructure-construction
|
||||||
spec:
|
spec:
|
||||||
ports:
|
ports:
|
||||||
- name: pecjjh
|
- name: pecjjh
|
||||||
nodePort: 30676
|
nodePort: 30560
|
||||||
port: 7001
|
port: 7001
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
targetPort: 7001
|
targetPort: 7001
|
||||||
@ -77,7 +77,7 @@ spec:
|
|||||||
protocol: TCP
|
protocol: TCP
|
||||||
targetPort: 30273
|
targetPort: 30273
|
||||||
- name: wfcigf
|
- name: wfcigf
|
||||||
nodePort: 30576
|
nodePort: 30550
|
||||||
port: 6001
|
port: 6001
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
targetPort: 6001
|
targetPort: 6001
|
||||||
|
Loading…
x
Reference in New Issue
Block a user