Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a checker merge config #2111

Open
wangxp006 opened this issue Feb 28, 2022 · 3 comments
Open

Add a checker merge config #2111

wangxp006 opened this issue Feb 28, 2022 · 3 comments

Comments

@wangxp006
Copy link
Contributor

wangxp006 commented Feb 28, 2022

Is your feature request to resolve a problem or provide enhanced functionality? Please describe.
Dear pqarmitage, we have this problem
The backend server is nginx, it may has more than 50 workers. And we have more than 10 backend server.
So, in keepalived, we will send 500+ checker packet in every check period.

Describe the solution you would like
We would like to check every backend server once in every check period.
If the check return ok, than we think all workers in nginx is work ok.
Even if one worker is down, nginx will reload the worker,short term failure is acceptable to us.

Describe alternatives you have considered


virtual_server 192.168.31.200 80 {   
    delay_loop 6  
    lb_algo rr    
    persistence_timeout 60 
    lb_kind FNAT  
    protocol TCP  
    laddr_group_name laddr_g1  
    alpha          
    omega         
    **checker_merge**   
    quorum 1        
    hysteresis 0    
    
    quorum_up "/usr/sbin/ip addr add 192.168.31.200/32 dev lo"
    real_server 192.168.31.248 5001 {      
        weight 6                  
        TCP_CHECK {                 
            connect_port 5001 
            connect_timeout 15     
            nb_get_retry 5           
            delay_before_retry 3     
        }
    }

    real_server 192.168.31.248 5002{      
        weight 6                  
        TCP_CHECK {                 
            connect_port 5002
            connect_timeout 15     
            nb_get_retry 5           
            delay_before_retry 3     
        }
    }
	
     real_server 192.168.31.248 5003{      
        weight 6                  
        TCP_CHECK {                 
            connect_port 5003
            connect_timeout 15     
            nb_get_retry 5           
            delay_before_retry 3     
        }
    }
}

We add a new config "checker_merge " in virtual_server 。
With this config ,if RS in the VS has same IP addr,We will only send a check message once with first port.
For example, the above configuration. we will only send check message to 192.168.31.248 5001。
And if check message returns OK, All three RS above will online.

We have finish this function development, and it seems to work well.
Is it possible that we can contribute this part of the code to the community ?

Keepalived version
Keepalived v2.2.4

@pqarmitage
Copy link
Collaborator

@wangxp006 We welcome contributions to the code, and the best thing to do is to submit a pull request.

I have been meaning to do something like this (for all checkers) for a long time. However, my approach, from the configuration side, would be slightly different, and it would follow the way track_file works.

TCP_CHECK nginx {
    connect_ip 192.168.31.248                 
    connect_port 5001 
    connect_timeout 15     
    nb_get_retry 5           
    delay_before_retry 3     
}

virtual_server 192.168.31.200 80 {   
    delay_loop 6  
    lb_algo rr    
    persistence_timeout 60 
    lb_kind FNAT  
    protocol TCP  
    laddr_group_name laddr_g1  
    alpha          
    omega         
    quorum 1        
    hysteresis 0    
    
    quorum_up "/usr/sbin/ip addr add 192.168.31.200/32 dev lo"
    real_server 192.168.31.248 5001 {      
        weight 6                  
        tcp_checkers {                 
            nginx
        }
    }

    real_server 192.168.31.248 5002{      
        weight 6                  
        tcp_checkers {                 
            nginx
        }
    }
	
     real_server 192.168.31.248 5003{      
        weight 6                  
        tcp_checkers {
            nginx    
        }
    }
}

The TCP_CHECK block should be able to take all the options of the current TCP_CHECK, but the connect_ip and connect_ports would always be required. In the tcp_checkers blocks, nginx is the name of the checker, which

I was thinking that it should have the following options: [weight <-2147483647..2147483647>] [reverse] after weight, so that the success or failure of the checker can adjust the configured weight of the real server(s) using the checker, but that doesn't appear to be implemented currently, so it is another feature to add in the future.

Please let me know if you are happy with the above suggestion.

You can either submit your code changes as they currently are and I will add a further patch to change the configuration to how I have set it out above, or you could change the configuration aspects of your code changes to the above and then submit it. Either way I look forward to you submitting your code.

@wangxp006
Copy link
Contributor Author

OK, I'll try to push the code next week。

@wangxp006
Copy link
Contributor Author

wangxp006 commented Apr 3, 2022

#2120
Sorry to have kept you waiting so long。
I have push the PR。Could you please help to review it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants