Coder Social home page Coder Social logo

Comments (11)

andreazevedo avatar andreazevedo commented on May 3, 2024

Hello @jeffbyrnes,
Do you still need help with it? Did you manage to setup runit?
Thanks

from mcrouter.

jeffbyrnes avatar jeffbyrnes commented on May 3, 2024

Would love some help. Writing an upstart script, actually, since I'm using Ubuntu 14.04. I'll post my script once I get to my desk.

from mcrouter.

jeffbyrnes avatar jeffbyrnes commented on May 3, 2024

@andreazevedo ok, here's what I have right now:

# mcrouter - memcached protocol router
#
# mcrouter is a memcached protocol router for
# scaling memcached deployments

description "memcached protocol router"

start on runlevel [2345]
stop on runlevel [2345]

expect daemon

setuid mcrouter

env PID_PATH="/var/run/"

script
    PROG_ARGS="--async-dir=/mnt/mcrouter/spool"
    PROG_ARGS="$PROG_ARGS --route-prefix=/dc1/all/"
    PROG_ARGS="$PROG_ARGS --send-invalid-route-to-default"
    PROG_ARGS="$PROG_ARGS --num-proxies=16"
    PROG_ARGS="$PROG_ARGS --stats-root=/mnt/mcrouter/stats"
    PROG_ARGS="$PROG_ARGS --log-path=/mnt/mcrouter/log/mcrouter.log"
    PROG_ARGS="$PROG_ARGS --background"
    PROG_ARGS="$PROG_ARGS --managed-mode"
    PROG_ARGS="$PROG_ARGS --port=11211"
    PROG_ARGS="$PROG_ARGS --config-file=/etc/mcrouter/mcrouter.json"

    exec /usr/local/bin/mcrouter "$PROG_ARGS"
end script

which results in:

I0224 14:30:31.232331 22647 main.cpp:466] /usr/local/bin/mcrouter --async-dir=/mnt/mcrouter/spool --route-prefix=/dc1/all/ --send-invalid-route-to-default --num-proxies=16 --stats-root=/mnt/mcrouter/stats --log-path=/mnt/mcrouter/log/mcrouter.log --background --managed-mode --port=11211 --config-file=/etc/mcrouter/mcrouter.json 
E0224 14:30:31.232633 22647 mcrouter_config.cpp:52] no configuration source
mcrouter 1.0
usage: /usr/local/bin/mcrouter [options] -p port(s) -f config

from mcrouter.

andreazevedo avatar andreazevedo commented on May 3, 2024

Hello @jeffbyrnes,
Did you try to run this generated command line (i.e. /usr/local/bin/mcrouter --async-dir=/mnt/mcrouter/spool --route-prefix=/dc1/all/ --send-invalid-route-to-default --num-proxies=16 --stats-root=/mnt/mcrouter/stats --log-path=/mnt/mcrouter/log/mcrouter.log --background --managed-mode --port=11211 --config-file=/etc/mcrouter/mcrouter.json) yourself? What result do you get?

from mcrouter.

jeffbyrnes avatar jeffbyrnes commented on May 3, 2024

@andreazevedo yep, works great. Mcrouter kicks off and runs without issues. Apologies for not mentioning that earlier.

from mcrouter.

jeffbyrnes avatar jeffbyrnes commented on May 3, 2024

I'm most confused why it thinks there's “no configuration source”, when I’m clearly specifying one.

from mcrouter.

jeffbyrnes avatar jeffbyrnes commented on May 3, 2024

Damned bash… quoting works weirdly in this case. Removed the double quotes around $PROG_ARGS in the exec call and it works.

Full script:

# mcrouter - memcached protocol router
#
# mcrouter is a memcached protocol router for
# scaling memcached deployments

description "memcached protocol router"

start on runlevel [2345]
stop on runlevel [2345]

expect daemon

setuid mcrouter

env PID_PATH="/var/run/"

script
    PROG_ARGS="--async-dir=/mnt/mcrouter/spool"
    PROG_ARGS="$PROG_ARGS --route-prefix=/dc1/all/"
    PROG_ARGS="$PROG_ARGS --send-invalid-route-to-default"
    PROG_ARGS="$PROG_ARGS --num-proxies=16"
    PROG_ARGS="$PROG_ARGS --stats-root=/mnt/mcrouter/stats"
    PROG_ARGS="$PROG_ARGS --log-path=/mnt/mcrouter/log/mcrouter.log"
    PROG_ARGS="$PROG_ARGS --background"
    PROG_ARGS="$PROG_ARGS --managed-mode"
    PROG_ARGS="$PROG_ARGS --port=11211"
    PROG_ARGS="$PROG_ARGS --config-file=/etc/mcrouter/mcrouter.json"

    exec /usr/local/bin/mcrouter $PROG_ARGS
end script

from mcrouter.

jeffbyrnes avatar jeffbyrnes commented on May 3, 2024

Closed this too soon… starts up properly now, but then Upstart loses track of mcrouter & isn't aware of status or how to stop mcrouter.

from mcrouter.

jeffbyrnes avatar jeffbyrnes commented on May 3, 2024

Ok, final version of said script. No longer using the background or managed-mode flags:

# mcrouter - memcached protocol router
#
# mcrouter is a memcached protocol router for
# scaling memcached deployments

description "memcached protocol router"

start on runlevel [2345]
stop on runlevel [2345]

respawn

setuid mcrouter

script
    PROG_ARGS="--async-dir=/mnt/mcrouter/spool"
    PROG_ARGS="$PROG_ARGS --route-prefix=/dc1/all/"
    PROG_ARGS="$PROG_ARGS --send-invalid-route-to-default"
    PROG_ARGS="$PROG_ARGS --num-proxies=16"
    PROG_ARGS="$PROG_ARGS --pid-file=/var/run/mcrouter/mcrouter.pid"
    PROG_ARGS="$PROG_ARGS --stats-root=/mnt/mcrouter/stats"
    PROG_ARGS="$PROG_ARGS --log-path=/mnt/mcrouter/log/mcrouter.log"
    PROG_ARGS="$PROG_ARGS --port=11211"
    PROG_ARGS="$PROG_ARGS --config-file=/etc/mcrouter/mcrouter.json"

    exec /usr/local/bin/mcrouter $PROG_ARGS
end script

This works solidly, starts & stops properly, and respawns the mcrouter process if it dies.

from mcrouter.

andreazevedo avatar andreazevedo commented on May 3, 2024

Hello @jeffbyrnes,
Great! One thing that I would suggest is the use of flavor files, so that you would be able to change your mcrouter configs without touching your script again! :)
Thanks!

from mcrouter.

jeffbyrnes avatar jeffbyrnes commented on May 3, 2024

@andreazevedo oh MAN! That is hugely helpful for writing a Chef cookbook. Being able to render out JSON files is way simpler than building a set of CLI flags. Thanks!

from mcrouter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.