{"id":480,"date":"2013-10-16T13:25:56","date_gmt":"2013-10-16T20:25:56","guid":{"rendered":"http:\/\/blog.ls-al.com\/?p=480"},"modified":"2013-10-16T13:40:51","modified_gmt":"2013-10-16T20:40:51","slug":"haproxy-on-solaris-11","status":"publish","type":"post","link":"https:\/\/blog.ls-al.com\/haproxy-on-solaris-11\/","title":{"rendered":"HAProxy on Solaris 11"},"content":{"rendered":"

Quick example of a simple HAProxy setup on Solaris 11.<\/p>\n

Create a suitable home and download the binary:<\/strong><\/p>\n

\r\n# pwd\r\n\/usr\/local\/haproxy\r\n\r\n# wget http:\/\/haproxy.1wt.eu\/download\/1.4\/bin\/haproxy-1.4.24-pcre-solaris-sparc.notstripped.gz\r\n\r\n# gzip -d haproxy-1.4.24-pcre-solaris-sparc.notstripped.gz\r\n# chmod +x haproxy-1.4.24-pcre-solaris-sparc.notstripped\r\n# file haproxy-1.4.24-pcre-solaris-sparc.notstripped\r\nhaproxy-1.4.24-pcre-solaris-sparc.notstripped: ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, dynamically linked, not stripped\r\n\r\n# .\/haproxy-1.4.24-pcre-solaris-sparc.notstripped\r\nHA-Proxy version 1.4.24 2011\/03\/09\r\nCopyright 2000-2010 Willy Tarreau &lt;w@1wt.eu&gt;\r\nUsage : .\/haproxy-1.4.24-pcre-solaris-sparc.notstripped [-f ]* [ -vdVD ] [ -n ] [ -N ]\r\n[ -p ] [ -m ]\r\n-v displays version ; -vv shows known build options.\r\n-d enters debug mode ; -db only disables background mode.\r\n-V enters verbose mode (disables quiet mode)\r\n-D goes daemon\r\n-q quiet mode : don't display messages\r\n-c check mode : only check config files and exit\r\n-n sets the maximum total # of connections (2000)\r\n-m limits the usable amount of memory (in MB)\r\n-N sets the default, per-proxy maximum # of connections (2000)\r\n-p writes pids of all children to this file\r\n-dp disables poll() usage even when available\r\n-sf\/-st [pid ]* finishes\/terminates old pids. Must be last arguments.\r\n<\/pre>\n

Setup a small config file:<\/strong><\/p>\n

\r\n# cat haproxy.cfg\r\nglobal\r\ndaemon\r\nmaxconn 256\r\n\r\ndefaults\r\nmode http\r\ntimeout connect 5000ms\r\ntimeout client 50000ms\r\ntimeout server 50000ms\r\n\r\nfrontend http-in\r\nbind *:80\r\ndefault_backend app1\r\n\r\nbackend app1\r\nserver s1 10.0.1.10:80 maxconn 32\r\nserver s2 10.0.1.11:80 maxconn 32\r\nserver s3 10.0.1.12:80 maxconn 32\r\n\r\nlisten admin\r\nbind *:8080\r\nstats enable\r\n<\/pre>\n

Stop anything running on the ports you want to listen on:<\/strong><\/p>\n

\r\n# svcs -a | grep apache\r\ndisabled Oct_10 svc:\/network\/http:apache22\r\n<\/pre>\n

Run the HAProxy binary and config:<\/strong><\/p>\n

\r\n# .\/haproxy-1.4.24-pcre-solaris-sparc.notstripped -f .\/haproxy.cfg\r\n# ps -ef | grep haproxy\r\nroot 20765 1 0 08:31:46 ? 0:00 .\/haproxy-1.4.24-pcre-solaris-sparc.notstripped -f .\/haproxy.cfg\r\n<\/pre>\n

Test the stats page and the load balanced page you configured:<\/strong><\/p>\n

http:\/\/lbserver:8080\/haproxy?stats<\/p>\n

http:\/\/lbserver\/myapp\/<\/p>\n","protected":false},"excerpt":{"rendered":"

Quick example of a simple HAProxy setup on Solaris 11. Create a suitable home and download the binary: # pwd<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[37,14],"tags":[],"class_list":["post-480","post","type-post","status-publish","format-standard","hentry","category-haproxy","category-solaris"],"_links":{"self":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts\/480","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/comments?post=480"}],"version-history":[{"count":0,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts\/480\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/media?parent=480"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/categories?post=480"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/tags?post=480"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}