КОИНС.Студия - Статьи - Инсталляция и настройка программ - Amazon Linux - gearman

gearman

  • Использованные инструкции:
    http://mysqldba.blogspot.com/2011/05/installing-gearmand-on-amazons-ec2.html

  • пользователя создать, под которым gearmand запущен будет

  • установить зависимости:
    yum install gcc-c++
    yum install make

  • mysql установить

  • cоздать базу данных и пользователя mysql:
    create database gearman;
    grant all on gearman.* to u_gearman@localhost identified by 'password';

  • /etc/yum.repos.d/drizzle.repo
    [drizzle]
    name=drizzle
    baseurl=http://rpm.drizzle.org/7-dev/redhat/6/$basearch/
    enabled=1
    gpgcheck=0

    [drizzle-src]
    name=drizzle-src
    baseurl=http://rpm.drizzle.org/7-dev/redhat/6/source
    enabled=1
    gpgcheck=0
  • yum install libdrizzle1 libdrizzle1-devel

  • ./configure --prefix=/usr

  • libgearman-server/plugins/queue/drizzle/queue.cc
    поменял все вхождения
    drizzle_column_skip_all
    на
    drizzle_column_skip

  • tests/drizzle_test.cc
    include libdrizzle-1.0/drizzle_client.h
    поменял на
    include libdrizzle-1.0/libdrizzle/drizzle_client.h

  • make

  • make install

  • /etc/init.d/gearmand
    #!/bin/bash
    #
    # gearmand        Startup script for the Gearman server
    #
    # chkconfig: - 85 15
    # description: Gearman is a distributed job system.
    # processname: gearmand
    # config: /etc/sysconfig/gearmand
    # pidfile: /var/run/gearmand/gearmand.pid
    #
    ### BEGIN INIT INFO
    # Provides: gearmand
    # Required-Start: $local_fs $network
    # Required-Stop: $local_fs $network
    # Default-Start:
    # Default-Stop:
    # Short-Description: start and stop the Gearman server
    # Description: Gearman is a distributed job system.
    ### END INIT INFO

    # Source function library.
    . /etc/rc.d/init.d/functions

    if [ -f /etc/sysconfig/gearmand ]; then
      . /etc/sysconfig/gearmand
    fi

    [ -z "${PIDFILE}" ] && pidfile="/var/run/gearmand.pid"
    [ -z "${LOCKFILE}" ] && lockfile="/var/lock/subsys/gearmand"

    gearmand=/usr/sbin/gearmand
    prog=gearmand
    RETVAL=0

    start() {
      echo -n $"Starting $prog: "
      daemon --pidfile=$pidfile --user=gearman $gearmand -d $OPTIONS
      RETVAL=$?
      echo
      [ $RETVAL = 0 ] && (touch $lockfile; pgrep -f $gearmand > $pidfile)
      return $RETVAL
    }

    stop() {
      echo -n $"Stopping $prog: "
      killproc -p $pidfile $gearmand
      RETVAL=$?
      echo
      [ $RETVAL = 0 ] && rm -f $lockfile $pidfile
    }

    # See how we were called.
    case "$1" in
      start)
        start
      ;;
      stop)
        stop
    ;;
    status)
       status -p $pidfile $gearmand
       RETVAL=$?
    ;;
    restart|reload)
       stop
       start
    ;;
    condrestart|try-restart)
       if status -p $pidfile $gearmand >&/dev/null; then
         stop
         start
       fi
      ;;
      *)
        echo $"Usage: $prog {start|stop|restart|reload|condrestart|status|help}"
        RETVAL=3
    esac

    exit $RETVAL
  • /etc/sysconfig/gearmand
    # This is a configuration file for /etc/init.d/gearman-job-server; it allows
    # you to perform common modifications to the behavior of the gearman-job-server
    # daemon startup without editing the init script (and thus getting prompted by
    # dpkg on upgrades).  We all love dpkg prompts.

    # Examples ( from http://gearman.org/index.php?id=manual:job_server )
    #
    # Use drizzle as persistent queue store
    # PARAMS="-q libdrizzle --libdrizzle-db=some_db --libdrizzle-table=gearman_queue"
    #
    # Use mysql as persistent queue store
    # PARAMS="-q libdrizzle --libdrizzle-host=10.0.0.1 --libdrizzle-user=gearman \
    #                       --libdrizzle-password=secret --libdrizzle-db=some_db \
    #                       --libdrizzle-table=gearman_queue --libdrizzle-mysql"
    #
    # Missing examples for memcache persitent queue store...

    # Parameters to pass to gearmand.

    OPTIONS=" \
      --port=26589 \
      --queue-type=libdrizzle \
      --libdrizzle-mysql \
      --libdrizzle-host=127.0.0.1 \
      --libdrizzle-port=26530 \
      --libdrizzle-user=u_gearman \
      --libdrizzle-password=password \
      --libdrizzle-db=gearman \
      --libdrizzle-table=queue \
    "
  • запускаем gearmand:
    chkconfig gearmand on
    /etc/init.d/gearmand start

  • проверить, что в mysql cоздалась таблица queue

Последняя модификация: 08.05.12 16:23