-
config.yaml apisix:
stream_proxy: # TCP/UDP proxy
only: false
tcp: # TCP proxy address list
- 9100
- 19306
node_listen: 9080 # APISIX listening port
enable_ipv6: false
allow_admin: # http://nginx.org/en/docs/http/ngx_http_access_module.html#allow
- 0.0.0.0/0 # We need to restrict ip access rules for security. 0.0.0.0/0 is for test.
admin_key:
- name: "admin"
key: edd1c9f034335f136f87ad84b625c8f1
role: admin # admin: manage all configuration data
etcd:
host: # it's possible to define multiple etcd hosts addresses of the same etcd cluster.
- "http://etcd:2379" # multiple etcd address
prefix: "/apisix" # apisix configurations prefix
timeout: 30 docker run -d -p 2379:2379 -e ETCD_ENABLE_V2="true" -e ALLOW_NONE_AUTHENTICATION="yes" -e ETCD_ADVERTISE_CLIENT_URLS="http://0.0.0.0:2379" -e ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379" bitnami/etcd:3.4.15
docker run -d --add-host=etcd:10.0.16.9 -p 19080:9080 -p 19091:9091 -p 19100:9100 -p 19306:19306 -v `pwd`/config.yaml:/usr/local/apisix/conf/config.yaml apache/apisix:2.11.0-alpine 10.0.16.9 is my eth0 curl http://127.0.0.1:19080/apisix/admin/stream_routes/2 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"server_addr": "10.0.16.9",
"server_port": 19306,
"upstream": {
"nodes": {
"10.0.16.9:3306":1
},
"type": "roundrobin"
}
}' I could connect with 3306, couldn't connect to 19306. [Main Instruction] [Content] [OK] |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi @davidwhf, I just helped to format your codes by using Markdown Code Quote 😄 Back to your question, please have a look at this PR https://github.com/apache/apisix/pull/5793/files, let me know if it works. |
Beta Was this translation helpful? Give feedback.
-
Thks for your reply. My apisix runs in docker. The best choice for me is using server port,not remote_addr ,or server_addr.Which is setted in config.yaml. It's working now. curl http://127.0.0.1:19080/apisix/admin/stream_routes/2 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"server_port": 19306,
"upstream": {
"nodes": {
"10.0.16.9:3306":1
},
"type": "roundrobin"
}
}' |
Beta Was this translation helpful? Give feedback.
Thks for your reply. My apisix runs in docker. The best choice for me is using server port,not remote_addr ,or server_addr.Which is setted in config.yaml. It's working now.