亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

編譯安裝HAProxy for Ubuntu1804

發布時間:2020-08-07 22:59:15 來源:網絡 閱讀:1145 作者:何小帥 欄目:系統運維

環境

OS:Ubuntu1804
haproxy: http://www.haproxy.org/download/2.0/src/haproxy-2.0.4.tar.gz
lua:http://www.lua.org/ftp/lua-5.3.5.tar.gz
IP:192.168.7.182

安裝步驟

1.準備編譯安裝HAProxy的基礎環境
# apt install make gcc build-essential libssl-dev zlib1g-dev libpcre3 libpcre3-dev libsystemd-dev libreadline-dev -y

2.編譯安裝lua,為HAProxy支持基于其實現功能擴展。
注:HAProxy要求的lua最低版本為5.3
2.1 下載并且安裝lua
# wget -P /usr/local/src/ http://www.lua.org/ftp/lua-5.3.5.tar.gz
# cd /usr/local/src/
# tar xf lua-5.3.5.tar.gz
# cd lua-5.3.5/src/
# make linux
2.2 查看編譯后的版本
# ./lua -v
Lua 5.3.5  Copyright (C) 1994-2018 Lua.org, PUC-Rio

3.編譯安裝haproxy
3.1 解壓并安裝
# cd /usr/local/src/
# tar xf haproxy-2.0.4.tar.gz
# cd haproxy-2.0.4
# make -j `lscpu |awk 'NR==4{print $2}'` ARCH=x86_64 TARGET=linux-glibc USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 USE_SYSTEMD=1 USE_CPU_AFFINITY=1 USE_LUA=1 LUA_INC=/usr/local/src/lua-5.3.5/src/ LUA_LIB=/usr/local/src/lua-5.3.5/src/ PREFIX=/apps/haproxy && make install PREFIX=/apps/haproxy
3.2 查看編譯安裝好的版本信息
# ./haproxy -v
HA-Proxy version 2.0.4 2019/08/06 - https://haproxy.org/

4.編寫haproxy啟動腳本
# cat > /lib/systemd/system/haproxy.service << EOF                
[Unit]
Description=HAProxy Load Balancer
After=syslog.target network.target

[Service]
ExecStartPre=/apps/haproxy/sbin/haproxy -f /etc/haproxy/haproxy.cfg -c
ExecStart=/apps/haproxy/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p /var/lib/haproxy/haproxy.pid
ExecReload=/bin/kill -USR2 \$MAINPID

[Install]
WantedBy=multi-user.target
EOF

5.編寫配置文件/etc/haproxy/haproxy.cfg
# mkdir /etc/haproxy
# cat > /etc/haproxy/haproxy.cfg << EOF
global
    maxconn 100000
    chroot /usr/local/haproxy
    stats socket /var/lib/haproxy/haproxy.sock mode 600 level admin
    uid 99
    gid 99
    daemon
    pidfile /var/lib/haproxy/haproxy.pid
    log 127.0.0.1 local3 info

defaults
    option http-keep-alive
    option forwardfor
    maxconn 100000
    mode http
    timeout connect 300s
    timeout client  300s
    timeout server  300s

listen stats
    bind  :9009
    stats enable
    stats uri /status
    stats auth admin:123456
    stats realm HAPorxy\ Stats\ Page
EOF

6.創建相關目錄
# mkdir /var/lib/haproxy
# mkdir /usr/local/haproxy
# chown 99.99 /var/lib/haproxy/ -R

7.啟動并設為開機自啟動和查看haproxy狀態
# systemctl enable --now haproxy
# systemctl status haproxy
● haproxy.service - HAProxy Load Balancer
   Loaded: loaded (/lib/systemd/system/haproxy.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2020-01-12 15:18:00 CST; 11min ago
  Process: 9898 ExecStartPre=/apps/haproxy/sbin/haproxy -f /etc/haproxy/haproxy.cfg -c (code=exited, status=0/SUCCESS)
 Main PID: 9901 (haproxy)
    Tasks: 3 (limit: 2290)
   CGroup: /system.slice/haproxy.service
           ├─9901 /apps/haproxy/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p /var/lib/haproxy/haproxy.pid
           └─9911 /apps/haproxy/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p /var/lib/haproxy/haproxy.pid

Jan 12 15:18:00 ubuntu1804-02 systemd[1]: Starting HAProxy Load Balancer...
Jan 12 15:18:00 ubuntu1804-02 haproxy[9898]: Configuration file is valid
Jan 12 15:18:00 ubuntu1804-02 systemd[1]: Started HAProxy Load Balancer.
Jan 12 15:18:00 ubuntu1804-02 haproxy[9901]: [NOTICE] 011/151800 (9901) : New worker #1 (9911) forked

8.訪問測試狀態頁

編譯安裝HAProxy for Ubuntu1804
編譯安裝HAProxy for Ubuntu1804

遇到的報錯及解決辦法

編譯lua相關

報錯 lua.c:82:10: fatal error: readline/readline.h: No such file or directory

# apt install libreadline-dev -y

編譯haproxy相關

報錯 include/common/regex.h:31:10: fatal error: pcre.h: No such file or directory

# apt install libpcre3-dev -y

報錯 include/common/openssl-compat.h:5:10: fatal error: openssl/bn.h: No such file or directory

# apt install libssl-dev -y

報錯 include/types/compression.h:32:10: fatal error: zlib.h: No such file or directory

# apt install zlib1g-dev -y

報錯 src/haproxy.c:72:10: fatal error: systemd/sd-daemon.h: No such file or directory

# apt install libsystemd-dev -y
向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

定陶县| 乌苏市| 华坪县| 如东县| 无极县| 太白县| 墨脱县| 红安县| 吉林市| 华坪县| 台安县| 钟祥市| 凤冈县| 博野县| 岳西县| 合川市| 琼中| 正镶白旗| 安顺市| 永善县| 陇南市| 凉山| 辛集市| 五台县| 甘南县| 汽车| 曲周县| 望都县| 通海县| 沅江市| 厦门市| 通化县| 会宁县| 宽甸| 罗田县| 松原市| 措美县| 垦利县| 阿巴嘎旗| 贡觉县| 垣曲县|