web-dev-qa-db-ja.com

Ubuntu16.04でRedisサーバーを起動できません

Ubuntu16.04でredisサーバーを起動できません。これでインストールしました repo

Systemd redis.serviceファイルを再確認しましたが、問題ないようです。バイナリを指します。

Systemctlステータス

Redis-server.service - Advanced key-value store
   Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
   Active: inactive (dead) (Result: resources) since Fri 2018-05-25 22:08:43 EDT; 1min 3s ago
     Docs: http://redis.io/documentation,
           man:redis-server(1)
  Process: 29520 ExecStopPost=/bin/run-parts --verbose /etc/redis/redis-server.post-down.d (code=exited, status=0/SUCCESS)
  Process: 29515 ExecStop=/bin/kill -s TERM $MAINPID (code=exited, status=0/SUCCESS)
  Process: 29509 ExecStop=/bin/run-parts --verbose /etc/redis/redis-server.pre-down.d (code=exited, status=0/SUCCESS)
  Process: 29505 ExecStartPost=/bin/run-parts --verbose /etc/redis/redis-server.post-up.d (code=exited, status=0/SUCCESS)
  Process: 29500 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS)
  Process: 29496 ExecStartPre=/bin/run-parts --verbose /etc/redis/redis-server.pre-up.d (code=exited, status=0/SUCCESS)
 Main PID: 18177 (code=exited, status=1/FAILURE)

May 25 22:08:43 mysqlwebserv systemd[1]: Failed to start Advanced key-value store.
May 25 22:08:43 mysqlwebserv systemd[1]: redis-server.service: Unit entered failed state.
May 25 22:08:43 mysqlwebserv systemd[1]: redis-server.service: Failed with result 'resources'.
May 25 22:08:43 mysqlwebserv systemd[1]: redis-server.service: Service hold-off time over, scheduling restart.
May 25 22:08:43 mysqlwebserv systemd[1]: Stopped Advanced key-value store.
May 25 22:08:43 mysqlwebserv systemd[1]: redis-server.service: Start request repeated too quickly.
May 25 22:08:43 mysqlwebserv systemd[1]: Failed to start Advanced key-value store.

Journalctl:

Subject: Unit redis-server.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit redis-server.service has failed.
--
-- The result is failed.
May 25 21:57:56 mysqlwebserv systemd[1]: redis-server.service: Unit entered failed state.
May 25 21:57:56 mysqlwebserv systemd[1]: redis-server.service: Failed with result 'resources'.
May 25 21:57:56 mysqlwebserv systemd[1]: redis-server.service: Service hold-off time over, scheduling restart.
May 25 21:57:56 mysqlwebserv systemd[1]: Stopped Advanced key-value store.
-- Subject: Unit redis-server.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit redis-server.service has finished shutting down.
May 25 21:57:56 mysqlwebserv systemd[1]: Starting Advanced key-value store...
-- Subject: Unit redis-server.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit redis-server.service has begun starting up.
May 25 21:57:56 mysqlwebserv run-parts[27649]: run-parts: executing /etc/redis/redis-server.pre-up.d/00_example
May 25 21:57:56 mysqlwebserv run-parts[27659]: run-parts: executing /etc/redis/redis-server.post-up.d/00_example
May 25 21:57:56 mysqlwebserv systemd[1]: redis-server.service: PID file /var/run/redis/redis-server.pid not readable (yet?) after start-post: No such file or directory
May 25 21:57:56 mysqlwebserv run-parts[27663]: run-parts: executing /etc/redis/redis-server.pre-down.d/00_example
May 25 21:57:56 mysqlwebserv run-parts[27674]: run-parts: executing /etc/redis/redis-server.post-down.d/00_example
May 25 21:57:56 mysqlwebserv systemd[1]: Failed to start Advanced key-value store.
-- Subject: Unit redis-server.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit redis-server.service has failed.
--
-- The result is failed.
May 25 21:57:56 mysqlwebserv systemd[1]: redis-server.service: Unit entered failed state.
May 25 21:57:56 mysqlwebserv systemd[1]: redis-server.service: Failed with result 'resources'.
May 25 21:57:57 mysqlwebserv systemd[1]: redis-server.service: Service hold-off time over, scheduling restart.
May 25 21:57:57 mysqlwebserv systemd[1]: Stopped Advanced key-value store.
-- Subject: Unit redis-server.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit redis-server.service has finished shutting down.
May 25 21:57:57 mysqlwebserv systemd[1]: redis-server.service: Start request repeated too quickly.
May 25 21:57:57 mysqlwebserv systemd[1]: Failed to start Advanced key-value store.
-- Subject: Unit redis-server.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit redis-server.service has failed.
--
-- The result is failed.
May 25 21:58:01 mysqlwebserv CRON[27696]: pam_unix(cron:session): session opened for user tyler by (uid=0)
May 25 21:58:01 mysqlwebserv CRON[27697]: (tyler) CMD (wget -q --no-check-certificate -O - http://23.226.233.137/gamepanel/startupdates.php >/dev/null 2>&1)
May 25 21:58:18 mysqlwebserv Sudo[27730]: wh1t3rose : TTY=pts/3 ; PWD=/usr/local ; USER=root ; COMMAND=/bin/journalctl -xe
May 25 21:58:18 mysqlwebserv Sudo[27730]: pam_unix(Sudo:session): session opened for user root by wh1t3rose(uid=0)

Redis.serviceファイル

[Unit]
Description=Advanced key-value store
After=network.target
Documentation=http://redis.io/documentation, man:redis-server(1)

[Service]
Type=forking
ExecStart=/usr/bin/redis-server /etc/redis/redis.conf
PIDFile=/var/run/redis/redis-server.pid
TimeoutStopSec=0
Restart=always
User=redis
Group=redis
RuntimeDirectory=redis
RuntimeDirectoryMode=2755

ExecStartPre=-/bin/run-parts --verbose /etc/redis/redis-server.pre-up.d
ExecStartPost=-/bin/run-parts --verbose /etc/redis/redis-server.post-up.d
ExecStop=-/bin/run-parts --verbose /etc/redis/redis-server.pre-down.d
ExecStop=/bin/kill -s TERM $MAINPID
ExecStopPost=-/bin/run-parts --verbose /etc/redis/redis-server.post-down.d

UMask=007
PrivateTmp=yes
LimitNOFILE=65535
PrivateDevices=yes
ProtectHome=yes
ReadOnlyDirectories=/
ReadWriteDirectories=-/var/lib/redis
ReadWriteDirectories=-/var/log/redis
ReadWriteDirectories=-/var/run/redis
CapabilityBoundingSet=~CAP_SYS_PTRACE

# redis-server can write to its own config file when in cluster mode so we
# permit writing there by default. If you are not using this feature, it is
# recommended that you replace the following lines with "ProtectSystem=full".
ProtectSystem=true
ReadWriteDirectories=-/etc/redis

[Install]
WantedBy=multi-user.target
Alias=redis.service
1
Sandman007
  1. Redis-serverを完全に削除します

    Sudo apt-get --purge remove redis-server
    
  2. 残りのredisファイルを確実にクリーンアップするために

    Sudo rm -rf /etc/redis/dump.rdb
    
  3. マシンを再起動します。
  4. 次に、redis-serverを再インストールします

    Sudo apt-get update
    Sudo apt-get install redis-server
    

16.04で以下を使用してredisをインストールします

apt update
apt upgrade

最後にサーバーをredisします

apt install redis-server

Redisクライアントによるインストールを確認してください。次のように表示されます。

# redis-cli
127.0.0.1:6379>
0
Pranoy Gn