Created
August 4, 2021 17:18
-
-
Save haproxytechblog/5c9f3df627345690188a62e46fc7cfeb to your computer and use it in GitHub Desktop.
The HAProxy APIs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global | |
stats socket /var/run/haproxy/api.sock user haproxy group haproxy mode 660 level admin expose-fd listeners |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global | |
stats socket ipv4@127.0.0.1:9999 level admin expose-fd listeners |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ echo "help" | sudo socat stdio /var/run/haproxy/api.sock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ echo "help" | socat stdio tcp4-connect:127.0.0.1:9999 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ echo "set server webservers/server1 state drain" |\ | |
sudo socat stdio /var/run/haproxy/api.sock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo dataplaneapi -f /etc/haproxy/dataplaneapi.hcl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ curl -X GET --user admin:adminpwd http://localhost:5555/v2/info | |
{"api":{"build_date":"0001-01-01T00:00:00.000Z","version":"v2.2.0 68bd22b"},"system":{}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment