JiaYueHuang edited a comment on issue #6034:
URL: https://github.com/apache/apisix/issues/6034#issuecomment-1008485771


   I use apisix to encapsulate the openstack’s API to achieve high availability 
and rate limiting.
   
   ### Problem description
   My apisix configuration file (config.yaml) shows below (only shows the 
problem related part):
   
![apisix_config](https://user-images.githubusercontent.com/19731222/148710546-d957badd-f561-4b6a-8179-4c78df4dcd6e.png)
   I use the stream_proxy (tcp proxy) to listen ``vip`` (provided by 
keepalived) and 11211, 3306 ports (related to memcached and mysql services), 
and then I will create ``upstream`` and ``route`` related to memcached and 
mysql services to achive High Availability (shown below).
   
   Notice: I observed that, for msyql and memcache services, stream_proxy (tcp 
proxy) must be used, otherwise (if still use the http proxy), mysql and 
memcache services wouldn’t work out (commands below couldn’t connect 
correctly).  
   `telnet  <vip>  11211`
   `mysql -ukeystone -pKeyStone_pwd -h<vip>`
   
   For simplicity, related upstreams has only one node:
   Mysql’s upstream shows blow:
   
![1-mysql-upstream](https://user-images.githubusercontent.com/19731222/148710650-f81bac8b-fb53-434c-b335-dafa0d41273a.png)
   
   Memcached’s upstream shows below:
   
![2-memcache-upstream](https://user-images.githubusercontent.com/19731222/148710657-3cea225f-9727-4b35-b05d-343acb0cb9ae.png)
   
   Mysql’s stream_route (experiment shows that it’s also valid for ordinary 
route, but will have the same problem) shows below (matched by 3306 port and 
forward the service to specific node):
   
![3-mysql-stream-route](https://user-images.githubusercontent.com/19731222/148710679-a5724b81-bfc5-4766-838b-d180f2c5c642.png)
   
   Memcache’s stream_route :
   
![4-memcached-stream-route](https://user-images.githubusercontent.com/19731222/148710691-305c7f11-1861-4a55-b0b3-c84d39b92f37.png)
   
   Then we test the mysql and memcache services, execute the command below (it 
shows correctly):
   `telnet  <vip>  11211`
   `mysql -ukeystone -pKeyStone_pwd -h<vip>`
   
![5-telnet-11211](https://user-images.githubusercontent.com/19731222/148710724-41683bfb-ce54-4b22-8999-bca031c18de5.png)
   
![6-mysql-login](https://user-images.githubusercontent.com/19731222/148710730-32f5eba9-7996-43d2-ad56-05d9118328fc.png)
   
   ### 1) Problems caused by nova-api (memcached related)
   Configuration related to memcached in nova.conf (if use the ``vip``, there 
are some problems in nova-api.log,  if use specific ip, no ERROR will occur):
   
![7-nova-api-config](https://user-images.githubusercontent.com/19731222/148710816-65461e65-faf7-40c6-a26a-3f45b52e150d.png)
   
![8-nova-api-log-1](https://user-images.githubusercontent.com/19731222/148710833-253a57af-25d1-4f41-ab0b-71dfb1b2d167.png)
   
![9-nova-api-log-2](https://user-images.githubusercontent.com/19731222/148710838-5a63205a-d3a7-4860-8251-a5ba93c1de7b.png)
   
   ### 2) Problems caused by masakari (mysql related)
   I alse use the ``vip`` to connect mysql in masakari configuration file (if 
use real ip, no ERROR will occur):
   
![10-mysql-error-1](https://user-images.githubusercontent.com/19731222/148710889-f7f2ce5a-2179-4744-8d02-230424513967.png)
   
![11-mysql-error-2](https://user-images.githubusercontent.com/19731222/148710899-49d32ef2-4130-4e69-ba3a-d185d15d1e3f.png)
   
   ### Summary
   Because I only set one node in upstream, and evidence shows that apisix is 
functioning correctly, but it still cause some minor problem, which seems 
related to stream_proxy (tcp proxy), and belows are my question about the 
apisix’s stream_proxy:
   1.Does the stream_proxy (tcp proxy) is a short connection? And if so, it 
will interrupt in the client side, which will cause the server’s side to 
trigger some error log (refer to: https://www.jb51.net/article/57602.htm).
   2.Is there any alternative solution to connect mysql and memcached with 
apisix?
   
   If I use the haproxy to achieve High Availability, problems above will not 
occur (but haproxy doesn’t have rate limiting functionality).


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