Date: Thu, 28 Jul 2005 09:36:51 -0700 From: Danny Howard <dannyman@toldme.com> To: Lei Sun <lei.sun@gmail.com> Cc: freebsd-questions@freebsd.org, Glenn Dawson <glenn@antimatter.net> Subject: Re: how to run 2 instance of memcached from rc.conf? Message-ID: <20050728163651.GA200@ratchet.nebcorp.com> In-Reply-To: <d396fddf05072623597166282e@mail.gmail.com> References: <d396fddf05072623167eb3bb24@mail.gmail.com> <6.1.0.6.2.20050726233906.198d9de0@cobalt.antimatter.net> <d396fddf05072623597166282e@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jul 26, 2005 at 11:59:59PM -0700, Lei Sun wrote: > Yeah, the tricky part is not to what to do, but how to do it. I know I > need to configure 2 ip or 2 ports. > > As the memcached.sh is using run_rc_command, and somehow, even if when > I am giving it 2 arguments with different port, it still can only > start up 1 process instead of 2. How are you giving anything different arguments? I only see one service configured in your rc.conf. > So how do I use the same script to run 2 instance of memcached? So, you have memcached1.sh : #!/bin/sh # # PROVIDE: memcached1 # REQUIRE: NETWORKING # # Add the following lines to /etc/rc.conf to run memcached: # # memcached1_enable="YES" # memcached1_flags="" # . /etc/rc.subr name="memcached1" rcvar=`set_rcvar` command=/usr/local/bin/memcached command_args="-du nobody ${memcached1_flags}" load_rc_config $name run_rc_command "$1" And then you have memcached2.sh : #!/bin/sh # # PROVIDE: memcached2 # REQUIRE: NETWORKING # # Add the following lines to /etc/rc.conf to run memcached: # # memcached2_enable="YES" # memcached2_flags="" # . /etc/rc.subr name="memcached2" rcvar=`set_rcvar` command=/usr/local/bin/memcached command_args="-du nobody ${memcached2_flags}" load_rc_config $name run_rc_command "$1" And you set memcached1_flags and memcached2_flags in rc.conf where you were setting memcache_flags formerly. However, unless you really know what you are doing, if you are trying to run TWO memchached instances, I'd suspect, as another has asserted, that your understanding of memcached is flawed. I'd check with the memcached community to see if there isn't a better way to get things done in the first place. Sincerely, -danny -- http://dannyman.toldme.com/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050728163651.GA200>