Severalnines


Installation

When you receive the mysqlcluster.tgz file..

you should copy it to a front end node that has root access to the hosts (or is part) of your cluster.

Then run (in order):

For MySQL Cluster 6.3 / 7.0 / 7.1

  • gunzip mysqlcluster-XX.tar.gz
  • tar xvf mysqlcluster-XX.tar
  • cd mysqlcluster-XX
  • cd cluster
  • cd scripts
  • cd install

Then you can chose to build from source or to use a binary tar distribution of MySQL Cluster.

To build from source

You must have installed

  • gcc and g++ e.g, apt-get install gcc g++ or yum install gcc.x86_64
  • wget e.g, apt-get install wget or yum install wget.x86_64
  • ncurses-dev e.g, apt-get install libncurses5-dev or yum install ncurses-devel.x86_64

You should now run these scripts from mysqlcluster-/cluster/scripts/install:

  • Mac users: sh macos.sh Download macos.sh and copy it to scripts/ and run it there. Also run it in the scripts/install folder, and in scripts/extra too. This will fix mac related problems wrt the dialect of bash that mac uses.
  • download-and-compile.sh - gets the latest officially released cluster source, configure, and build. The resulting build is in the build/ directory and the binary distribution is in the repo/ directory
  • install-cluster.sh - Distribute the binary located in build/mysql... to the hosts in the cluster
  • bootstrap.sh - sets up directory structures and installs the mysql servers configured with a hostname. The script will delete any old information (if a previous mysqld data directory exists on the same location) located on a host. Configuration files (my.cnf and config.ini) will be installed in /etc/mysql/
  • 'cd ..' and then do start-cluster.sh --initial - starts the management server(s), the data nodes and the mysql server(s) configured with a hostname
  • Instead of the above four scripts you can run deploy.sh, which will run download-and-compile.sh, install-cluster.sh,bootstrap.sh, and start-cluster.sh --initial

Using a tgz distro (binary build from MySQL)

  • Mac users: sh macos.sh Download macos.sh and copy it to scripts/ and run it there. Also run it in the scripts/install folder, and in scripts/extra too. This will fix mac related problems wrt the dialect of bash that mac uses.
  • download-binary-sh - downloads the latest binary release. This only works for Linux x86_64 at the moment.
  • install-cluster.sh - Distribute the binary and upacks them on to the hosts in the cluster
  • bootstrap.sh - sets up directory structures and installs the mysql servers configured with a hostname. The script will delete any old information (if a previous mysqld data directory exists on the same location) located on a host. Configuration files (my.cnf and config.ini) will be installed in /etc/mysql/
  • 'cd ..' and then do start-cluster-initial.sh - starts the management server(s), the data nodes and the mysql server(s) configured with a hostname

After this you can the use the other scripts in the cluster/scripts directory.

Scripts

The scripts are located in:
mysqlcluster-xy/cluster/scripts

