Start redis-server with config file

后端 未结 3 1599
孤街浪徒
孤街浪徒 2021-02-04 03:42

I have my config file at:

root/config/redis.rb

I start redis like this: redis-server

How do I start redis so that it uses my co

相关标签:
3条回答
  • 2021-02-04 04:14

    I think that you should make the reference to your config file

    26399:C 16 Jan 08:51:13.413 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf
    

    you can try to start your redis server like

    ./redis-server /path/to/redis-stable/redis.conf
    
    0 讨论(0)
  • 2021-02-04 04:17

    To start redis with a config file all you need to do is specifiy the config file as an argument:

    redis-server /root/config/redis.rb
    

    Instead of using and killing PID's I would suggest creating an init script for your service

    I would suggest taking a look at the Installing Redis more properly section of http://redis.io/topics/quickstart. It will walk you through setting up an init script with redis so you can just do something like service redis_server start and service redis_server stop to control your server.

    I am not sure exactly what distro you are using, that article describes instructions for a Debian based distro. If you are are using a RHEL/Fedora distro let me know, I can provide you with instructions for the last couple of steps, the config file and most of the other steps will be the same.

    0 讨论(0)
  • 2021-02-04 04:22

    Okay, redis is pretty user friendly but there are some gotchas.

    Here are just some easy commands for working with redis on Ubuntu:

    install:

    sudo apt-get install redis-server
    

    start with conf:

    sudo redis-server <path to conf>
    sudo redis-server config/redis.conf
    

    stop with conf:

    redis-ctl shutdown
    

    (not sure how this shuts down the pid specified in the conf. Redis must save the path to the pid somewhere on boot)

    log:

    tail -f /var/log/redis/redis-server.log
    

    Also, various example confs floating around online and on this site were beyond useless. The best, sure fire way to get a compatible conf is to copy-paste the one your installation is already using. You should be able to find it here:

    /etc/redis/redis.conf
    

    Then paste it at <path to conf>, tweak as needed and you're good to go.

    0 讨论(0)
提交回复
热议问题