1. to http://rpmfind.net/ Download the following 4 packages: Golang-1.6.2-1.fc24.ppc64le.rpmgolang-bin-1.6.2-1.fc24.ppc64le.rpmgolang-src-1.6.2-1.fc24.noarch.rpmgo-srpm-macro s-2-3.fc23.noarch.rpm2. yum -y install golang*.rpm3. set the Gopath variable to $HOME, namely: Export gopath= $HOME 4. Installation gb go get github.com/constabulary/gb/... 5. Download confd-0.11.0 tar.gz pack Cd confd-0.11.0./build && ./install6. cat > /usr/lib/systemd/system/confd.service <<eof[unit]description=confdafter= haproxy.service[service]execstart=/usr/bin/confdrestart=always[install]wantedby=basic.targeteof7. Create a configuration and template catalog mkdir -p /etc/confd/{conf.d,templates}8. create CONFD's master configuration (global configuration) file, which is used to set some settings related to ETCD server. Configure the following:cat > /etc/confd/confd.toml <<eofconfdir = "/ETC/CONFD" # Specifies the master configuration directory for CONFD interval = 20 #指定间隔多长时间与etcd同步更新backend = "Etcd" #指定后端的键值存储服务器的类型, such as: ETCD, Consul, zookeepernodes = [#指To list the backend nodes, you can have multiple "http://172.16.0.204:4001" #此地址为etcd服务器的地址]prefix = "/" #键的前缀是什么scheme = " HTTP "#指定后端的scheme, such as: HTTP, httpsverbose = trueeof9. the configuration file for the specified application in/etc/confd/conf.d , Here is HAPROXY.TOML, configured as follows:cat > /etc/confd/confd.toml <<eof[template]src = " Haproxy.cfg.tmpl "#定义配置文件的模板名称, this file is stored in/etc/confd/templatesdest = "/etc/haproxy/haproxy.cfg "# The profile path of the haproxy to be synchronized keys = ["/backend" #指定后端存放键值的目录]reload_cmd = "/usr/bin/systemctl Reload haproxy "#更新同步完配置文件后, reload the Haproxy service eof10. generate Haproxy.cfg.tmpl template file: (slightly): frontend http-in bind *:8080 acl homepage path_reg ^/$ acl status path_beg /haproxyadmin&nbSp; redirect location /hds/ if homepage use_backend status if status default_backend appbackend status stats enable stats hide-version stats uri /haproxyadmin?stats stats realm haproxy\ statistics stats auth admin:admin stats admin if truebackend app balance source option httpclose option forwardfor {{range gets "/backend/*"}} #range表示循环, Gets represents the Get key value pair server {{base . key}} {{. value}} check maxconn 1000#base . key is similar to the Linux command basename;.value the value that corresponds to the key. {{end}}11. systemctl enable /etc/systemd/system/confd.servicesystemctl start /etc/systemd/system/confd.service Note: The backend ETCD server is configured as follows: curl http://172.16.0.204:4001/v2/keys/ Backend/app1 -xput -d value= ' 172.16.1.45:8080 ' curl http://172.16.0.204:4001/v2/keys/ Backend/app2 -xput -d value= ' 172.16.0.204:8080 '
This article is from the "Everything Possible" blog, please be sure to keep this source http://noican.blog.51cto.com/4081966/1773834
Ppc64le Centos7 installs CONFD and combines ETCD for high availability Haproxy