sailershen opened a new issue #3843:
URL: https://github.com/apache/apisix/issues/3843


   需求:用apisix做负载均衡,把请求分配到后端172.16.10.241:6500 和 172.16.10.242:6500上。
   
   /usr/local/apisix/conf/config.yaml的内容:
   `etcd:
     host:
       - "http://127.0.0.1:2379";
   apisix:
     admin_key:
       - name: "admin"
         key: edd1c9f034335f136f87ad84b625c8f2
         role: admin
     stream_proxy:
       tcp:
         - 10080`
   
   操作命令:
   `curl http://127.0.0.1:9080/apisix/admin/stream_routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f2' -X PUT -d '
   {
       "upstream": {
           "nodes": {
               "172.16.10.241:6500": 1
           },
           "type": "roundrobin"
       }
   }'
   
   curl http://127.0.0.1:9080/apisix/admin/stream_routes/2 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f2' -X PUT -d '
   {
       "upstream": {
           "nodes": {
               "172.16.10.242:6500": 1
           },
           "type": "roundrobin"
       }
   }'
   
   # 查看upstream
   curl http://127.0.0.1:9080/apisix/admin/stream_routes/ -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f2'
   # ----输出
   
{"node":{"dir":true,"key":"\/apisix\/stream_routes","nodes":[{"modifiedIndex":623,"key":"\/apisix\/stream_routes\/1","value":{"upstream":{"scheme":"http","pass_host":"pass","type":"roundrobin","nodes":{"172.16.10.241:6500":1},"hash_on":"vars"},"id":"1"},"createdIndex":623},{"modifiedIndex":625,"key":"\/apisix\/stream_routes\/2","value":{"upstream":{"scheme":"http","pass_host":"pass","type":"roundrobin","nodes":{"172.16.10.242:6500":1},"hash_on":"vars"},"id":"2"},"createdIndex":625}]},"count":"3","action":"get"}`
   
   telnet到apisix服务器的6500端口,立即退出, /usr/local/apisix/logs/error.log里的输出日志:
   `
   2021/03/16 22:46:28 [error] 32709#32709: *1096557 lua entry thread aborted: 
runtime error: /usr/local/apisix/apisix/stream/router/ip_port.lua:33: attempt 
to index local 'route' (a boolean value)
   stack traceback:
   coroutine 0:
           /usr/local/apisix/apisix/stream/router/ip_port.lua: in function 
'match_opts'
           /usr/local/apisix/apisix/stream/router/ip_port.lua:62: in function 
'match'
           /usr/local/apisix/apisix/init.lua:737: in function 
'stream_preread_phase'
           preread_by_lua(nginx.conf:69):2: in main chunk while prereading 
client data, client: 172.26.5.10, server: 0.0.0.0:6500
   `


----------------------------------------------------------------
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.

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


Reply via email to