yinyuncan opened a new issue #6006:
URL: https://github.com/apache/apisix/issues/6006


   ### Improved or typo fixed.
   
   事情由来:想配置一个tidb的tcp代理 然后发现死活连不上 ,一直报
   ` Lost connection to MySQL server at 'reading initial communication packet'`
   
   这个是我之前的配置:
   ```yaml
   apisix:
   #    stream 代理(tcp/udp)
     stream_proxy: # TCP/UDP proxy
       only: false
       tcp: # TCP proxy address list
           - 1998
   ```
   这个是请求admin api的配置数据
   ```
   curl http://127.0.0.1:9180/apisix/admin/stream_routes/1 -H "X-API-KEY: 
apisix-yimazhinengkeji-2022@" -X PUT -d '
     {
       "sni": "tidb.xxxx.cn",
       "server_port": 1998,
       "upstream": {
         "nodes": {
           "10.0.0.80:4000": 1,
           "10.0.0.76:4000": 1,
           "10.0.0.74:4000": 1
         },
         "type": "roundrobin"
       }
     }'
   ```
   按道理连接命令应该是可以连接上的
   `mysql --host=tidb.xxxx.cn --port=1998-u root -p`
   
   结果就是一直报` Lost connection to MySQL server at 'reading initial communication 
packet'` 这个问题困扰了我一下午
   
   下班回到家 又经过各种尝试 最终发现只需要把 sni 参数去除就可以正常连接了 
   
   我也不太好确定这个问题是否为bug 总之我还是反馈一下吧 总感觉这个坑很容易踩到
   
   
   ### Solution
   
   可以正常代理tcp的配置:
   ```
   curl http://127.0.0.1:9180/apisix/admin/stream_routes/1 -H "X-API-KEY: 
apisix-yimazhinengkeji-2022@" -X PUT -d '
     {
       "server_port": 1998,
       "upstream": {
         "nodes": {
           "10.0.0.80:4000": 1,
           "10.0.0.76:4000": 1,
           "10.0.0.74:4000": 1
         },
         "type": "roundrobin"
       }
     }'
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to