Discover Centmin Mod today
Register Now

Sysadmin Redis server generated by redis-generator failed to start

Discussion in 'System Administration' started by pdinh97qng, May 4, 2021.

  1. pdinh97qng

    pdinh97qng Member

    121
    15
    18
    Jan 24, 2016
    Ratings:
    +39
    Local Time:
    6:44 AM
    @eva2000 I just setup a new server for testing and look like redis servers that are generated by redis-generator.sh are failed to start. I did test on 2 different VPSs, same error.
    • CentOS Version: CentOS 7 64bit
    • Centmin Mod Version Installed: 123.09beta01
    • Nginx Version Installed: 1.19.10
    • PHP Version Installed: 8.0.5
    • MariaDB MySQL Version Installed: 10.4.18
    Code:
    ./redis-generator.sh multi-cache 2
    
    Creating redis servers (with ondisk persistence disabled) starting at TCP = 6479...
    -------------------------------------------------------
    creating redis server: redis6479.service [increment value: 0]
    redis TCP port: 6479
    create systemd redis6479.service
    cp -a /usr/lib/systemd/system/redis.service /usr/lib/systemd/system/redis6479.service
    create /etc/redis6479/redis6479.conf config file
    mkdir -p /etc/redis6479
    cp -a /etc/redis/redis.conf /etc/redis6479/redis6479.conf
    -rw-r----- 1 redis root 92K May  4 12:13 /etc/redis6479/redis6479.conf
    -rw-r--r-- 1 root  root 474 May  4 18:18 /usr/lib/systemd/system/redis6479.service
    Job for redis6479.service failed because the control process exited with error code. See "systemctl status redis6479.service" and "journalctl -xe" for details.
    Created symlink from /etc/systemd/system/multi-user.target.wants/redis6479.service to /usr/lib/systemd/system/redis6479.service.
    Note: Forwarding request to 'systemctl enable redis6479.service'.
    ## Redis TCP 6479 Info ##
    Could not connect to Redis at 127.0.0.1:6479: Connection refused
    -------------------------------------------------------
    creating redis server: redis6480.service [increment value: 1]
    redis TCP port: 6480
    create systemd redis6480.service
    cp -a /usr/lib/systemd/system/redis.service /usr/lib/systemd/system/redis6480.service
    create /etc/redis6480/redis6480.conf config file
    mkdir -p /etc/redis6480
    cp -a /etc/redis/redis.conf /etc/redis6480/redis6480.conf
    -rw-r----- 1 redis root 92K May  4 12:13 /etc/redis6480/redis6480.conf
    -rw-r--r-- 1 root  root 474 May  4 18:18 /usr/lib/systemd/system/redis6480.service
    Job for redis6480.service failed because the control process exited with error code. See "systemctl status redis6480.service" and "journalctl -xe" for details.
    Created symlink from /etc/systemd/system/multi-user.target.wants/redis6480.service to /usr/lib/systemd/system/redis6480.service.
    Note: Forwarding request to 'systemctl enable redis6480.service'.
    ## Redis TCP 6480 Info ##
    Could not connect to Redis at 127.0.0.1:6480: Connection refused
    Code:
    systemctl status redis6479.service
    ● redis6479.service - Redis persistent key-value database
       Loaded: loaded (/usr/lib/systemd/system/redis6479.service; enabled; vendor preset: disabled)
      Drop-In: /etc/systemd/system/redis6479.service.d
               └─limit.conf, user.conf
       Active: failed (Result: exit-code) since Tue 2021-05-04 18:18:40 +07; 20s ago
     Main PID: 36244 (code=exited, status=1/FAILURE)
       Status: "Redis is loading..."
    
    May 04 18:18:40 abc.domain.xyz systemd[1]: Starting Redis persistent key-value database...
    May 04 18:18:40 abc.domain.xyz systemd[1]: redis6479.service: main process exited, code=exited, status=1/FAILURE
    May 04 18:18:40 abc.domain.xyz systemd[1]: Failed to start Redis persistent key-value database.
    May 04 18:18:40 abc.domain.xyz systemd[1]: Unit redis6479.service entered failed state.
    May 04 18:18:40 abc.domain.xyz systemd[1]: redis6479.service failed.


     
    Last edited: May 4, 2021
  2. eva2000

    eva2000 Administrator Staff Member

    53,178
    12,112
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,647
    Local Time:
    11:44 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    The redis generator at centminmod/centminmod-redis isn't really an official part of Centmin Mod supported setup so moved from official bug reports forum.

    how was redis server installed itself ?

    what version of redis server is installed ? output for
    Code (Text):
    redis-cli info server



    edit: though I think I found the bug and fixed it in this redis-generator.sh update at fix redis-generator.sh redis service start files for redis 6.2 support · centminmod/centminmod-redis@bb35d44 it was a typo for missing redis 6.2 change as redis 6.2 changed from /etc to /etc/redis directory for config files
     
  3. pdinh97qng

    pdinh97qng Member

    121
    15
    18
    Jan 24, 2016
    Ratings:
    +39
    Local Time:
    6:44 AM
    @eva2000 worked perfectly. After delete the other 2 instances and re-creating them, the instances are able to start now.
     
  4. eva2000

    eva2000 Administrator Staff Member

    53,178
    12,112
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,647
    Local Time:
    11:44 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Glad to hear :)
     
  5. ElChorizo

    ElChorizo Premium Member Premium Member

    40
    4
    8
    Apr 29, 2021
    Ratings:
    +8
    Local Time:
    8:44 AM
    1.19.10
    10.3.28
    I just tried to set this up. I git cloned the centminmod-redis repo and used it to do the install.

    After that, I tried to do a multi-cache only install of 2 instances but it doesn't work. It appears to be looking for the wrong filenames..

    Code:
    [18:14][root@centmin1.forumfoundry.com centminmod-redis]# ./redis-generator.sh multi-cache 2
    
    Creating redis servers (with ondisk persistence disabled) starting at TCP = 6479...
    -------------------------------------------------------
    creating redis server: redis6479.service [increment value: 0]
    redis TCP port: 6479
    create systemd redis6479.service
    cp -a /usr/lib/systemd/system/redis.service /usr/lib/systemd/system/redis6479.service
    sed -i "s|^RuntimeDirectory=redis|RuntimeDirectory=redis6479|" "/usr/lib/systemd/system/redis6479.service"
    ./redis-generator.sh: line 261: /var/run/redis6479/redis_6479.pid\|" /usr/lib/systemd/system/redis6479.service: No such file or directory
    create /etc/redis6479/redis6479.conf config file
    mkdir -p /etc/redis6479
    cp -a /etc/redis/redis.conf /etc/redis6479/redis6479.conf
    \cp -af /usr/libexec/redis-shutdown /usr/local/bin/redis6479-shutdown
    sed -i "s|SERVICE_NAME=redis|SERVICE_NAME=redis6479|" /usr/local/bin/redis6479-shutdown
    sed -i "s|CONFIG_FILE="\/etc\/redis\/$SERVICE_NAME.conf"|CONFIG_FILE="\/etc\/$SERVICE_NAME\/$SERVICE_NAME.conf"|" /usr/local/bin/redis6479-shutdown
    sed -i "s|"$SERVICE_NAME" = redis|"$SERVICE_NAME" = redis6479|" /usr/local/bin/redis6479-shutdown
    sed -i "s|6379|6479|" /usr/local/bin/redis6479-shutdown
    mkdir -p /etc/systemd/system/redis6479.service.d/
    \cp -af /etc/systemd/system/redis.service.d/limit.conf /etc/systemd/system/redis6479.service.d/limit.conf
    mkdir -p /etc/systemd/system/redis6479.service.d/
    \cp -af /etc/systemd/system/redis.service.d/user.conf /etc/systemd/system/redis6479.service.d/user.conf
    sed -i "s|^port 6379|port 6479|" /etc/redis6479/redis6479.conf
    sed -i '/^unixsocket/d' /etc/redis6479/redis6479.conf
    mkdir -p /var/lib/redis6479
    chown -R redis:redis /var/lib/redis6479
    ln -s /usr/bin/redis-server /etc/redis6479/redis-server
    sed -i "s|\/usr\/bin\/redis-server|\/etc\/redis6479\/redis-server|" /usr/lib/systemd/system/redis6479.service
    sed -i 's|\/usr\/libexec\/redis-shutdown|\/usr\/local\/bin\/redis6479-shutdown|' /usr/lib/systemd/system/redis6479.service
    sed -i "s|dir \/var\/lib\/redis\/|dir \/var\/lib\/redis6479|" /etc/redis6479/redis6479.conf
    sed -i "s|cluster-config-file nodes-6379.conf|cluster-config-file nodes-6479.conf|" /etc/redis6479/redis6479.conf
    sed -i "s|unixsocket \/tmp\/redis.sock|unixsocket \/var\/run\/redis6479\/redis6479.sock|" /etc/redis6479/redis6479.conf
    sed -i "s|pidfile \/var\/run\/redis_6379.pid|pidfile \/var\/run\/redis6479\/redis_6479.pid|" /etc/redis6479/redis6479.conf
    sed -i "s|\/var\/log\/redis\/redis.log|\/var\/log\/redis\/redis6479.log|" /etc/redis6479/redis6479.conf
    sed -i "s|dbfilename dump.rdb|dbfilename dump6479.rdb|" /etc/redis6479/redis6479.conf
    sed -i "s|appendfilename "appendonly.aof"|appendfilename "appendonly6479.aof"|" /etc/redis6479/redis6479.conf
    echo "#masterauth abc123" >> /etc/redis6479/redis6479.conf
    sed -i "s|\/etc\/redis\/redis.conf|\/etc\/redis6479\/redis6479.conf|" /usr/lib/systemd/system/redis6479.service
    sed -i 's|^save 900|#save 900|' /etc/redis6479/redis6479.conf
    sed -i 's|^save 300|#save 300|' /etc/redis6479/redis6479.conf
    sed -i 's|^save 60|#save 60|' /etc/redis6479/redis6479.conf
    sed -i 's|^appendonly .*|appendonly no|' /etc/redis6479/redis6479.conf
    systemctl daemon-reload
    systemctl restart redis6479
    systemctl enable redis6479
    chkconfig redis6479 on
    Redis TCP 6479 Info:
    redis-cli -h 127.0.0.1 -p 6479 INFO SERVER | egrep 'redis_version|redis_mode|process_id|tcp_port|uptime|executable|config_file'
    -------------------------------------------------------
    creating redis server: redis6480.service [increment value: 1]
    redis TCP port: 6480
    create systemd redis6480.service
    cp -a /usr/lib/systemd/system/redis.service /usr/lib/systemd/system/redis6480.service
    sed -i "s|^RuntimeDirectory=redis|RuntimeDirectory=redis6480|" "/usr/lib/systemd/system/redis6480.service"
    ./redis-generator.sh: line 261: /var/run/redis6480/redis_6480.pid\|" /usr/lib/systemd/system/redis6480.service: No such file or directory
    create /etc/redis6480/redis6480.conf config file
    mkdir -p /etc/redis6480
    cp -a /etc/redis/redis.conf /etc/redis6480/redis6480.conf
    \cp -af /usr/libexec/redis-shutdown /usr/local/bin/redis6480-shutdown
    sed -i "s|SERVICE_NAME=redis|SERVICE_NAME=redis6480|" /usr/local/bin/redis6480-shutdown
    sed -i "s|CONFIG_FILE="\/etc\/redis\/$SERVICE_NAME.conf"|CONFIG_FILE="\/etc\/$SERVICE_NAME\/$SERVICE_NAME.conf"|" /usr/local/bin/redis6480-shutdown
    sed -i "s|"$SERVICE_NAME" = redis|"$SERVICE_NAME" = redis6480|" /usr/local/bin/redis6480-shutdown
    sed -i "s|6379|6480|" /usr/local/bin/redis6480-shutdown
    mkdir -p /etc/systemd/system/redis6480.service.d/
    \cp -af /etc/systemd/system/redis.service.d/limit.conf /etc/systemd/system/redis6480.service.d/limit.conf
    mkdir -p /etc/systemd/system/redis6480.service.d/
    \cp -af /etc/systemd/system/redis.service.d/user.conf /etc/systemd/system/redis6480.service.d/user.conf
    sed -i "s|^port 6379|port 6480|" /etc/redis6480/redis6480.conf
    sed -i '/^unixsocket/d' /etc/redis6480/redis6480.conf
    mkdir -p /var/lib/redis6480
    chown -R redis:redis /var/lib/redis6480
    ln -s /usr/bin/redis-server /etc/redis6480/redis-server
    sed -i "s|\/usr\/bin\/redis-server|\/etc\/redis6480\/redis-server|" /usr/lib/systemd/system/redis6480.service
    sed -i 's|\/usr\/libexec\/redis-shutdown|\/usr\/local\/bin\/redis6480-shutdown|' /usr/lib/systemd/system/redis6480.service
    sed -i "s|dir \/var\/lib\/redis\/|dir \/var\/lib\/redis6480|" /etc/redis6480/redis6480.conf
    sed -i "s|cluster-config-file nodes-6379.conf|cluster-config-file nodes-6480.conf|" /etc/redis6480/redis6480.conf
    sed -i "s|unixsocket \/tmp\/redis.sock|unixsocket \/var\/run\/redis6480\/redis6480.sock|" /etc/redis6480/redis6480.conf
    sed -i "s|pidfile \/var\/run\/redis_6379.pid|pidfile \/var\/run\/redis6480\/redis_6480.pid|" /etc/redis6480/redis6480.conf
    sed -i "s|\/var\/log\/redis\/redis.log|\/var\/log\/redis\/redis6480.log|" /etc/redis6480/redis6480.conf
    sed -i "s|dbfilename dump.rdb|dbfilename dump6480.rdb|" /etc/redis6480/redis6480.conf
    sed -i "s|appendfilename "appendonly.aof"|appendfilename "appendonly6480.aof"|" /etc/redis6480/redis6480.conf
    echo "#masterauth abc123" >> /etc/redis6480/redis6480.conf
    sed -i "s|\/etc\/redis\/redis.conf|\/etc\/redis6480\/redis6480.conf|" /usr/lib/systemd/system/redis6480.service
    sed -i 's|^save 900|#save 900|' /etc/redis6480/redis6480.conf
    sed -i 's|^save 300|#save 300|' /etc/redis6480/redis6480.conf
    sed -i 's|^save 60|#save 60|' /etc/redis6480/redis6480.conf
    sed -i 's|^appendonly .*|appendonly no|' /etc/redis6480/redis6480.conf
    systemctl daemon-reload
    systemctl restart redis6480
    systemctl enable redis6480
    chkconfig redis6480 on
    Redis TCP 6480 Info:
    redis-cli -h 127.0.0.1 -p 6480 INFO SERVER | egrep 'redis_version|redis_mode|process_id|tcp_port|uptime|executable|config_file'
    [18:14][root@centmin1.forumfoundry.com centminmod-redis]# cd /usr/lib/systemd/sysetm
    -bash: cd: /usr/lib/systemd/sysetm: No such file or directory
    [18:15][root@centmin1.forumfoundry.com centminmod-redis]# cd /usr/lib/systemd/system
    [18:15][root@centmin1.forumfoundry.com system]# ls -l redis*
    -rw-r--r-- 1 root root 386 May  4 05:06 redis-sentinel.service
    -rw-r--r-- 1 root root 393 May  4 05:06 redis.service
    
    but the original server that the install script installed is running fine...

    Code:
    [18:15][root@centmin1.forumfoundry.com system]# ps auxw | grep redis
    root     15327  0.0  0.0 112864   968 pts/1    S+   18:18   0:00 grep --color=auto redis
    redis    64239  0.1  0.0 216904  5312 ?        Ssl  18:13   0:00 /usr/bin/redis-server 127.0.0.1:6379
    
     
  6. eva2000

    eva2000 Administrator Staff Member

    53,178
    12,112
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,647
    Local Time:
    11:44 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    default is debug dry run only mode - you need to disable debug mode for it to actual run as per centminmod/centminmod-redis

     
  7. ElChorizo

    ElChorizo Premium Member Premium Member

    40
    4
    8
    Apr 29, 2021
    Ratings:
    +8
    Local Time:
    8:44 AM
    1.19.10
    10.3.28
    Worked like a champ!