Why isn't systemctl starting redis-server on CentOS 7?

60

Solution 1

Finally, fixed it. Systemd requires redis to run non-daemonised, so the config needed to change:

# /etc/redis.conf
daemonize yes # << comment this out

Solution 2

Just to add to the accepted answer, I recently updated redis and encountered the same problem. The configuration file /etc/redis.conf already had the line daemonize no and I still had that problem.

I fixed it by telling redis to interact with the supervisor systemd:

# /etc/redis.conf
supervised auto # or systemd

For reference, the system I was using was running Arch Linux.

Share:
60

Related videos on Youtube

AvengerScarlet
Author by

AvengerScarlet

Updated on September 18, 2022

Comments

  • AvengerScarlet
    AvengerScarlet over 1 year

    I'm trying to copy a file row into a vector of strings, but I don't get the result I'm hoping for. Here's the code:

    AmtCatania bus;
    ifstream aprifile;
    string buffer;
    string partenza;
    string destinazione;
    string data;
    string ora_partenza;
    string ora_arrivo;
    string ritardo;
    string tratta;
    vector <string> corsa;
    aprifile.open("corse.txt");
    if(!aprifile.is_open())
    {
        cerr << "Registro non aperto!" << endl;
        return -1;
    }
    
    while(getline(aprifile, buffer , '\n'))
    {
    
        corsa.push_back(buffer);
        aprifile >> partenza >> destinazione >> data >> ora_partenza >> ora_arrivo >> ritardo;
        bus.addTratta(tratta);
        bus.addPartenza(partenza);
        bus.addDest(destinazione);
        bus.addData(data);
        bus.addOraPart(ora_partenza);
        bus.addOraArr(ora_arrivo);
        bus.addRit(ritardo);
    }
    
    for (string s: corsa){
        cout << s << endl;
    } 
    

    This code is meant to be a class of a Bus Corporation.

    This is the text file

    5   //number of corsa
    534 Scuole Borsellino 10/10 16:00 17:00 0
    534 Scuole Borsellino 16/10 18:00 19:00 5
    534 Scuole Borsellino 16/10 19:00 20:00 3
    722 Borsellino Dusmet 19/10 13:30 14:25 10
    722 Borsellino Dusmet 19/10 14:30 15:25 10
    

    I'm willing to copy every single line into a vector of strings, but I guess spaces are killing the process.

    ////UPDATE/////

    while(getline(aprifile, buffer , '\n'))
    {
      corsa.push_back(buffer);
    }
    for(string s : corsa)
    {
      s >> tratta >> partenza >> destinazione >> data >> ora_partenza >> ora_arrivo >> ritardo;
    }
    

    the

    s >> tratta >> partenza >> destinazione >> data >> ora_partenza >> ora_arrivo >> ritardo;
    

    gives me an error, how should I parse the content now?

    • Michael Hampton
      Michael Hampton almost 10 years
      It started up OK, of course, and then User requested shutdown... No obvious reason for that.
    • Samuel Liew
      Samuel Liew almost 4 years
      Comments are not for extended discussion; this conversation has been moved to chat.
  • Michael Hampton
    Michael Hampton almost 10 years
    Great. This is a bug in the systemd unit file, and you should report it.
  • Michael Hampton
    Michael Hampton over 9 years
    Did you ever solve this? You didn't mark it as solved.
  • Zubin
    Zubin over 9 years
    @MichaelHampton Yep, the above technique worked. In addition, I filed the bug and it's been fixed.
  • Artur Sapek
    Artur Sapek over 6 years
    bless you, you beautiful bastard
  • Martin
    Martin over 6 years
    I found that I also needed to edit the redis.service file (in /etc/systemd/system/multi-user.target.wants), which is linked to /usr/lib/systemd/system/redis.server. I changed --daemonize yes to, you guessed it, --daemonize no.