Redis で開いたファイルの最大数を増やすことはできません。

Redis で開いたファイルの最大数を増やすことはできません。

私はubunto 18.04を使用していますが、redis-server端末で実行すると次のようになります。

# oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
# Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=11260, just started
# Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
# You requested maxclients of 10000 requiring at least 10032 max file descriptors.
# Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
# Current maximum open files is 1022. maxclients has been reduced to 990 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
# Creating Server TCP listening socket *:6379: bind: Address already in use

以前は、次を実行してこの制限を増やそうとしました。

ulimit -n 10240

ただし、次のエラーが発生しました。

bash: ulimit: open files: cannot modify limit: Operation not permitted

その後、実行して値を下げようとしましたが、ulimit -n 1022驚くほど正常に実行され、制限が低くなりました。

だから私も従うこの回答しかし、echo 800000 > /proc/sys/fs/file-max"file-max"ファイルを上書きした後、実際に最大ファイル制限を変更しませんでした。

$ ulimit -n 
1022

ここ他の関連質問を見つけましたが、私の場合は次のようになります。システムC一つ。私は次を試してみます。

/etc/security/limits.conf1)ファイルに次の行を追加しました。

* soft nofile 4096
* hard nofile 10240

/etc/ssh/sshd_config2) ファイルに次の行を追加します。

UsePAM=yes

3) 「/etc/pam.d/sshd」ファイルに次の内容を追加します。

session    required   pam_limits.so

しかし、まだ効果はありません。ulimit -nコマンドにはまだ 1022 が表示されます。

ベストアンサー1

おすすめ記事