From fee9260540ecd32d5f3ad6a38a7033023e0cdf96 Mon Sep 17 00:00:00 2001 From: caojiajun Date: Wed, 23 Aug 2023 19:16:00 +0800 Subject: [PATCH] fix and add log for proxy protocol support(#131) --- .../src/main/resources/application.yml | 1 + .../nim/camellia/redis/proxy/netty/CamelliaRedisProxyServer.java | 1 + .../camellia/redis/proxy/springboot/CamelliaRedisProxyUtil.java | 1 + 3 files changed, 3 insertions(+) diff --git a/camellia-redis-proxy/camellia-redis-proxy-bootstrap/src/main/resources/application.yml b/camellia-redis-proxy/camellia-redis-proxy-bootstrap/src/main/resources/application.yml index 455f361df..c211bb385 100644 --- a/camellia-redis-proxy/camellia-redis-proxy-bootstrap/src/main/resources/application.yml +++ b/camellia-redis-proxy/camellia-redis-proxy-bootstrap/src/main/resources/application.yml @@ -13,6 +13,7 @@ camellia-redis-proxy: monitor-interval-seconds: 60 #monitor data refresh interval seconds # tls-port: 6381 # proxy-frontend-tls-provider-class-name: com.netease.nim.camellia.redis.proxy.tls.frontend.DefaultProxyFrontendTlsProvider +# proxy-protocol-enable: false # cluster-mode-enable: true #cluster-mode, if setting true, proxy-cluster disguised as a redis-cluster, should configure proxy.cluster.mode.nodes=xx in camellia-redis-proxy.properties # cport: -1 #cluster-mode is setting true, proxy will use this cport to heartbeat, if setting -1, cport = port + 10000 # netty-transport-mode: epoll diff --git a/camellia-redis-proxy/camellia-redis-proxy-core/src/main/java/com/netease/nim/camellia/redis/proxy/netty/CamelliaRedisProxyServer.java b/camellia-redis-proxy/camellia-redis-proxy-core/src/main/java/com/netease/nim/camellia/redis/proxy/netty/CamelliaRedisProxyServer.java index 6cff4376d..fde316b4c 100644 --- a/camellia-redis-proxy/camellia-redis-proxy-core/src/main/java/com/netease/nim/camellia/redis/proxy/netty/CamelliaRedisProxyServer.java +++ b/camellia-redis-proxy/camellia-redis-proxy-core/src/main/java/com/netease/nim/camellia/redis/proxy/netty/CamelliaRedisProxyServer.java @@ -109,6 +109,7 @@ public void initChannel(SocketChannel ch) { serverProperties.getSoBacklog(), serverProperties.getSoSndbuf(), serverProperties.getSoRcvbuf(), serverProperties.isSoKeepalive()); logger.info("CamelliaRedisProxyServer, tcp_no_delay = {}, tcp_quick_ack = {}, write_buffer_water_mark_low = {}, write_buffer_water_mark_high = {}", serverProperties.isTcpNoDelay(), GlobalRedisProxyEnv.isServerTcpQuickAckEnable(), serverProperties.getWriteBufferWaterMarkLow(), serverProperties.getWriteBufferWaterMarkHigh()); + logger.info("CamelliaRedisProxyServer, proxy_protocol_enable = {}", serverProperties.isProxyProtocolEnable()); if (port > 0 && port != tlsPort) { logger.info("CamelliaRedisProxyServer start at port: {}", port); } diff --git a/camellia-redis-proxy/camellia-redis-proxy-spring-boot-starters/camellia-redis-proxy-spring-boot-starter/src/main/java/com/netease/nim/camellia/redis/proxy/springboot/CamelliaRedisProxyUtil.java b/camellia-redis-proxy/camellia-redis-proxy-spring-boot-starters/camellia-redis-proxy-spring-boot-starter/src/main/java/com/netease/nim/camellia/redis/proxy/springboot/CamelliaRedisProxyUtil.java index ddce25a9a..dddc0b69f 100644 --- a/camellia-redis-proxy/camellia-redis-proxy-spring-boot-starters/camellia-redis-proxy-spring-boot-starter/src/main/java/com/netease/nim/camellia/redis/proxy/springboot/CamelliaRedisProxyUtil.java +++ b/camellia-redis-proxy/camellia-redis-proxy-spring-boot-starters/camellia-redis-proxy-spring-boot-starter/src/main/java/com/netease/nim/camellia/redis/proxy/springboot/CamelliaRedisProxyUtil.java @@ -39,6 +39,7 @@ public static CamelliaServerProperties parse(CamelliaRedisProxyProperties proper serverProperties.setPassword(properties.getPassword()); serverProperties.setProxyFrontendTlsProviderClassName(properties.getProxyFrontendTlsProviderClassName()); serverProperties.setMonitorEnable(properties.isMonitorEnable()); + serverProperties.setProxyProtocolEnable(properties.isProxyProtocolEnable()); serverProperties.setMonitorIntervalSeconds(properties.getMonitorIntervalSeconds()); serverProperties.setMonitorCallbackClassName(properties.getMonitorCallbackClassName()); serverProperties.setClientAuthProviderClassName(properties.getClientAuthProviderClassName());