Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
lwc:mqtt [2021/09/20 19:30] John Harrisonlwc:mqtt [2021/10/20 09:31] (current) John Harrison
Line 31: Line 31:
 erase all retained messages: mosquitto_sub -i <client_id> -p <port> -h <host> --retained-only -t "#" -v | while read line; do let "x=x+1"; echo $x; mosquitto_pub -i <client_id> -p <port> -h <host> -t "${line% *}" -r -n; done' erase all retained messages: mosquitto_sub -i <client_id> -p <port> -h <host> --retained-only -t "#" -v | while read line; do let "x=x+1"; echo $x; mosquitto_pub -i <client_id> -p <port> -h <host> -t "${line% *}" -r -n; done'
 \\ \\
- 
  
 ===== HA Proxy: ===== ===== HA Proxy: =====
Line 37: Line 36:
 ==== Configuring for high # of connections (tested on 16.04) ==== ==== Configuring for high # of connections (tested on 16.04) ====
  
-edit /etc/sysctl.conf and add the following lines (increase open file limit and decrease memory use of TCP buffers: +edit ''/etc/sysctl.conf'' and add the following lines (increase open file limit and decrease memory use of TCP buffers: 
-  fs.file-max = 10000000 +<code> 
-  fs.nr_open = 10000000 +fs.file-max = 10000000 
-  net.ipv4.tcp_mem = 786432 1697152 1945728 +fs.nr_open = 10000000 
-  net.ipv4.tcp_rmem = 4096 4096 16777216 +net.ipv4.tcp_mem = 786432 1697152 1945728 
-  net.ipv4.tcp_wmem = 4096 4096 16777216 +net.ipv4.tcp_rmem = 4096 4096 16777216 
-  net.ipv4.ip_local_port_range = 1000 65535+net.ipv4.tcp_wmem = 4096 4096 16777216 
 +net.ipv4.ip_local_port_range = 15000 65535 
 +</code>
  
 edit /etc/security/limits.conf: edit /etc/security/limits.conf:
Line 53: Line 54:
 </code> </code>
  
-add to /etc/haproxy/haproxy.conf: +add to ''/etc/haproxy/haproxy.conf:'' in ''defaults:'' 
-In Global+<code> 
-  * maxconn 2000000 +maxconn 2000000 
-  *  +timeout connect 3000000 # necessary? 
-  *        maxconn 2000000 +timeout client 66000000 # necessary? 
-  *        timeout connect 3000000 # necessary? +timeout server 66000000 # necessary? 
-  *        timeout client 66000000 # necessary? +</code>  
-  *        timeout server 66000000 # necessary?+ 
 +check: 
 +<code> 
 +pidof haproxy 
 +cat /proc/630/limits | grep 'open files' 
 +</code>
  
-In +[[https://ma.ttias.be/linux-increase-ip_local_port_range-tcp-port-range/|increase ip_local_port_range]]
  
-References\\+=== References ===
  
   * [[http://rexpie.github.io/2015/08/26/loadbalancing-with-haproxy.html|Load balancing with HA proxy]]   * [[http://rexpie.github.io/2015/08/26/loadbalancing-with-haproxy.html|Load balancing with HA proxy]]
  • lwc/mqtt.1632184254.txt.gz
  • Last modified: 2021/09/20 19:30
  • by John Harrison