summaryrefslogtreecommitdiff
path: root/ndb/bin/mysqlclusterd
blob: 3b4deb3ed480965ea2cf3dc6f7000740e67f88a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh

# configurable parameters
MYSQLCLUSTER_PORT_BASE="22"
# end configurable parameters

if [ -z "$MYSQLCLUSTER_TOP" -o ! -d "$MYSQLCLUSTER_TOP" ]; then
  echo "MYSQLCLUSTER_TOP not set or directory does not exist"
  exit 1
fi
if [ -z "$MYSQLCLUSTER_TOP" -o ! -d "$MYSQLCLUSTER_TOP/ndb" ]; then
  echo "$MYSQLCLUSTER_TOP/ndb directory does not exist"
  exit 1
fi

if test "$1" = "ndb_started"
then
  shift
  mgmt_host=$1
  shift
  mgmt_port=$1
  shift
  if [ -z "$mgmt_host" -o -z "$mgmt_port" ]; then
    echo "syntax: ndb_started hostname port"
    exit 1
  fi
  NDB_CONNECTSTRING="host=$mgmt_host:$mgmt_port;nodeid=11"
  echo using NDB_CONNECTSTRING=$NDB_CONNECTSTRING
else
  NDB_CONNECTSTRING="host=localhost:"$MYSQLCLUSTER_PORT_BASE"00;nodeid=11"
fi
export NDB_CONNECTSTRING

mysqld --default-table-type=ndbcluster --basedir=$MYSQLCLUSTER_TOP --datadir=$MYSQLCLUSTER_TOP/data --socket=$MYSQLCLUSTER_TOP/data/mysqlcluster.sock $*