want to run redis-server in background nonstop

2020-05-12 04:59发布

I have downloaded redis-2.6.16.tar.gz file and i installed sucessfully. After installed i run src/redis-server it worked fine.

But i don't want manually run src/redis-server everytime, rather i want redis-server running as background process continuously.

So far after installed i did following tasks:

1. vim redis.conf and i changed to

# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
  daemonize yes

But same result i found. What mistake i did?

After redis run in background. I will run juggernaut also as background process with following command.

nohup node server.js

But i am not able to make redis run in background. Please provide some solution.

4条回答
手持菜刀,她持情操
2楼-- · 2020-05-12 05:15

Since Redis 2.6 it is possible to pass Redis configuration parameters using the command line directly. This is very useful for testing purposes.

redis-server --daemonize yes

Check if the process started or not:

ps aux | grep redis-server
查看更多
贼婆χ
3楼-- · 2020-05-12 05:17

I think the best way is to use Redis' config file:

# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize yes

Set daemonize to yes in the config file. Say the file is ~/.redis/redis.conf, then just run

$ redis-server ~/.redis/redis.conf

And it just works.

查看更多
我想做一个坏孩纸
4楼-- · 2020-05-12 05:17

For windows:

Step 1: Install redis as a service

redis-server --server-install 

Step 2: Run background

redis-server --server-start 
查看更多
别忘想泡老子
5楼-- · 2020-05-12 05:24

Or you can simply run it as src/redis-server redis.conf&

查看更多
登录 后发表回答