Page Menu
Home
ClusterLabs Projects
Search
Configure Global Search
Log In
Files
F3155666
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
12 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/heartbeat/Makefile.am b/heartbeat/Makefile.am
index 51ce7077b..fd3ca4540 100644
--- a/heartbeat/Makefile.am
+++ b/heartbeat/Makefile.am
@@ -1,174 +1,175 @@
# Makefile.am for OCF RAs
#
# Author: Sun Jing Dong
# Copyright (C) 2004 IBM
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
MAINTAINERCLEANFILES = Makefile.in
EXTRA_DIST = $(ocf_SCRIPTS) $(ocfcommon_DATA) \
$(common_DATA) $(hb_DATA) $(dtd_DATA) \
README
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/linux-ha
halibdir = $(libexecdir)/heartbeat
ocfdir = $(OCF_RA_DIR_PREFIX)/heartbeat
dtddir = $(datadir)/$(PACKAGE_NAME)
dtd_DATA = ra-api-1.dtd metadata.rng
if USE_IPV6ADDR_AGENT
ocf_PROGRAMS = IPv6addr
else
ocf_PROGRAMS =
endif
if IPV6ADDR_COMPATIBLE
halib_PROGRAMS = send_ua
else
halib_PROGRAMS =
endif
IPv6addr_SOURCES = IPv6addr.c IPv6addr_utils.c
send_ua_SOURCES = send_ua.c IPv6addr_utils.c
IPv6addr_LDADD = -lplumb $(LIBNETLIBS)
send_ua_LDADD = $(LIBNETLIBS)
ocf_SCRIPTS = AoEtarget \
AudibleAlarm \
ClusterMon \
CTDB \
Delay \
Dummy \
EvmsSCC \
Evmsd \
Filesystem \
ICP \
IPaddr \
IPaddr2 \
IPsrcaddr \
LVM \
LinuxSCSI \
MailTo \
ManageRAID \
ManageVE \
NodeUtilization \
Pure-FTPd \
Raid1 \
Route \
SAPDatabase \
SAPInstance \
SendArp \
ServeRAID \
SphinxSearchDaemon \
Squid \
Stateful \
SysInfo \
VIPArip \
VirtualDomain \
WAS \
WAS6 \
WinPopup \
Xen \
Xinetd \
ZFS \
anything \
apache \
asterisk \
aws-vpc-route53 \
awseip \
awsvip \
clvm \
conntrackd \
db2 \
dhcpd \
dnsupdate \
docker \
eDir88 \
ethmonitor \
exportfs \
fio \
galera \
garbd \
iSCSILogicalUnit \
iSCSITarget \
ids \
iface-bridge \
iface-vlan \
iscsi \
jboss \
kamailio \
lxc \
+ minio \
mysql \
mysql-proxy \
nagios \
named \
nfsnotify \
nfsserver \
nginx \
oraasm \
oracle \
oralsnr \
pgagent \
pgsql \
pingd \
portblock \
postfix \
pound \
proftpd \
rabbitmq-cluster \
redis \
rsyncd \
rsyslog \
scsi2reservation \
sfex \
sg_persist \
slapd \
symlink \
syslog-ng \
tomcat \
varnish \
vmware \
vsftpd \
zabbixserver
ocfcommondir = $(OCF_LIB_DIR_PREFIX)/heartbeat
ocfcommon_DATA = ocf-shellfuncs \
ocf-binaries \
ocf-directories \
ocf-returncodes \
ocf-rarun \
ocf-distro \
apache-conf.sh \
http-mon.sh \
sapdb-nosha.sh \
sapdb.sh \
ora-common.sh \
mysql-common.sh \
nfsserver-redhat.sh \
findif.sh
# Legacy locations
hbdir = $(sysconfdir)/ha.d
hb_DATA = shellfuncs
check: $(ocf_SCRIPTS:=.check)
%.check: %
OCF_ROOT=$(abs_srcdir) OCF_FUNCTIONS_DIR=$(abs_srcdir) ./$< meta-data | xmllint --path $(abs_srcdir) --noout --relaxng $(abs_srcdir)/metadata.rng -
diff --git a/heartbeat/minio b/heartbeat/minio
new file mode 100755
index 000000000..6d11956d1
--- /dev/null
+++ b/heartbeat/minio
@@ -0,0 +1,289 @@
+#!/bin/sh
+#
+# Resource script for Minio
+#
+# Description: Manages Minio as an OCF resource in
+# an Active-Passive High Availability setup.
+#
+# Author: Ricardo Branco <tsmgeek@gmail.com> : Initial script for minio server
+# License: GNU General Public License (GPL)
+#
+#
+# usage: $0 {start|stop|status|monitor|validate-all|meta-data}
+#
+# The "start" arg starts Minio.
+#
+# The "stop" arg stops it.
+#
+# OCF parameters:
+# OCF_RESKEY_binary
+# OCF_RESKEY_conffile
+# OCF_RESKEY_pidfile
+# OCF_RESKEY_address
+# OCF_RESKEY_volumnpaths
+#
+##########################################################################
+# Initialization:
+
+: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
+. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
+
+# Defaults
+OCF_RESKEY_binary_default="/opt/minio/minio-server"
+OCF_RESKEY_confdir_default="/etc/minio"
+OCF_RESKEY_pidfile_default="/var/run/minio.pid"
+OCF_RESKEY_address_default=":9000"
+OCF_RESKEY_volumepaths_default="/home/shared"
+
+: ${OCF_RESKEY_binary=${OCF_RESKEY_binary_default}}
+: ${OCF_RESKEY_confdir=${OCF_RESKEY_confdir_default}}
+: ${OCF_RESKEY_pidfile=${OCF_RESKEY_pidfile_default}}
+: ${OCF_RESKEY_address=${OCF_RESKEY_address_default}}
+: ${OCF_RESKEY_volumepaths=${OCF_RESKEY_volumepaths_default}}
+
+USAGE="Usage: $0 {start|stop|status|monitor|validate-all|meta-data}";
+
+##########################################################################
+
+usage() {
+ echo $USAGE >&2
+}
+
+meta_data() {
+ cat <<END
+<?xml version="1.0"?>
+<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
+<resource-agent name="minio">
+<version>1.0</version>
+<longdesc lang="en">
+This script manages Minio in an Active-Passive setup
+</longdesc>
+<shortdesc lang="en">OCF Resource Agent compliant Minio server script.</shortdesc>
+
+
+<parameters>
+
+<parameter name="binary">
+<longdesc lang="en">The Minio server binary</longdesc>
+<shortdesc lang="en">The Minio server binary</shortdesc>
+<content type="string" default="${OCF_RESKEY_binary_default}" />
+</parameter>
+
+<parameter name="confdir">
+<longdesc lang="en">
+The Minio configuration directory path.
+For example, "/etc/minio"
+</longdesc>
+<shortdesc lang="en">Configuration directory path</shortdesc>
+<content type="string" default="${OCF_RESKEY_confdir_default}" />
+</parameter>
+
+<parameter name="pidfile">
+<longdesc lang="en">The Minio PID file. The location of the PID file.</longdesc>
+<shortdesc lang="en">PID file</shortdesc>
+<content type="string" default="${OCF_RESKEY_pidfile_default}" />
+</parameter>
+
+<parameter name="address">
+<longdesc lang="en">Address to bind minio to.</longdesc>
+<shortdesc lang="en">Bind address</shortdesc>
+<content type="string" default="${OCF_RESKEY_address_default}" />
+</parameter>
+
+<parameter name="volumepaths">
+<longdesc lang="en">The storage volumes for minio to use.</longdesc>
+<shortdesc lang="en">Storage Volumes</shortdesc>
+<content type="string" default="${OCF_RESKEY_volumepaths_default}" />
+</parameter>
+
+</parameters>
+
+<actions>
+<action name="start" timeout="20" />
+<action name="stop" timeout="20" />
+<action name="monitor" depth="0" timeout="20" interval="60" />
+<action name="validate-all" timeout="2" />
+<action name="meta-data" timeout="5" />
+</actions>
+
+</resource-agent>
+END
+ exit $OCF_SUCCESS
+}
+
+isRunning()
+{
+ kill -0 "$1" > /dev/null 2>&1
+}
+
+minio_status()
+{
+ if [ -f "$OCF_RESKEY_pidfile" ]
+ then
+ # Minio is probably running
+ PID=`head -n 1 $OCF_RESKEY_pidfile`
+ if [ ! -z "$PID" ] ; then
+ isRunning "$PID" && `ps -p $PID | grep minio-server > /dev/null 2>&1`
+ return $?
+ fi
+ fi
+
+ # Minio is not running
+ return $OCF_NOT_RUNNING;
+}
+
+minio_start()
+{
+ # make a few checks and start Minio
+ if ocf_is_root ; then : ; else
+ ocf_log err "You must be root"
+ exit $OCF_ERR_PERM
+ fi
+
+ # if Minio is running return success
+ if minio_status ; then
+ ocf_log info "Minio server is running already"
+ exit $OCF_SUCCESS
+ fi
+
+ # starting Minio
+ cmd="su - root -c \"nohup ${OCF_RESKEY_binary} server --quiet --config-dir ${OCF_RESKEY_confdir} --address ${OCF_RESKEY_address} ${OCF_RESKEY_volumepaths} >/dev/null &\"'echo \$!' "
+
+ ocf_log debug "Starting minio: $cmd"
+
+ eval $cmd > ${OCF_RESKEY_pidfile}
+
+ if [ "$?" -ne 0 ]; then
+ ocf_log err "Minio returned error" $?
+ exit $OCF_ERR_GENERIC
+ fi
+
+ exit $OCF_SUCCESS
+}
+
+
+minio_stop()
+{
+ if minio_status ; then
+ PID=`head -n 1 $OCF_RESKEY_pidfile`
+ if [ ! -z "$PID" ]; then
+ ocf_log info "Killing Minio PID $PID"
+ kill $PID > /dev/null 2>&1
+ if [ "$?" -eq 0 ]; then
+ TRIES=0
+ while isRunning "$PID" && [ "$TRIES" -lt 30 ]
+ do
+ sleep 1
+ ocf_log info "Minio PID $PID is still running"
+ TRIES=`expr $TRIES + 1`
+ done
+ isRunning "$PID"
+ RET=$?
+ if [ "$RET" -eq 0 ]; then
+ ocf_log info "Killing Minio PID $PID with SIGKILL"
+ kill -9 $PID > /dev/null 2>&1
+ while isRunning "$PID"
+ do
+ sleep 1
+ ocf_log info "Minio PID $PID is still running"
+ done
+ fi
+ else
+ ocf_log err "Killing Minio PID $PID FAILED"
+ exit $OCF_ERR_GENERIC
+ fi
+ fi
+ fi
+
+ exit $OCF_SUCCESS
+}
+
+minio_monitor()
+{
+ minio_status
+ RET=$?
+
+ if [ "$RET" -eq 0 ]; then
+ PID=`head -n 1 $OCF_RESKEY_pidfile`
+ ocf_log debug "Minio monitor on PID $PID succeeded"
+ return $OCF_SUCCESS
+ else
+ ocf_log debug "Minio monitor on PID $PID failed"
+ return $OCF_NOT_RUNNING
+ fi
+}
+
+minio_validate_all()
+{
+
+ # check that the minio binary exists
+ if [ ! -x "$OCF_RESKEY_binary" ]; then
+ ocf_log err "Minio server binary $OCF_RESKEY_binary does not exist"
+ exit $OCF_ERR_INSTALLED
+ fi
+
+ # check that the Minioconfig file exists
+ if [ ! -d "$OCF_RESKEY_confdir" ]; then
+ ocf_log err "Minio config dir $OCF_RESKEY_confdir does not exist"
+ exit $OCF_ERR_CONFIGURED
+ fi
+
+}
+
+#
+# Main
+#
+
+if [ $# -ne 1 ]
+then
+ usage
+ exit $OCF_ERR_ARGS
+fi
+
+case $1 in
+ start)
+ minio_validate_all
+ minio_start
+ ;;
+
+ stop)
+ minio_stop
+ ;;
+
+ status)
+ if minio_status; then
+ ocf_log info "Minio is running"
+ exit $OCF_SUCCESS
+ else
+ ocf_log info "Minio is stopped"
+ exit $OCF_NOT_RUNNING
+ fi
+ ;;
+
+ monitor)
+ minio_monitor
+ ;;
+
+ validate-all)
+ minio_validate_all
+ exit $OCF_SUCCESS
+ ;;
+
+ meta-data|metadata|meta_data)
+ meta_data
+ ;;
+
+ usage)
+ usage
+ exit $OCF_SUCCESS
+ ;;
+
+ *)
+ usage
+ ocf_log err "$0 was called with unsupported args: $*"
+ exit $OCF_ERR_UNIMPLEMENTED
+ ;;
+esac
+rc=$?
+ocf_log debug "${OCF_RESOURCE_INSTANCE} $__OCF_ACTION : $rc"
+exit $rc
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Thu, Feb 27, 12:22 AM (14 h, 1 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1465940
Default Alt Text
(12 KB)
Attached To
Mode
rR Resource Agents
Attached
Detach File
Event Timeline
Log In to Comment