summaryrefslogtreecommitdiff
path: root/databases/mysql-cluster/files
diff options
context:
space:
mode:
authorjnemeth <jnemeth>2014-12-01 05:57:48 +0000
committerjnemeth <jnemeth>2014-12-01 05:57:48 +0000
commit050b9db8b660da04186a9f40053fc19ba468d92d (patch)
treebd2b32d64ceed8405e118ef42d2ad76dbbfb2d4d /databases/mysql-cluster/files
parentcae18272ccd0bf20693938edb846192fdf7fec24 (diff)
downloadpkgsrc-050b9db8b660da04186a9f40053fc19ba468d92d.tar.gz
MySQL Cluster is a highly scalable, real-time, ACID-compliant
transactional database, combining 99.999% availability with the low TCO of open source. Designed around a distributed, multi-master architecture with no single point of failure, MySQL Cluster scales horizontally on commodity hardware to serve read and write intensive workloads, accessed via SQL and NoSQL interfaces.
Diffstat (limited to 'databases/mysql-cluster/files')
-rw-r--r--databases/mysql-cluster/files/my-cluster.cnf15
-rw-r--r--databases/mysql-cluster/files/mysql-cluster.ini31
-rw-r--r--databases/mysql-cluster/files/mysqld.sh105
-rw-r--r--databases/mysql-cluster/files/ndb_mgmd.sh49
-rw-r--r--databases/mysql-cluster/files/ndbd.sh49
-rw-r--r--databases/mysql-cluster/files/ndbmtd.sh49
-rw-r--r--databases/mysql-cluster/files/smf/manifest.xml51
-rw-r--r--databases/mysql-cluster/files/smf/mysqld.sh64
-rw-r--r--databases/mysql-cluster/files/smf/ndbd.sh20
9 files changed, 433 insertions, 0 deletions
diff --git a/databases/mysql-cluster/files/my-cluster.cnf b/databases/mysql-cluster/files/my-cluster.cnf
new file mode 100644
index 00000000000..c5135349aea
--- /dev/null
+++ b/databases/mysql-cluster/files/my-cluster.cnf
@@ -0,0 +1,15 @@
+[mysqld]
+ndbcluster
+bind-address=@INTERNAL_IP@
+ndb-connectstring=
+
+[ndbd]
+bind-address=@INTERNAL_IP@
+ndb-connectstring=
+
+[ndb_mgmd]
+configdir=@VARBASE@/mysql
+bind-address=@INTERNAL_IP@
+
+[ndb_mgm]
+ndb-connectstring=@INTERNAL_IP@
diff --git a/databases/mysql-cluster/files/mysql-cluster.ini b/databases/mysql-cluster/files/mysql-cluster.ini
new file mode 100644
index 00000000000..2c05fbb468c
--- /dev/null
+++ b/databases/mysql-cluster/files/mysql-cluster.ini
@@ -0,0 +1,31 @@
+[ndbd default]
+# Options affecting ndbd processes on all data nodes:
+NoOfReplicas=2 # Number of replicas
+DataMemory=200M # How much memory to allocate for data storage
+IndexMemory=50M # How much memory to allocate for index storage
+ # For DataMemory and IndexMemory, we have used the
+ # default values. Since the "world" database takes up
+ # only about 500KB, this should be more than enough for
+ # this example Cluster setup.
+
+[ndb_mgmd]
+# Management process options:
+hostname=@INTERNAL_IP@ # Hostname or IP address of MGM node
+datadir=@VARBASE@/mysql # Directory for MGM node log files
+
+#[ndbd]
+# Options for data node "A":
+#hostname=x.x.x.x # Hostname or IP address
+#datadir=@VARBASE@/mysql # Directory for this data node's data files
+
+#[ndbd]
+# Options for data node "B":
+#hostname=x.x.x.x # Hostname or IP address
+#datadir=@VARBASE@/mysql # Directory for this data node's data files
+
+#[mysqld]
+# SQL node options:
+#hostname=x.x.x.x # Hostname or IP address
+ # (additional mysqld connections can be
+ # specified for this node for various
+ # purposes such as running ndb_restore)
diff --git a/databases/mysql-cluster/files/mysqld.sh b/databases/mysql-cluster/files/mysqld.sh
new file mode 100644
index 00000000000..d13d4c92365
--- /dev/null
+++ b/databases/mysql-cluster/files/mysqld.sh
@@ -0,0 +1,105 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: mysqld.sh,v 1.1.1.1 2014/12/01 05:58:03 jnemeth Exp $
+#
+# PROVIDE: mysqld
+# REQUIRE: DAEMON LOGIN mountall
+# KEYWORD: shutdown
+#
+# You will need to set some variables in /etc/rc.conf to start MySQL:
+#
+# mysqld=YES
+#
+# The following variables are optional:
+#
+# mysqld_user="mysql" # user to run mysqld as
+# mysqld_datadir="/path/to/home" # path to MySQL database directory
+#
+
+if [ -f /etc/rc.subr ]; then
+ . /etc/rc.subr
+fi
+
+name="mysqld"
+rcvar=${name}
+command="@PREFIX@/bin/mysqld_safe"
+procname="@PREFIX@/sbin/${name}"
+: ${mysqld_user:=@MYSQL_USER@}
+: ${mysqld_group:=@MYSQL_GROUP@}
+: ${mysqld_datadir:=@MYSQL_DATADIR@}
+
+extra_commands="initdb"
+initdb_cmd="mysqld_initdb"
+start_precmd="mysqld_precmd"
+start_cmd="mysqld_start"
+
+mysqld_precmd()
+{
+ if [ ! -d ${mysqld_datadir}/mysql ]; then
+ ${initdb_cmd}
+ fi
+}
+
+mysqld_initdb()
+{
+ initdb="@PREFIX@/bin/mysql_install_db"
+ if [ ! -x ${initdb} ]; then
+ return 1
+ fi
+ if [ -f ${mysqld_datadir}/mysql/host.frm ]; then
+ @ECHO@ "The MySQL database has already been initialized."
+ @ECHO@ "Skipping database initialization."
+ else
+ @ECHO@ "Initializing MySQL database system tables."
+ ${initdb} --force --user=${mysqld_user} \
+ --datadir=${mysqld_datadir} || return 1
+ if [ -d ${mysqld_datadir} ]; then
+ @CHOWN@ -R ${mysqld_user}:${mysqld_group} \
+ ${mysqld_datadir}
+ fi
+ fi
+}
+
+mysqld_start()
+{
+ for f in $required_files; do
+ if [ ! -r "$f" ]; then
+ @ECHO@ 1>&2 "$0: WARNING: $f is not readable"
+ if [ -z $rc_force ]; then
+ return 1
+ fi
+ fi
+ done
+ @ECHO@ "Starting ${name}."
+ ulimit -n 4096
+ cd @PREFIX@
+ ${command} --user=${mysqld_user} --datadir=${mysqld_datadir} \
+ --pid-file=${pidfile} ${mysqld_flags} \
+ ${thread_flags} &
+}
+
+if [ -f /etc/rc.subr -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]; then
+ load_rc_config $name
+ pidfile="${mysqld_datadir}/`@HOSTNAME_CMD@`.pid"
+ run_rc_command "$1"
+else
+ if [ -f /etc/rc.conf ]; then
+ . /etc/rc.conf
+ fi
+ pidfile="${mysqld_datadir}/`@HOSTNAME_CMD@`.pid"
+ case "$1" in
+ initdb)
+ eval ${initdb_cmd}
+ ;;
+ stop)
+ if [ -r "${pidfile}" ]; then
+ @ECHO@ "Stopping ${name}."
+ kill `@CAT@ ${pidfile}`
+ fi
+ ;;
+ *)
+ eval ${start_precmd}
+ eval ${start_cmd}
+ ;;
+ esac
+fi
diff --git a/databases/mysql-cluster/files/ndb_mgmd.sh b/databases/mysql-cluster/files/ndb_mgmd.sh
new file mode 100644
index 00000000000..e1e9f4e2cea
--- /dev/null
+++ b/databases/mysql-cluster/files/ndb_mgmd.sh
@@ -0,0 +1,49 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: ndb_mgmd.sh,v 1.1.1.1 2014/12/01 05:58:03 jnemeth Exp $
+#
+# PROVIDE: ndb_mgmd
+# REQUIRE: DAEMON LOGIN mountall
+# KEYWORD: shutdown
+#
+# You will need to set some variables in /etc/rc.conf to start MySQL:
+#
+# ndb_mgmd=YES
+#
+
+if [ -f /etc/rc.subr ]; then
+ . /etc/rc.subr
+fi
+
+name="ndb_mgmd"
+rcvar=${name}
+command="@PREFIX@/sbin/$name"
+
+mysqld_start()
+{
+ @ECHO@ "Starting ${name}."
+ cd @PREFIX@
+ ${command}
+}
+
+if [ -f /etc/rc.subr -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]; then
+ load_rc_config $name
+ pidfile="/var/run/${name}.pid"
+ run_rc_command "$1"
+else
+ if [ -f /etc/rc.conf ]; then
+ . /etc/rc.conf
+ fi
+ pidfile="/var/run/${name}.pid"
+ case "$1" in
+ stop)
+ if [ -r "${pidfile}" ]; then
+ @ECHO@ "Stopping ${name}."
+ kill `@CAT@ ${pidfile}`
+ fi
+ ;;
+ start
+ eval ${start_cmd}
+ ;;
+ esac
+fi
diff --git a/databases/mysql-cluster/files/ndbd.sh b/databases/mysql-cluster/files/ndbd.sh
new file mode 100644
index 00000000000..63fb845b125
--- /dev/null
+++ b/databases/mysql-cluster/files/ndbd.sh
@@ -0,0 +1,49 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: ndbd.sh,v 1.1.1.1 2014/12/01 05:58:03 jnemeth Exp $
+#
+# PROVIDE: ndbd
+# REQUIRE: DAEMON LOGIN mountall
+# KEYWORD: shutdown
+#
+# You will need to set some variables in /etc/rc.conf to start MySQL:
+#
+# ndbd=YES
+#
+
+if [ -f /etc/rc.subr ]; then
+ . /etc/rc.subr
+fi
+
+name="ndbd"
+rcvar=${name}
+command="@PREFIX@/sbin/$name"
+
+mysqld_start()
+{
+ @ECHO@ "Starting ${name}."
+ cd @PREFIX@
+ ${command}
+}
+
+if [ -f /etc/rc.subr -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]; then
+ load_rc_config $name
+ pidfile="/var/run/${name}.pid"
+ run_rc_command "$1"
+else
+ if [ -f /etc/rc.conf ]; then
+ . /etc/rc.conf
+ fi
+ pidfile="/var/run/${name}.pid"
+ case "$1" in
+ stop)
+ if [ -r "${pidfile}" ]; then
+ @ECHO@ "Stopping ${name}."
+ kill `@CAT@ ${pidfile}`
+ fi
+ ;;
+ start
+ eval ${start_cmd}
+ ;;
+ esac
+fi
diff --git a/databases/mysql-cluster/files/ndbmtd.sh b/databases/mysql-cluster/files/ndbmtd.sh
new file mode 100644
index 00000000000..86824c685ea
--- /dev/null
+++ b/databases/mysql-cluster/files/ndbmtd.sh
@@ -0,0 +1,49 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: ndbmtd.sh,v 1.1.1.1 2014/12/01 05:58:03 jnemeth Exp $
+#
+# PROVIDE: ndbmtd
+# REQUIRE: DAEMON LOGIN mountall
+# KEYWORD: shutdown
+#
+# You will need to set some variables in /etc/rc.conf to start MySQL:
+#
+# ndbmtd=YES
+#
+
+if [ -f /etc/rc.subr ]; then
+ . /etc/rc.subr
+fi
+
+name="ndbmtd"
+rcvar=${name}
+command="@PREFIX@/sbin/$name"
+
+mysqld_start()
+{
+ @ECHO@ "Starting ${name}."
+ cd @PREFIX@
+ ${command}
+}
+
+if [ -f /etc/rc.subr -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]; then
+ load_rc_config $name
+ pidfile="/var/run/${name}.pid"
+ run_rc_command "$1"
+else
+ if [ -f /etc/rc.conf ]; then
+ . /etc/rc.conf
+ fi
+ pidfile="/var/run/${name}.pid"
+ case "$1" in
+ stop)
+ if [ -r "${pidfile}" ]; then
+ @ECHO@ "Stopping ${name}."
+ kill `@CAT@ ${pidfile}`
+ fi
+ ;;
+ start
+ eval ${start_cmd}
+ ;;
+ esac
+fi
diff --git a/databases/mysql-cluster/files/smf/manifest.xml b/databases/mysql-cluster/files/smf/manifest.xml
new file mode 100644
index 00000000000..9dc76c0b985
--- /dev/null
+++ b/databases/mysql-cluster/files/smf/manifest.xml
@@ -0,0 +1,51 @@
+<?xml version='1.0'?>
+<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
+<service_bundle type='manifest' name='@SMF_NAME@'>
+ <service name='@SMF_PREFIX@/@SMF_NAME@' type='service' version='1'>
+ <dependency name='fs' grouping='require_all' restart_on='none' type='service'>
+ <service_fmri value='svc:/system/filesystem/local' />
+ </dependency>
+ <dependency name='net' grouping='require_all' restart_on='none' type='service'>
+ <service_fmri value='svc:/network/loopback' />
+ </dependency>
+ <dependency name='config' grouping='require_all' restart_on='none' type='path'>
+ <service_fmri value='file://@PKG_SYSCONFDIR@/my.cnf'/>
+ </dependency>
+ <method_context project='mysql' resource_pool=':default' working_directory='@MYSQL_DATADIR@'>
+ <method_credential user='@MYSQL_USER@' group='@MYSQL_GROUP@' limit_privileges=':default' privileges=':default' supp_groups=':default'/>
+ <method_environment>
+ <envvar name='LD_PRELOAD_32' value='/usr/lib/extendedFILE.so.1' />
+ </method_environment>
+ </method_context>
+ <instance name='mysqld' enabled='false'>
+ <exec_method name='start' type='method' exec='@PREFIX@/@SMF_METHOD_FILE.mysqld@ start' timeout_seconds='0' />
+ <exec_method name='stop' type='method' exec='@PREFIX@/@SMF_METHOD_FILE.mysqld@ stop' timeout_seconds='0' />
+ <property_group name='mysqld' type='application'>
+ <propval name='ndb_connectstring' type='astring' value='none'/>
+ </property_group>
+ </instance>
+ <instance name='ndbd' enabled='false'>
+ <exec_method name='start' type='method' exec='@PREFIX@/@SMF_METHOD_FILE.ndbd@ start' timeout_seconds='0' />
+ <exec_method name='stop' type='method' exec=':kill' timeout_seconds='0' />
+ <property_group name='ndbd' type='application'>
+ <propval name='ndb_connectstring' type='astring' value='none'/>
+ </property_group>
+ </instance>
+ <instance name='ndb_mgmd' enabled='false'>
+ <dependency name='config' grouping='require_all' restart_on='error' type='path'>
+ <service_fmri value='file://@PKG_SYSCONFDIR@/mysql-cluster.ini'/>
+ </dependency>
+ <exec_method name='start' type='method' exec='@LOCALBASE@/sbin/ndb_mgmd --reload -f @PKG_SYSCONFDIR@/mysql-cluster.ini' timeout_seconds='0' />
+ <exec_method name='stop' type='method' exec=':kill' timeout_seconds='0' />
+ </instance>
+ <stability value='Evolving' />
+ <template>
+ <common_name>
+ <loctext xml:lang='C'>MySQL Cluster</loctext>
+ </common_name>
+ <documentation>
+ <doc_link name='mysql.com' uri='http://www.mysql.com/products/cluster/' />
+ </documentation>
+ </template>
+ </service>
+</service_bundle>
diff --git a/databases/mysql-cluster/files/smf/mysqld.sh b/databases/mysql-cluster/files/smf/mysqld.sh
new file mode 100644
index 00000000000..745685c9b40
--- /dev/null
+++ b/databases/mysql-cluster/files/smf/mysqld.sh
@@ -0,0 +1,64 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# William Pool (Puddle) 01/05
+# SMF Method file for MySQL
+# E-mail: puddle@flipmotion.com
+#
+# Updated by Joyent for pkgsrc based MySQL installs
+#
+# NOTE: Make sure DB_DIR is owned BY the mysql user and group and chmod
+# 700.
+#
+
+. /lib/svc/share/smf_include.sh
+
+DB_BASE=@LOCALBASE@
+DB_EXEC=${DB_BASE}/sbin
+
+DB_DATA=@MYSQL_DATADIR@
+PIDFILE=${DB_DATA}/mysql.pid
+LOGFILE=@VARBASE@/log/mysql/error.log
+
+CONSTRING=$(svcprop -p mysqld/ndb_connectstring $SMF_FMRI 2>/dev/null)
+
+ulimit -n 10240
+
+case "$1" in
+start)
+ if [[ "${CONSTRING}" != "none" ]] && [[ "${CONSTRING}" != \"\" ]]; then
+ ${DB_EXEC}/mysqld --user=mysql \
+ --basedir=${DB_BASE} \
+ --datadir=${DB_DATA} \
+ --pid-file=${PIDFILE} \
+ --log-error=${LOGFILE} \
+ --ndb-connectstring="${CONSTRING}" \
+ > /dev/null &
+ else
+ ${DB_EXEC}/mysqld --user=mysql \
+ --basedir=${DB_BASE} \
+ --datadir=${DB_DATA} \
+ --pid-file=${PIDFILE} \
+ --log-error=${LOGFILE} \
+ > /dev/null &
+ fi
+ ;;
+stop)
+ if [ -f ${PIDFILE} ]; then
+ /usr/bin/kill `cat ${PIDFILE}` > /dev/null 2>&1
+ fi
+ ;;
+restart)
+ $0 stop
+ while pgrep mysqld > /dev/null
+ do
+ sleep 1
+ done
+ $0 start
+ ;;
+*)
+ echo ""
+ echo "Usage: `basename $0` { start | stop | restart }"
+ echo ""
+ exit 64
+ ;;
+esac
diff --git a/databases/mysql-cluster/files/smf/ndbd.sh b/databases/mysql-cluster/files/smf/ndbd.sh
new file mode 100644
index 00000000000..e3436920299
--- /dev/null
+++ b/databases/mysql-cluster/files/smf/ndbd.sh
@@ -0,0 +1,20 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: ndbd.sh,v 1.1.1.1 2014/12/01 05:58:03 jnemeth Exp $
+#
+
+CONSTRING=$(svcprop -p ndbd/ndb_connectstring $SMF_FMRI 2>/dev/null)
+
+case "$1" in
+start)
+ if [[ "${CONSTRING}" != "none" ]] && [[ "${CONSTRING}" != \"\" ]]; then
+ @LOCALBASE@/sbin/ndbd --ndb-connectstring=${CONSTRING} -d
+ else
+ @LOCALBASE@/sbin/ndbd -d
+ fi
+ ;;
+*)
+ echo "Usage: $0 { start }"
+ exit 2
+ ;;
+esac