使用套件管理器在 OpenSuse 42.1 上安裝 Redis 3.2.4。該機有16GB記憶體。
執行這些步驟即可運行。 (我想以守護進程身份運行,但尚未更改設定。)
cp default.conf.example default.conf
chown root.redis default.conf
systemctl enable redis@default
systemctl start redis@default
service redis start
出現這些錯誤:
54778:C 18 Jan 12:38:56.664 # systemd supervision requested, but NOTIFY_SOCKET not found
54778:M 18 Jan 12:38:56.665 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
54778:M 18 Jan 12:38:56.665 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
54778:M 18 Jan 12:38:56.665 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
54778:M 18 Jan 12:38:56.666 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
54778:M 18 Jan 12:38:56.666 # Server started, Redis version 3.2.4
54778:M 18 Jan 12:38:56.666 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
54778:M 18 Jan 12:38:56.666 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
答案1
Type=forking
必須在節文件中[Service]
輸入一行redis.service
適用於 Ubuntu 類型sudo nano /etc/systemd/system/redis.service
答案2
看來你需要調整你的 Linux 核心。查看 sysctl 指令、sysctl.conf 設定檔以及它們各自的手冊頁。
您需要增加以下內核值:最大檔案描述符、最大開啟檔案、最大連接數、啟用過度使用記憶體並停用透明大頁面。並在此之後重新啟動
看來您的 redis 實例正在運行,但效能有限