Last active
August 29, 2015 14:16
-
-
Save poad/865c2a0b52ef9f271a65 to your computer and use it in GitHub Desktop.
Ubuntu 14.04にflareをインストールしてみる ref: http://qiita.com/poad1010/items/9a6f4dba1d20245c4b08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo apt-get update | |
| sudo apt-get install tokyocabinet-bin libtokyocabinet-dev | |
| sudo apt-get install libboost-dev libboost-program-options1.54.0 libboost-thread1.54.0 libboost-regex1.54.0 libboost-serialization1.54.0 | |
| sudo apt-get install libhashkit-dev | |
| sudo apt-get install automake libtool zlib1g-dev | |
| cd /usr/lib/x86_64-linux-gnu | |
| sudo ln -s libboost_program_options.so.1.54.0 libboost_program_options.so | |
| sudo ln -s libboost_regex.so.1.54.0 libboost_regex.so | |
| sudo ln -s libboost_thread.so.1.54.0 libboost_thread.so | |
| sudo ln -s libboost_serialization.so.1.54.0 libboost_serialization.so | |
| sudo ln -s libboost_system.so.1.54.0 libboost_system.so | |
| cd /lib/x86_64-linux-gnu | |
| sudo ln -s libuuid.so.1 libuuid.so | |
| cd ~ | |
| wget https://github.com/gree/flare/archive/1.2.0.tar.gz | |
| tar xzf 1.2.0.tar.gz | |
| cd flare-1.2.0 | |
| ./autogen.sh | |
| ./configure | |
| make | |
| make check | |
| sudo make install | |
| sudo mkdir -p /etc/flare | |
| cd etc | |
| sudo cp * /etc/flare/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cd | |
| mkdir flare | |
| cd flare | |
| wget http://gree.github.io/flare/files/flare_1.2.0-1+squeeze1_amd64.deb | |
| ar xv flare_1.2.0-1+squeeze1_amd64.deb | |
| tar xzf data.tar.gz | |
| cd etc/init.d | |
| # 編集する | |
| sudo cp flare /etc/init.d | |
| sudo sysv-rc-conf flare on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/sh | |
| ### BEGIN INIT INFO | |
| # Provides: flare | |
| # Required-Start: $remote_fs $syslog | |
| # Required-Stop: $remote_fs $syslog | |
| # Should-Start: $local_fs | |
| # Should-Stop: $local_fs | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: Start flare index server or node | |
| # Description: Start up flare, a distributed and persistent key-value storage | |
| ### END INIT INFO | |
| PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
| RUN_INDEX=yes | |
| RUN_NODE=yes | |
| DAEMON_INDEX=/usr/local/bin/flarei | |
| DAEMON_NODE=/usr/local/bin/flared | |
| DESC=flare | |
| DESC_INDEX=`basename $DAEMON_INDEX` | |
| DESC_NODE=`basename $DAEMON_NODE` | |
| NAME=flare | |
| NAME_INDEX=$DESC_INDEX | |
| NAME_NODE=$DESC_NODE | |
| CONF_INDEX=/etc/flare/flarei.conf | |
| CONF_NODE=/etc/flare/flared.conf | |
| DATA_INDEX=/var/lib/flare | |
| DATA_NODE=/var/lib/flare | |
| DEFAULT_CORE_FILE_SIZE=$(ulimit -Sc) | |
| test -x $DAEMON_INDEX || exit 0 | |
| test -x $DAEMON_NODE || exit 0 | |
| # Include flare defaults if available | |
| if [ -f /etc/default/flare ] ; then | |
| . /etc/default/flare | |
| fi | |
| # Exit on error | |
| set -e | |
| # Set process limits | |
| set_limits() { | |
| if [ $1 = "index" ]; then | |
| if [ -n "$CORE_FILE_SIZE_INDEX" ]; then | |
| ulimit -Sc $CORE_FILE_SIZE_INDEX; | |
| else | |
| ulimit -Sc $DEFAULT_CORE_FILE_SIZE; | |
| fi | |
| elif [ $1 = "node" ]; then | |
| if [ -n "$CORE_FILE_SIZE_NODE" ]; then | |
| ulimit -Sc $CORE_FILE_SIZE_NODE; | |
| else | |
| ulimit -Sc $DEFAULT_CORE_FILE_SIZE; | |
| fi | |
| fi | |
| } | |
| # Start/Stop daemon | |
| case "$1" in | |
| start) | |
| echo -n "Starting $DESC: " | |
| if [ $RUN_INDEX = "yes" ]; then | |
| set_limits "index" | |
| start-stop-daemon --start --quiet --pidfile $DATA_INDEX/$NAME_INDEX.pid --exec $DAEMON_INDEX -- -f $CONF_INDEX --daemonize | |
| echo -n "$NAME_INDEX " | |
| fi | |
| sleep 1 | |
| if [ $RUN_NODE = "yes" ]; then | |
| set_limits "node" | |
| start-stop-daemon --start --quiet --pidfile $DATA_NODE/$NAME_NODE.pid --exec $DAEMON_NODE -- -f $CONF_NODE --daemonize | |
| echo -n "$NAME_NODE " | |
| fi | |
| echo "" | |
| ;; | |
| start-index) | |
| echo -n "Starting $DESC_INDEX: " | |
| if [ $RUN_INDEX = "yes" ]; then | |
| set_limits "index" | |
| start-stop-daemon --start --quiet --pidfile $DATA_INDEX/$NAME_INDEX.pid --exec $DAEMON_INDEX -- -f $CONF_INDEX --daemonize | |
| echo "$NAME_INDEX." | |
| else | |
| echo "disabled (skip starting)." | |
| fi | |
| ;; | |
| start-node) | |
| echo -n "Starting $DESC_NODE: " | |
| if [ $RUN_NODE = "yes" ]; then | |
| set_limits "node" | |
| start-stop-daemon --start --quiet --pidfile $DATA_NODE/$NAME_NODE.pid --exec $DAEMON_NODE -- -f $CONF_NODE --daemonize | |
| echo "$NAME_NODE." | |
| else | |
| echo "disabled (skip starting)." | |
| fi | |
| ;; | |
| stop) | |
| echo -n "Stopping $DESC: " | |
| if [ $RUN_INDEX = "yes" ]; then | |
| start-stop-daemon --stop --quiet --pidfile $DATA_INDEX/$NAME_INDEX.pid --exec $DAEMON_INDEX | |
| echo -n "$NAME_INDEX " | |
| fi | |
| sleep 1 | |
| if [ $RUN_NODE = "yes" ]; then | |
| start-stop-daemon --stop --quiet --pidfile $DATA_NODE/$NAME_NODE.pid --exec $DAEMON_NODE | |
| echo -n "$NAME_NODE " | |
| fi | |
| echo "" | |
| ;; | |
| stop-index) | |
| echo -n "Stopping $DESC_INDEX: " | |
| if [ $RUN_INDEX = "yes" ]; then | |
| start-stop-daemon --stop --quiet --pidfile $DATA_INDEX/$NAME_INDEX.pid --exec $DAEMON_INDEX | |
| echo "$NAME_INDEX." | |
| else | |
| echo "disabled (skip stopping)." | |
| fi | |
| ;; | |
| stop-node) | |
| echo -n "Stopping $DESC_NODE: " | |
| if [ $RUN_NODE = "yes" ]; then | |
| start-stop-daemon --stop --quiet --pidfile $DATA_NODE/$NAME_NODE.pid --exec $DAEMON_NODE | |
| echo "$NAME_NODE." | |
| else | |
| echo "disabled (skip stopping)." | |
| fi | |
| ;; | |
| force-reload) | |
| if [ $RUN_INDEX = "yes" ]; then | |
| echo "Reloading $DESC_INDEX configuration files." | |
| start-stop-daemon --stop --signal 1 --quiet --pidfile $DATA_INDEX/$NAME_INDEX.pid --exec $DAEMON_INDEX | |
| fi | |
| if [ $RUN_NODE = "yes" ]; then | |
| echo "Reloading $DESC_NODE configuration files." | |
| start-stop-daemon --stop --signal 1 --quiet --pidfile $DATA_NODE/$NAME_NODE.pid --exec $DAEMON_NODE | |
| fi | |
| ;; | |
| reload) | |
| if [ $RUN_INDEX = "yes" ]; then | |
| echo "Reloading $DESC_INDEX configuration files." | |
| start-stop-daemon --stop --signal 1 --quiet --pidfile $DATA_INDEX/$NAME_INDEX.pid --exec $DAEMON_INDEX | |
| fi | |
| if [ $RUN_NODE = "yes" ]; then | |
| echo "Reloading $DESC_NODE configuration files." | |
| start-stop-daemon --stop --signal 1 --quiet --pidfile $DATA_NODE/$NAME_NODE.pid --exec $DAEMON_NODE | |
| fi | |
| ;; | |
| reload-index) | |
| if [ $RUN_INDEX = "yes" ]; then | |
| echo "Reloading $DESC_INDEX configuration files." | |
| start-stop-daemon --stop --signal 1 --quiet --pidfile $DATA_INDEX/$NAME_INDEX.pid --exec $DAEMON_INDEX | |
| fi | |
| ;; | |
| reload-node) | |
| if [ $RUN_NODE = "yes" ]; then | |
| echo "Reloading $DESC_NODE configuration files." | |
| start-stop-daemon --stop --signal 1 --quiet --pidfile $DATA_NODE/$NAME_NODE.pid --exec $DAEMON_NODE | |
| fi | |
| ;; | |
| restart) | |
| echo -n "Restarting $DESC: " | |
| if [ $RUN_INDEX = "yes" ]; then | |
| start-stop-daemon --stop --quiet --pidfile $DATA_INDEX/$NAME_INDEX.pid --exec $DAEMON_INDEX | |
| sleep 1 | |
| set_limits "index" | |
| start-stop-daemon --start --quiet --pidfile $DATA_INDEX/$NAME_INDEX.pid --exec $DAEMON_INDEX -- -f $CONF_INDEX --daemonize | |
| echo -n "$NAME_INDEX " | |
| fi | |
| sleep 1 | |
| if [ $RUN_NODE = "yes" ]; then | |
| start-stop-daemon --stop --quiet --pidfile $DATA_NODE/$NAME_NODE.pid --exec $DAEMON_NODE | |
| sleep 1 | |
| set_limits "node" | |
| start-stop-daemon --start --quiet --pidfile $DATA_NODE/$NAME_NODE.pid --exec $DAEMON_NODE -- -f $CONF_NODE --daemonize | |
| echo -n "$NAME_NODE " | |
| fi | |
| echo "" | |
| ;; | |
| restart-index) | |
| echo -n "Restarting $DESC_INDEX: " | |
| if [ $RUN_INDEX = "yes" ]; then | |
| start-stop-daemon --stop --quiet --pidfile $DATA_INDEX/$NAME_INDEX.pid --exec $DAEMON_INDEX | |
| sleep 1 | |
| set_limits "index" | |
| start-stop-daemon --start --quiet --pidfile $DATA_INDEX/$NAME_INDEX.pid --exec $DAEMON_INDEX -- -f $CONF_INDEX --daemonize | |
| echo "$NAME_INDEX." | |
| else | |
| echo "disable (skip restarting)." | |
| fi | |
| ;; | |
| restart-node) | |
| echo -n "Restarting $DESC_NODE: " | |
| if [ $RUN_NODE = "yes" ]; then | |
| start-stop-daemon --stop --quiet --pidfile $DATA_NODE/$NAME_NODE.pid --exec $DAEMON_NODE | |
| sleep 1 | |
| set_limits "node" | |
| start-stop-daemon --start --quiet --pidfile $DATA_NODE/$NAME_NODE.pid --exec $DAEMON_NODE -- -f $CONF_NODE --daemonize | |
| echo "$NAME_NODE." | |
| else | |
| echo "disable (skip restarting)." | |
| fi | |
| ;; | |
| *) | |
| N=/etc/init.d/$NAME | |
| echo "Usage: $N {start|start-index|start-node|stop|stop-index|stop-node|restart|restart-index|restart-node|reload|reload-index|reload-node}" >&2 | |
| exit 1 | |
| ;; | |
| esac | |
| exit 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| data-dir = /var/lib/flare | |
| index-servers = localhost:11810 | |
| log-facility = local1 | |
| max-connection = 256 | |
| mutex-slot = 32 | |
| proxy-concurrency = 2 | |
| server-name = localhost | |
| server-port = 11811 | |
| storage-type = tch | |
| thread-pool-size = 16 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| data-dir = /var/lib/flare | |
| log-facility = local0 | |
| max-connection = 256 | |
| monitor-threshold = 3 | |
| monitor-interval = 1 | |
| server-name = localhost | |
| server-port = 11810 | |
| thread-pool-size = 8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment