In a perfect world, it should to just issue:
cpan install MogileFS::Server
But version 2.34 is still imperfect..
On a clean Ubuntu install, start off by getting compilers etc.:
sudo apt-get install build-essential
Enter cpan, and install the following BEFORE mogilefs
cpan install IO::AIO BSD::Resource
In that process the optimal would be to install DBD::mysql also - but that one failed for me, so go install the package from ubuntu repository instead:
sudo apt-get install libdbd-mysql-perl
Now you're ready to run the actual install command without it failing on you:
cpan install MogileFS::Server
If you want additional features, you can install MogileFS::Client and MogileFS::Utils also
Now you have your mogstored and mogilefsd in /usr/local/bin/mogilefsd, but that's pretty much all you have. For them to be useful you would need config files:
Here's mine from /etc/mogilefs/mogilefsd.conf :
db_dsn = DBI:mysql:mogilefs:host=server1.example.com;port=3306;mysql_connect_timeout=10;mysql_ssl=1;mysql_compression=1 db_user = mog_user db_pass = mog_pass listen = 0.0.0.0:7001 node_timeout = 5 conf_port = 7001 listener_jobs = 10 delete_jobs = 1 replicate_jobs = 10 mog_root = /mnt/mogilefs reaper_jobs = 1 rebalance_ignore_missing = 1and from /etc/mogilefs/mogstored.conf :
maxconns = 10000 httplisten = 0.0.0.0:7500 mgmtlisten = 0.0.0.0:7501 docroot = /var/mogdata
Create users you want mogilefsd and mogstored to run under:
sudo adduser mogilefsd sudo adduser mogstored
My init.d script is under /etc/init.d/mogilefsd and modified from an older init script found in a custom repository:
#! /bin/sh ### BEGIN INIT INFO # Provides: mogilefsd # Required-Start: $local_fs $remote_fs $network $syslog # Required-Stop: $local_fs $remote_fs $network $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start/Stop the mogilefsd daemon # Description: Start/Stop the mogilefsd daemon. ### END INIT INFO # PATH should only include /usr/* if it runs after the mountnfs.sh script PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/local/bin/mogilefsd NAME=mogilefsd DESC=mogilefsd MOGILEFSD_RUNASUSER=mogilefsd PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 # Read configuration variable if it is present if [ -z "$MOGILEFSD_RUNASUSER" ]; then echo "Cannot determine user to run as, recheck init script" exit 0 fi # Load the VERBOSE setting and other rcS variables . /lib/init/vars.sh set -e # # Function that starts the daemon/service # do_start() { if [ -e $PIDFILE ] then if [ -d /proc/`cat $PIDFILE`/ ] then echo "$NAME already running." exit 0; else rm -f $PIDFILE fi fi start-stop-daemon --start --quiet --exec $DAEMON --pidfile $PIDFILE -b -m --name $NAME --chuid $MOGILEFSD_RUNASUSER } # # Function that stops the daemon/service # do_stop() { start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE --name $NAME --user $MOGILEFSD_RUNASUSER rm -f $PIDFILE } case "$1" in start) echo -n "Starting $DESC: " do_start echo "$NAME." ;; stop) echo -n "Stopping $DESC: " do_stop echo "$NAME." ;; restart|force-reload) # # If the "reload" option is implemented, move the "force-reload" # option to the "reload" entry above. If not, "force-reload" is # just the same as "restart". # echo -n "Restarting $DESC: " do_stop sleep 1 do_start echo "$NAME." ;; *) #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 exit 3 ;; esac :
and my mogstored init script in /etc/init.d/mogstored :
#! /bin/sh ### BEGIN INIT INFO # Provides: mogstored # Required-Start: $local_fs $remote_fs $network $syslog # Required-Stop: $local_fs $remote_fs $network $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start/Stop the mogstored daemon # Description: Start/Stop the mogstored daemon. ### END INIT INFO # PATH should only include /usr/* if it runs after the mountnfs.sh script PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/local/bin/mogstored NAME=mogstored DESC=mogstored MOGSTORED_RUNASUSER=mogstored PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 # Read configuration variable if it is present if [ -z "$MOGSTORED_RUNASUSER" ]; then echo "Cannot determine user to run as, recheck init script" exit 0 fi # Load the VERBOSE setting and other rcS variables . /lib/init/vars.sh set -e # # Function that starts the daemon/service # do_start() { if [ -e $PIDFILE ] then if [ -d /proc/`cat $PIDFILE`/ ] then echo "$NAME already running." exit 0; else rm -f $PIDFILE fi fi start-stop-daemon --start --quiet --exec $DAEMON --pidfile $PIDFILE -b -m --name $NAME --chuid $MOGSTORED_RUNASUSER } # # Function that stops the daemon/service # do_stop() { start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE --name $NAME --user $MOGSTORED_RUNASUSER rm -f $PIDFILE } case "$1" in start) echo -n "Starting $DESC: " do_start echo "$NAME." ;; stop) echo -n "Stopping $DESC: " do_stop echo "$NAME." ;; restart|force-reload) # # If the "reload" option is implemented, move the "force-reload" # option to the "reload" entry above. If not, "force-reload" is # just the same as "restart". # echo -n "Restarting $DESC: " do_stop sleep 1 do_start echo "$NAME." ;; *) #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 exit 3 ;; esac :
To make the init scripts run at boot, make them executable, and add to boot sequence:
sudo chmod +x /etc/init.d/mogilefsd sudo update-rc.d mogilefsd defaults sudo chmod +x /etc/init.d/mogstored sudo update-rc.d mogstored defaults
No comments:
Post a Comment