# mqtt **Repository Path**: kannon01/mqtt ## Basic Information - **Project Name**: mqtt - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-06-12 - **Last Updated**: 2024-08-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 修改`/etc/sysctl.conf` 文件 ```azure echo " # 星号表示所有用户,noproc代表最大进程数,nofile代表最大打开文件数 * soft nofile 12000000 * hard nofile 12000000 * soft nproc 12000000 * hard nproc 12000000 " >> /etc/security/limits.conf && \ echo " net.ipv4.tcp_wmem = 4096 87380 4161536 net.ipv4.tcp_rmem = 4096 87380 4161536 net.ipv4.tcp_mem = 786432 2097152 3145728 net.core.somaxconn=65536 fs.file-max = 12000000 fs.nr_open=12000000 kernel.pid_max = 655360 " >> /etc/sysctl.conf echo 12000000 > /proc/sys/fs/nr_open sysctl -p ulimit -n ``` ` ./go_build_cp7_bench_sub_go_linux -workers=1000000 -cid=tqy -topic=null -qos=0 -url=tcp://192.168.1.236:1883 -keepalive=60000s -clear=true /sbin/sysctl -p` 生效 docker run -d --name emqx --network=host emqx/emqx:5.5.0 ## 客户端设置 ```azure -- ifconfig ens192:0 192.168.1.100 netmask 255.255.255.0 up ifconfig ens192:1 192.168.1.101 netmask 255.255.255.0 up ifconfig ens192:2 192.168.1.102 netmask 255.255.255.0 up ifconfig ens192:3 192.168.1.103 netmask 255.255.255.0 up ifconfig ens192:4 192.168.1.104 netmask 255.255.255.0 up ifconfig ens192:5 192.168.1.105 netmask 255.255.255.0 up ifconfig ens192:6 192.168.1.106 netmask 255.255.255.0 up ifconfig ens192:7 192.168.1.107 netmask 255.255.255.0 up ifconfig ens192:8 192.168.1.108 netmask 255.255.255.0 up ifconfig ens192:9 192.168.1.109 netmask 255.255.255.0 up ifconfig ens192:10 192.168.1.110 netmask 255.255.255.0 up ifconfig ens192:11 192.168.1.111 netmask 255.255.255.0 up ifconfig ens192:12 192.168.1.112 netmask 255.255.255.0 up ifconfig ens192:13 192.168.1.113 netmask 255.255.255.0 up ifconfig ens192:14 192.168.1.114 netmask 255.255.255.0 up ifconfig ens192:15 192.168.1.115 netmask 255.255.255.0 up ifconfig ens192:16 192.168.1.116 netmask 255.255.255.0 up ifconfig ens192:17 192.168.1.117 netmask 255.255.255.0 up ifconfig ens192:18 192.168.1.118 netmask 255.255.255.0 up ifconfig ens192:19 192.168.1.119 netmask 255.255.255.0 up ifconfig ens192:20 192.168.1.120 netmask 255.255.255.0 up ifconfig ens192:21 192.168.1.121 netmask 255.255.255.0 up ifconfig ens192:22 192.168.1.122 netmask 255.255.255.0 up ifconfig ens192:23 192.168.1.123 netmask 255.255.255.0 up ifconfig ens192:24 192.168.1.124 netmask 255.255.255.0 up ifconfig ens192:25 192.168.1.125 netmask 255.255.255.0 up ifconfig ens192:26 192.168.1.126 netmask 255.255.255.0 up ifconfig ens192:27 192.168.1.127 netmask 255.255.255.0 up ifconfig ens192:28 192.168.1.128 netmask 255.255.255.0 up ifconfig ens192:29 192.168.1.129 netmask 255.255.255.0 up ifconfig ens192:0 del 192.168.1.100 ifconfig ens192:21 del 192.168.1.122 ifconfig ens192:2 del 192.168.1.102 ifconfig ens192:3 del 192.168.1.103 ifconfig ens192:4 del 192.168.1.104 ifconfig ens192:5 del 192.168.1.105 ifconfig ens192:6 del 192.168.1.106 ifconfig ens192:7 del 192.168.1.107 ifconfig ens192:8 del 192.168.1.108 ifconfig ens192:9 del 192.168.1.109 n=$1 for (( i=0; i<$n; i++ )) do ifconfig ens192:$((20+i)) del 192.168.1.$((120+i)) done ./emqtt_bench -h 192.168.1.236 -c 60000 --ifaddr 192.168.1.100 ./emqtt_bench pub -t t -s 16 -q 0 -I 10000 -h 192.168.1.236 -c 60000 --ifaddr 192.168.1.100 ``` 修改`/etc/sysctl.conf` 文件 ```azure echo " # 星号表示所有用户,noproc代表最大进程数,nofile代表最大打开文件数 * soft nofile 12000000 * hard nofile 12000000 * soft nproc 12000000 * hard nproc 12000000 " >> /etc/security/limits.conf && \ echo " fs.file-max = 12000000 fs.nr_open = 12000000 net.ipv4.ip_local_port_range = 1024 65535 " >> /etc/sysctl.conf echo 12000000 > /proc/sys/fs/nr_open sysctl -p ulimit -n 12000000 ``` netstat -nat|grep -i "1883"|wc -l pin