如何在同一服务器的不同端口中创建两个Memcached服务器实例? [英] How can we create two instances of memcached server in same server in different port?
问题描述
我试图添加 -l 11211 -l 11212 在memcached conf文件中.但这只是在听第一个,即1121
I tried to add in the way -l 11211 -l 11212 in memcached conf file. But it is just listening to first one i.e 1121
推荐答案
以下是memcached所说的-l
命令用于:
Here's what memcached says the -l
command is for:
-l <addr> interface to listen on (default: INADDR_ANY, all addresses)
<addr> may be specified as host:port. If you don't specify
a port number, the value you specified with -p or -U is
used. You may specify multiple addresses separated by comma
or by using -l multiple times
首先,如果使用-l
标志,则需要指定要让memcached侦听的接口.将0.0.0.0
用于所有接口,并使用127.0.0.1
是仅希望能够从localhost
访问memcached.其次,不要使用两个-l
标志.仅使用一个,并用逗号分隔每个地址.下面的命令应该可以满足您的要求.
First off you need to specify the interface you want memcached to listen on if you are using the -l
flag. Use 0.0.0.0
for all interfaces and use 127.0.0.1
is you just want to be able to access memcached from localhost
. Second, don't use two -l
flags. Use only one and separate each address by a comma. The command below should do what you want.
memcached -l 0.0.0.0:11211,0.0.0.0:11212
请记住,这将在两个端口上侦听一个memcached实例.要在一台计算机上拥有两个内存缓存实例,请运行以下两个命令.
Keep in mind that this will have one memcached instance listen on two ports. To have two memcached instances on one machine run these two commands.
memcached -p 11211 -d
memcached -p 11212 -d
这篇关于如何在同一服务器的不同端口中创建两个Memcached服务器实例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!