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


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