本文介绍了如何在不同端口的单个服务器上运行 redis?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 kue 它使用 node_redis,但我也已经在我的会话中使用了 node_redis,所以我想要 kue在特定端口上创建一个服务器,说默认的 6379 然后 kue 监听端口 1234.

I'm using kue which uses node_redis, but I'm also already using node_redis for my sessions, so I'd like to have kue create a server on a specific port say the default 6379 and then kue listen on port 1234.

我如何才能做到这一点?我发现这篇文章关于类似的东西,但我真的不想创建一个初始化脚本来做到这一点.

How would I be able to do this? I found this article which talks about something similar, but I don't really want to have to create an init script to do this.

推荐答案

启动 redis-server 并为 'port' 提供不同的参数,这可以在命令行上完成:

Launch redis-server and supply a different argument for 'port' which can be done on the command-line:

edd@max:~$ redis-server -h
Usage: ./redis-server [/path/to/redis.conf] [options]
       ./redis-server - (read config from stdin)
       ./redis-server -v or --version
       ./redis-server -h or --help
       ./redis-server --test-memory <megabytes>

Examples:
       ./redis-server (run the server with default conf)
       ./redis-server /etc/redis/6379.conf
       ./redis-server --port 7777
       ./redis-server --port 7777 --slaveof 127.0.0.1 8888
       ./redis-server /etc/myredis.conf --loglevel verbose

Sentinel mode:
       ./redis-server /etc/sentinel.conf --sentinel
edd@max:~$

您也可以从 /etc/rc.local 执行此操作,以便在启动时执行此操作.

You can do this from, say, /etc/rc.local as well so that this happens at startup.

但也许您也可以重新考虑您的方法.Redis 非常擅长处理写入,以至于您可能只需要使用第二个数据库?

But maybe you can also rethink your approach. Redis is so good at handling writes that you may just get by with a second database?

这篇关于如何在不同端口的单个服务器上运行 redis?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-21 00:31