Configurator for MySQL Cluster - version 4.2.0

This page contains the following information:

  • What will be installed
  • System Requirements
  • How to Install the Deployment Package
  • Documentation of CoreScripts
  • File structure and organization
  • Support
  • Troubleshooting

What will be installed

  • If you chose to use binary/RPM version, you will be using MySQL Cluster ...
  • If you chose to build from source, you will be using MySQL Cluster .. (GPL with innodb).

Below are instruction how to get going! Print this page as a reference.

At the end you will also find some common problems and how to resolve them. Email feedback@severalnines.com if you have problems.

System Requirements

  • No prior installation of mysql (watch out for previously auto-installed mysql packages that comes in the OS. Use e.g 'yum remove mysql mysql-server' or 'apt-get remove mysql'. Please note that the package names may be called something different.
  • Ubuntu users (and possibly others) - enable root account on all machines.
  • SELinux and firewalls disabled
    SELinux - Check /etc/selinux/config (set SELINUX=disabled and reboot
    Firewall - /sbin/iptables -L - this command should print out that no ports are blocked
    chkconfig iptables off
    /etc/init.d/iptables stop
  • /etc/hosts is sane. It must not have a line looking like this:
    127.0.0.1 some_hostname localhost localhost.localdomain localhost
    If you have some_hostname the nodes will not connect correctly, and yo have to change to (remove all references to actual hostname on the line(s) starting with 127.0.0.1:
    127.0.0.1 localhost localhost.localdomain localhost
  • Otherwise nodes will not connect to each other - 'waiting for PID' or will always be stuck in start phase 0 - will be the result

    You should also disable NUMA, and make sure you don't swap!

    How to Install the Deployment Package

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

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

    Using a binary build (or RPMs) from MySQL

  • Run (in order):

    1. If you don't have internet access

    2. Please contact us for a list of necessary RPM/TARs to install.
    3. To build from source

      You must have installed

      • gcc and g++
        apt-get install gcc g++ autoconf automake libtool or yum install gcc gcc-c++ autoconf automake libtool
      • wget
        apt-get install wget or yum install wget
      • ncurses-dev
        apt-get install libncurses5-dev or yum install ncurses-devel

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

      • shared-ssh-keys.sh - Sets up shared ssh keys, follow the instructions carefully. This step is not neeed if you already have shared ssh keys (ssh without typing passwords).
      • download-and-compile.sh - gets the latest officially released cluster source, configure, and build. The resulting build is in the build/ directory
      • install-cluster.sh - Distribute the binary located in 'mysqlcluste-xy/cluster/repo' directory ... 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 /
      • '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, dist-src-build.sh,bootstrap.sh, and start-cluster.sh --initial

      Documentation of CoreScripts

      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 The script runs:
    4. shared-ssh-keys.sh/li>
    5. download-binary.sh or install-rpm.sh
    6. install-cluster.sh
    7. bootstrap.sh
    8. start-cluster.sh --initial
    9. 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:
    10. removes mysql data directories on each host.
    11. removes ndbd data directories on each host.
    12. removes ndb_mgmd data directories on each host.
    13. creates mysql data directories on each hosti
    14. creates ndbd data directories on each hosti
    15. creates ndb_mgmd data directories on each hosti
    16. copy configuration files (config.ini and my.cnf) to relevant hosts
    17. create 'mysql' user on each host that is defined to run a mysqld
    18. 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:
    19. start all managment servers
    20. start all data nodes
    21. start all mysql servers
    22. 1.0
      stop-cluster.sh usage: ./stop-cluster.sh
      Stops the entire cluster. The script will:
    23. stop all mysql servers
    24. stop all data nodes
    25. stop all management servers
    26. 1.0
      Management server scripts Description
      location mysqlcluster-xy/cluster/scripts/ The following scripts are located in mysqlcluster-xy/cluster/scripts/
      ./start-mgmd.sh --hostname=<host> usage: ./start-mgmd.sh --hostname=<host>
      starts the management server on <host>
      1.0
      ./stop-mgmd.sh --hostname=<host> stop-mgmd-<host>.sh ./stop-mgmd.sh --hostname=<host>
      stops the management server on <host>
      1.0
      Data node scripts Description
      start-ndbd.sh --hostname=<host> [--id=<id>] [ --initial ] [--nowait] [--force] usage: ./start-ndbd.sh --hostname=<host> [--id=<id>] [ --initial ] [--nowait] [--force]
      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.sh --hostname=<host> [--id=<id>] usage: ./stop-ndbd.sh --hostname=<host> [--id=<id>]
      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.sh --hostname=<host> usage: ./start-mysqld.sh --hostname=<host>
      starts the mysqld on <host>.
      If there is a cluster that is started, then the mysqld will join the cluster.
      1.0
      stop-mysqld.sh --hostname=<host> usage: stop-mysqld.sh --hostname=<host>
      stops the mysqld on <host>
      1.0
      mysqlclient.sh --hostname=<host> usage: ./mysqlclient.sh --hostname=<host>
      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] --layer=[all|storage|sql] 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:
    27. copy mysqlcluster-xx/config/config.ini to the hosts running the managment servers
    28. restart the management servers (one at time)
    29. restart the data nodes (one at time) - the data nodes will now be started with the new config.ini directives
    30. 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 parameters in config.ini.
      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..)

      Support

      Severalnines provides commercial support via a subscription service.
      Contact sales@severalnines.com for more information.

      Troubleshooting

      Cluster does not start

      • Verify SELinux settings, firewalls, and /etc/hosts
      • "sudo: sorry, you must have a tty to run sudo" -
        sudo visudo
        comment out: #Default requiretty
      • Check that you have disk space
      • Verify you can ping the hosts
      • Verify that you have enough RAM
      • Verify that you have enough cores for the data nodes
      • Verify that you haven't installed a 64-bit version on 32-bit machines

      If you still can't start MySQL Cluster, please contact support@severalnines.com

      Error loading shared libraries - LD_LIBRARY_PATH not set

      If you get the something like the following error message when starting the mysql client (or any other mysql tool):
      /usr/local/mysql/mysql/bin/mysql: error while loading shared libraries:
      libmysqlclient.so.16: cannot open shared object file: No such file or directory

      Then you need to set the LD_LIBRARY_PATH:
      E.g:
      export LD_LIBRARY_PATH=/usr/local/mysql/mysql/lib/mysql:$LD_LIBRARY_PATH
      or
      export LD_LIBRARY_PATH=/usr/local/mysql/lib/mysql:$LD_LIBRARY_PATH
      or
      export LD_LIBRARY_PATH=/usr/local/mysql/mysql/lib/:$LD_LIBRARY_PATH
      or
      export LD_LIBRARY_PATH=/usr/local/mysql/lib/:$LD_LIBRARY_PATH
      are common LD_LIBRARY_PATHSs

      [MgmSrvr] ERROR -- Error opening '.../config.ini'

      If you get the following error:
      [MgmSrvr] ERROR -- Error opening '/.../mysqlcluster-70/scripts/../config/config.ini',
      error: 2, No such file or directory

      Then you have forgot to run:
      sh bootstrap.sh
      Make sure you have run the download, dist and bootstrap scripts.

      .. Bad substitution

      If you get this try to run the scripts with:
      ./scriptname
      or
      bash ./scriptname