Installation scripts Description Version
(when script was introduced)
location mysqlcluster-xy/cluster/scripts/install The installation scripts are located in mysqlcluster-xy/cluster/scripts/install
deploy.sh For MySQL Cluster 6.3 and 7.0. The script runs:
  • download-and-compile.sh
  • dist.sh
  • bootstrap.sh
  • start-cluster.sh --initial
  • 1.0
    download-and-compile.sh usage: ./download-and-compile.sh
    Download and compiles the latest MySQL Cluster source (either 6.3 or 7.0 depending on what you have selected). Source releases are made more often than binary releases. The binary tarball from the build is placed in mysqlcluster-xy/cluster/repo
    1.0
    download-binary.sh usage: ./download-binary.sh
    Download and compiles the latest MySQL Cluster binary release (either 6.3 or 7.0 depending on what you have selected). Only works with Linux x86-64
    Places the binary tarball in mysqlcluster-xy/cluster/repo.
    2.6
    install-cluster.sh usage: ./install-cluster.sh
    Distributes the mysql binary tarball in mysqlcluster-xy/cluster/repo to the defined hosts.
    2.6
    install-host.sh usage: ./install-host.sh <hostname>
    Distributes the mysql binary tarball in mysqlcluster-xy/cluster/repo to a named host.
    2.6
    bootstrap.sh usage: ./bootstrap.sh
    Run only the first time you setup a new Cluster!
    The bootstrap script does:
  • Optionally (y/n question) - removes mysql data directories on each host.
  • Optionally (y/n question) - removes ndbd data directories on each host.
  • Optionally (y/n question) - removes ndb_mgmd data directories on each host.
  • creates mysql data directories on each hosti
  • creates ndbd data directories on each hosti
  • creates ndb_mgmd data directories on each hosti
  • copy configuration files (config.ini and my.cnf) to relevant hosts
  • create 'mysql' user on each host that is defined to run a mysqld
  • This script must be executed before starting the cluster the first time.
    1.0
    add-mysqld.sh usage: ./add-mysqld.sh --hostname=<hostname>
    --hostname=<hostname> - the hostname where to install the mysql server.
    add-mysqld.sh will copy the binaries in 'repo' to the host, install the binary, create the mysql user, and datadir, and install the mysql server.
    start/stop scripts are also generated.
    2.6
    Cluster start/stop scripts Description
    location mysqlcluster-xy/cluster/scripts/ The following scripts are located in mysqlcluster-xy/cluster/scripts/
    start-cluster.sh [--initial] usage: ./start-cluster.sh [--initial]
    Performs a start of mysql cluster. If --initial is specifed it will DELETE the filesystem for the data nodes (this will clear out all old data stored in this MySQL Cluster). The startup sequence is as follows:
  • start all managment servers
  • start all data nodes
  • start all mysql servers
  • 1.0
    stop-cluster.sh usage: ./stop-cluster.sh
    Stops the entire cluster. The script will:
  • stop all mysql servers
  • stop all data nodes
  • stop all management servers
  • 1.0
    Management server scripts Description
    location mysqlcluster-xy/cluster/scripts/ The following scripts are located in mysqlcluster-xy/cluster/scripts/
    start-mgmd-<host>.sh usage: ./start-mgmd-<host>.sh
    starts the management server on <host>
    1.0
    stop-mgmd-<host>.sh usage: ./stop-mgmd-<host>.sh
    stops the management server on <host>
    1.0
    Data node scripts Description
    start-ndbd-<host>-id-<id>.sh [--initial] usage: ./start-ndbd-<host>-id-<id>.sh
    starts the data node with <id> on <host>.
    The ID is used to be able to distinguish between one or more data nodes located on one host. If --initial is specified the data node will clear its local filesystem and resync from another data node.
    1.0
    start-ndbd-<host>-id-<id>.sh --initial usage: ./start-ndbd-<host>-id-<id>.sh --initial
    starts the data node with <id> on <host> with --initial.
    This means it will clear out its data directory, and perform an initial node recovery (copy all data from the other node in the same node group.
    The ID is used to be able to distinguish between one or more data nodes located on one host.
    1.0
    stop-ndbd-<host>-id-<id>.sh usage: ./stop-ndbd-<host>-id-<id>.sh
    stops the data node with <id> on <host>.
    The ID is used to be able to distinguish between one or more data nodes located on one host.
    1.0
    Mysql server scripts Description
    start-mysqld-<host>.sh usage: ./start-mysqld-<host>.sh
    starts the mysqld on <host>.
    If there is a cluster that is started, then the mysqld will join the cluster.
    1.0
    stop-mysqld-<host>.sh usage: ./stop-mysqld-<host>.sh
    stops the mysqld on <host>
    1.0
    mysqlclient-<host>.sh usage: ./mysqlclient-<host>.sh
    starts a mysqlclient on the mysqld running on <host>
    1.0
    Administration scripts Description
    location mysqlcluster-xy/cluster/scripts/ The following scripts are located in mysqlcluster-xy/cluster/scripts/
    rolling-restart.sh [--initial] usage: ./rolling-restart.sh [--initial]
    Performs a rolling restart.
    Usually this is done when upgrading the config.ini (mysqlcluster-xx/config/config.ini).
    . The rolling restart is online, no data will be lost, and there is no service interruption.
    E.g, if you have increased the DataMemory (updated the mysqlcluster-xx/config/config.ini), then you need to perform a rolling restart.
    Some parameter changes requires an rolling-restart.sh --initial. See the reference manual for more information.
    The following will happen:
  • copy mysqlcluster-xx/config/config.ini to the hosts running the managment servers
  • restart the management servers (one at time)
  • restart the data nodes (one at time) - the data nodes will now be started with the new config.ini directives
  • 1.0
    rolling-restart.sh --initial usage: ./rolling-restart.sh --initial
    Performs a initial rolling restart.
    Usually this is done when upgrading the config.ini (mysqlcluster-xx/config/config.ini).
    The rolling restart is online, no data will be lost, and there is no service interruption.
    You need to do an initial rolling restart if you have changed parameters affecting the filesystem (FragmentLogFileSize, NoOfFragmentLogFiles etc). You cannot yet add nodes or change NoOfReplicas online.
    See the reference manual for more information.
    The following will happen:
  • copy mysqlcluster-xx/config/config.ini to the hosts running the managment servers
  • restart the management servers (one at time)
  • restart the data nodes with --initial (one at time) - the data nodes will now clear out its local file system, and resync from another node. When started, it will be started with the new config.ini directives
  • 1.0
    show.sh usage: ./show.sh
    Prints out the nodes in the cluster
    1.0
    status.sh usage: ./status.sh
    Prints out the status of the data nodes in the cluster
    1.0
    start-backup.sh usage: ./start-backup.sh <backupdir>
    Starts a backup, and aggregates the backup files in <backupdir>
    1.0
    restore-backup.sh usage: ./restore-backup.sh --backupdir=<backupdir>
    restores the backup files in <backupdir>
    By specifying the following you can generate csv files from the backup files in <backupdir>:
    --csv
    --csvdir=<output dir for csv files (.txt)> Nothing is restored on the data nodes when specifying --csv.
    2.5
    ndb_mgm.sh Starts the management client. 1.0
    Tool scripts Description
    location mysqlcluster-xy/cluster/scripts/tools The following scripts are located in mysqlcluster-xy/cluster/scripts/tools
    check-cluster-log.sh usage: ./check-cluster.log.sh --hostname=<hostnamr>
    Tails the cluster log on the management server running on <hostname>
    2.5
    check-ndbd-errlog.sh usage: ./check-ndbd-errorlog.sh --nodeid=<id> --hostname=<hostname>
    --nodeid=<id> - the data node id.
    --hostname=<hostname> - the hostname of the data node
    Prints the ndb_<id>_error.log on <hostname>
    2.5
    check-mysqld-errlog.sh
    check-mysql-error.sh (old name)
    usage: ./check-mysqld-errlog.sh --hostname=<hostname>
    --hostname=<hostname> - the hostname of the mysql server
    Prints the error.log from the mysql server on <hostname>
    2.5
    execute-all-mysql.sh usage: ./execute-all-mysql.sh
         --user=<username>
         --password=<password>
         --database=<db>
         --execute=<query>
    -u|--user=<username>- the username to connect to the mysql server as.
    -p|--password=<password> - the password of username
    -d|--database=<database&rt; - database to connect to
    -e|--execute=<query> - query to execute
    all parameters are optional (except --execute), default is equiv. to 'mysql -uroot test' (no password)
    2.5
    error-report.sh usage: ./error-report.sh
    Generates an error report (collected logs etc). Useful for filing bugs and Support issues.
    The error report will be stored in error_reports in cwd.
    2.5
    query-param.sh usage: ./query-param.sh <parameter>
    Prints the values of <parameter>. <parameter> can e.g be DataMemory, IndexMemory, MaxNoOfConcurrentOperations etc
    2.5
    sanity-check-config.sh usage: ./sanity-check-config.sh
    Verifies that the values for:
    IndexMemory
    RedoBuffer
    NoOfFragmentLogFiles
    FragmentLogFileSize
    You have the option to apply them to mysqlcluster-xy/cluster/config/config.ini.
    It is highly recommended to apply them for a correctly working system.
    You will be suggested to either perform a rolling restart or an initial rolling restart.
    2.7
    upgrade-to-production.sh usage: ./upgrade-to-production.sh
    Enables:
    LockPagesInMainMemory=1
    RealTimeScheduler=1
    SchedulerSpinTimer=40
    SchedulerExecutionTimer=80
    You must perform a rolling restart for the changes to take effect.
    Make sure you have enough RAM since LockPagesInMainMemory can cause the OS to freeze if there is insufficient RAM.
    2.7

    File structure and organization

    Below is the organization of scripts and directories.

      mysqlcluster-XX
      |-- cluster
      |    |-- build (used for src builds)
      |    |-- repo (binary .tgz of MySQL Cluster is stored here)
      |    |-- config (config.ini, my.cnf etc)
      |    |-- init.d (initd scripts for cluster)
      |    |-- scripts (start,stop scripts..)
      |            |-- install (all the install scripts..)
      |                |-- .s9s (meta data describing the cluster, which version that is currently used ('latest' points to the cluster release in 'repo' which is currently installed)
      |            `-- tools (tool scripts..)
      |-- cmon
      |    |-- build_cmon_linux.sh
      |    |-- init.d (initd scripts for cmon)
      |    |-- install_cmon_initd_linux.sh
      |    |-- start_all_cmon_linux.sh
      |    |-- stop_all_cmon_linux.sh
      |    `-- uninstall_cmon_initd_linux.sh
      `-- monit
            |-- build_monit_linux.sh
            |-- etc (monit files)
            |-- init.d (initd files for monit)
            |-- install_monit_inittab_linux.sh
            `-- uninstall_monit_inittab_linux.sh

    Other tools

    2009-May-05 - This has not been updated for a while..

    cmon

    You must have a running cluster first (easiest that way..)

      cd mysqlcluster-6X
      cd cmon
      bash ./build_cmon_linux.sh
      bash ./install_cmon_initd_linux.sh
      bash ./start_all_cmon_linux.sh

    Read more about cmon

    monit

    You must have a running cluster first (easiest that way..)

      cd mysqlcluster-6X
      cd monit
      bash ./build_monit_linux.sh
      bash ./install_monit_inittab_linux.sh

    Read more about monit

    You should now have a fully monitored and managed cluster!

    Support and Help

    Please email support at severalnines dot com if you have problems with the scripts!