每当我使用 sudo systemctl start redis-server
时,激活的 shell/进程都不会完成。
systemctl status redis-server
节目
activating (start) since Thu 2021-01-07 22:13:35 CET; 1min 52s ago
服务器运行
$ redis-cli ping -> 乒乓球
但我想知道如何正确启用此服务。 我的 redis-server.service
$ cat /etc/systemd/system/redis-server.service
# example systemd service unit file for redis-server
#
# In order to use this as a template for providing a redis service in your
# environment, _at the very least_ make sure to adapt the redis configuration
# file you intend to use as needed (make sure to set "supervised systemd"), and
# to set sane TimeoutStartSec and TimeoutStopSec property values in the unit's
# "[Service]" section to fit your needs.
#
# Some properties, such as User= and Group=, are highly desirable for virtually
# all deployments of redis, but cannot be provided in a manner that fits all
# expectable environments. Some of these properties have been commented out in
# this example service unit file, but you are highly encouraged to set them to
# fit your needs.
#
# Please refer to systemd.unit(5), systemd.service(5), and systemd.exec(5) for
# more information.
[Unit]
Description=Redis data structure server
Documentation=https://redis.io/documentation
#Before=your_application.service another_example_application.service
#AssertPathExists=/var/lib/redis
Wants=network-online.target
After=network-online.target
[Service]
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
## Alternatively, have redis-server load a configuration file:
#ExecStart=/usr/local/bin/redis-server /path/to/your/redis.conf
LimitNOFILE=10032
NoNewPrivileges=yes
#OOMScoreAdjust=-900
#PrivateTmp=yes
Type=notify
TimeoutStartSec=infinity
TimeoutStopSec=infinity
UMask=0077
#User=redis
#Group=redis
#WorkingDirectory=/var/lib/redis
[Install]
WantedBy=multi-user.target
几行来自 /etc/redis/redis.conf
bind 127.0.0.1
timeout 0
daemonize no
supervised systemd
pidfile /var/run/redis_6379.pid
我只能在日志文件中看到一个警告:
61912:M 07 Jan 2021 22:33:08.494 # 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.
有什么想法吗?