该部分仅登录用户可见
[2024-04-07 13:04:05] ERROR - file: shared_func.c, line: 1291, call setrlimit fail, resource=7, value=100000, errno: 22, error info: Invalid argument
主要是因为把启动fdfs的命令放到/etc/rc.local里面,或者放到/etc/init.d/里面,或者放到/etc/systemd/system里面,最终还是systemd作为主进程去拉起fdfs和storage进程。而由于默认systemd的limits与fdfs的设置好像有冲突(我还没有搞清楚里面的关系)。最终导致fdfs启动失败。
直接就该参数就好了:
cat <<'EOF'>/etc/sysctl.conf
fs.file-max=11000000
fs.nr_open=11000000
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_keepalive_time = 600
net.ipv4.tcp_keepalive_probes = 3
net.ipv4.tcp_keepalive_intvl =15
net.ipv4.tcp_retries2 = 5
net.ipv4.tcp_fin_timeout = 2
net.ipv4.tcp_max_tw_buckets = 36000
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_max_orphans = 32768
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_syn_backlog = 1000000
net.ipv4.tcp_wmem = 8192 131072 16777216
net.ipv4.tcp_rmem = 32768 131072 16777216
net.ipv4.tcp_mem = 786432 1048576 1572864
net.ipv4.ip_local_port_range = 1024 65000
net.core.netdev_max_backlog = 16384
net.core.somaxconn = 16384
net.netfilter.nf_conntrack_max=1048576
EOF
cat <<'EOF'>/etc/security/limits.conf
* soft nofile 10000000
* hard nofile 10000000
* soft nproc 10000000
* hard nproc 10000000
EOF
cat <<'EOF'>/etc/systemd/system.conf
[Manager]
LogLevel=debug
DefaultLimitNOFILE=10000000
EOF
cat <<'EOF'>/etc/systemd/user.conf
[Manager]
DefaultLimitNOFILE=10000000
EOF
然后重启,rc-local正常拉起了