2022年4月27日水曜日

poundでロードバランサを構築してみた。(ELB)

【rocky linux9 追記 20240119】
# dnf config-manager --set-enabled crb
# dnf install epel-release

※ epel 有効/無効
# dnf config-manager --enable epel
# dnf config-manager --disable epel * default

※ Rocky Linux9は、現在のところPoundをサポートしていなかった。
     Rocky Linux8で実施。


---------------------Rocky linux 8 ---------------------------------
# dnf --enablerepo=epel install Pound

# pound -V
starting...
Version 2.8-patrodyne-20191230
Configuration switches:
Exiting...

# vi /etc/pound.cfg
User "pound"
Group "pound"
Control "/var/lib/pound/pound.cfg"

LogLevel     1
Alive        10
Daemon       1
LogFacility  daemon
Client       300
TimeOut      3600
Threads       256

ListenHTTP
  Address 0.0.0.0
  Port 80
  Err414 "/var/www/Err414"
  Err500 "/var/www/Err500"
  Err501 "/var/www/Err501"
  Err503 "/var/www/Err503"
End
ListenHTTPS
  Address 0.0.0.0
  Port 443
  Cert "/etc/pki/tls/certs/pound.pem"
End
Service
  BackEnd
    Address 192.168.21.101
    Port 80
  End
  BackEnd
    Address 192.168.21.102
    Port 80
  End
  Session
    Type    COOKIE
    ID      "sessionid"
    TTL     120
  End
End

# pound -c -v

# firewall-cmd --add-service=http --zone=public --permanent
# firewall-cmd --add-service=https --zone=public --permanent
# firewall-cmd --reload

# systemctl start pound
# systemctl enable pound

# systemctl status pound
● pound.service - Pound Reverse Proxy And Load-balancer
   Loaded: loaded (/usr/lib/systemd/system/pound.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2022-05-30 08:30:51 JST; 58min ago
  Process: 1069 ExecStart=/usr/sbin/pound (code=exited, status=0/SUCCESS)
 Main PID: 1111 (pound)
    Tasks: 132 (limit: 11272)
   Memory: 36.0M
   CGroup: /system.slice/pound.service
           ├─1111 /usr/sbin/pound
           └─1112 /usr/sbin/pound

 5月 30 09:22:28 elb_web pound[1112]: 192.168.20.2 GET /assets/images/menu/enter2.png HTTP/1.1 - HTTP/1.1 200 OK
 5月 30 09:22:28 elb_web pound[1112]: 192.168.20.2 GET /assets/images/menu/acount2-1.png HTTP/1.1 - HTTP/1.1 200 OK
 5月 30 09:22:28 elb_web pound[1112]: 192.168.20.2 GET /assets/images/menu/setup.png HTTP/1.1 - HTTP/1.1 200 OK
 5月 30 09:22:28 elb_web pound[1112]: 192.168.20.2 GET /assets/images/menu/log2.png HTTP/1.1 - HTTP/1.1 200 OK
 5月 30 09:22:28 elb_web pound[1112]: 192.168.20.2 GET /assets/images/menu/exit2.png HTTP/1.1 - HTTP/1.1 200 OK
 5月 30 09:22:28 elb_web pound[1112]: 192.168.20.2 GET /assets/vendor/fonts/inter/Inter-Bold.woff2?v=3.13 HTTP/1.1 - HTTP/1.1 200 OK
 5月 30 09:22:32 elb_web pound[1112]: 192.168.20.2 GET /test/logout/?jump= HTTP/1.1 - HTTP/1.1 200 OK
 5月 30 09:22:34 elb_web pound[1112]: 192.168.20.2 GET /test/top/ HTTP/1.1 - HTTP/1.1 302 Found
 5月 30 09:22:34 elb_web pound[1112]: 192.168.20.2 GET /test/login/?next=/test/top/ HTTP/1.1 - HTTP/1.1 200 OK
 5月 30 09:22:37 elb_web pound[1112]: 192.168.20.2 GET /test/login/?next=/test/top/ HTTP/1.1 - HTTP/1.1 200 OK


※ マニュアル(https://linux.die.net/man/8/pound

0 件のコメント:

コメントを投稿

シャットダウン時の後処理 (shutdown)

# vi /etc/systemd/system/drop.service [Unit] Description= stop httpgwd DefaultDependencies=no Before=shutdown.target RefuseManualStart=true ...