root/trunk/ndbinstaller.sh

Revision 128, 182.2 kB (checked in by jdowling, 2 months ago)
Line 
1#!/bin/bash
2
3###################################################################################################
4#                                                                                                 #
5# This code is released under the GNU General Public License, Version 3, see for details:         #
6# http://www.gnu.org/licenses/gpl-3.0.txt                                                         #
7#                                                                                                 #
8# Commercial licenses can be acquired by contacting info@www.jimdowling.info                      #
9#                                                                                                 #
10# Copyright (c) Jim Dowling, 2007.                                                                #
11# All Rights Reserved.                                                                            #
12#                                                                                                 #
13###################################################################################################
14
15###################################################################################################
16#                                                                                                 #
17#      ####### #      #     # ####### ######## ###### ######                                      #
18#      #       #      #     # #          #     #      #    #                                      #
19#      #       #      #     # #######    #     #####  #####                                       #
20#      #       #      #     #       #    #     #      # #                                         #
21#      ####### ###### ####### #######    #     ###### #   #                                       #
22#                                                                                                 #     
23#      # #   # ####### ######## ###### #      #      ###### ######                                #
24#      # ##  # #          #     #    # #      #      #      #    #                                #
25#      # # # # #######    #     ###### #      #      #####  #####                                 #
26#      # #  ##       #    #     #    # #      #      #      # #                                   #
27#      # #   # #######    #     #    # ###### ###### ###### #   #                                 #
28#                                                                                                 #
29###################################################################################################
30
31
32
33###################################################################################################
34# NDB VERSION AND MIRROR CONFIG OPTIONS
35###################################################################################################
36
37NDB_INSTALLER_VERSION="Ndb Installer Version 0.2 \n\nCopyright (c) Jim Dowling, 2007."
38
39PRODUCT="MySQL Cluster"
40PLATFORM="linux"
41CPU=
42RELEASE="-telco"
43
44MYSQL_VERSION_MAJOR="5"
45MYSQL_VERSION_MINOR="1"
46MYSQL_VERSION_REV="24"
47
48NDB_VERSION_MAJOR="6"
49NDB_VERSION_MINOR="3"
50NDB_VERSION_REV="16"
51
52
53
54
55#
56# ftp://ftp.mysql.com/pub/mysql/download/cluster_telco/mysql-5.1.24-ndb-6.3.16/mysql-5.1.24-ndb-6.3.16-telco.tar.gz
57#
58# E.g., VERSION="mysql-5.1.22-beta-linux-i686"; used for myql directory name
59# Version numbers are constructed to look like (eg) 'mysql-5.1.24-ndb-6.2.15-telco.tar.gz'
60#VERSION="mysql-${MYSQL_VERSION_MAJOR}.${MYSQL_VERSION_MINOR}.${MYSQL_VERSION_REV}
61#         ${NDB_VERSION_MAJOR}.${NDB_VERSION_MINOR}.${NDB_VERSION_REV}-${RELEASE}-${PLATFORM}-$CPU$"
62VERSION=
63# NDB_VERSION used for ndb directory name
64#NDB_VERSION="-ndb-${MYSQL_VERSION_MAJOR}.${MYSQL_VERSION_MINOR}.${MYSQL_VERSION_REV}${RELEASE}"
65#" -${PLATFORM}-$CPU"
66NDB_VERSION=
67
68# Where to download mysql binaries from
69MIRROR="ftp://ftp.mysql.com/pub/mysql/download/cluster_telco/"
70
71MIRROR1="/from/http://www.mirrorservice.org/sites/ftp.mysql.com/"
72MIRROR2="/from/http://ftp.heanet.ie/mirrors/www.mysql.com/"
73MIRROR3="/from/2http://mysql.he.net/"
74MIRROR4="/from/http://mysql.orst.edu/"
75MIRROR5="/from/http://mirror.switch.ch/ftp/mirror/mysql/"
76
77# This is bash-only
78#MIRRORS=( $MIRROR1 $MIRROR2 $MIRROR3 $MIRROR4 $MIRROR5 )
79
80
81###################################################################################################
82# Default Install Directories. Note these are changed in check_usesrid()
83# if the user does not run the script as root.
84###################################################################################################
85NDB_INSTALL_DIR=/var/lib/mysql-cluster
86NDB_DIR=/var/lib/mysql-cluster
87MYSQL_INSTALL_DIR=
88#/usr/local
89MYSQL_BASE_DIR=
90NDB_DATADIR=ndb_data
91MGM_DATADIR=mgmd1
92MYSQL_BINARIES_DIR=
93NDB_LOGS_DIR=
94MYSQL_NUM=mysql_1
95
96
97###################################################################################################
98# NDB Data Node hostnames
99###################################################################################################
100# declare an array of nodes
101# Max Number of Hosts set to 16. You can add more entries here.
102# TODO: change this from bash (arrays) to no arrays (csh)
103#declare -a NDB_HOST
104#NDB_HOST[0]="localhost"
105#NDB_HOST[1]="localhost"
106#NDB_HOST[2]="localhost"
107#NDB_HOST[3]="localhost"
108
109NDB_HOST=('localhost'
110          'localhost'
111          'localhost'
112          'localhost'
113          'localhost'
114          'localhost'
115          'localhost'
116          'localhost'
117          'localhost'
118          'localhost'
119          'localhost'
120          'localhost'
121          'localhost'
122          'localhost'
123          'localhost'
124          'localhost'
125          'localhost'
126        )
127if [ $? -ne 0 ] ; then
128  exit_error "Arrays not supported in your shell version"
129fi
130
131
132########################################################
133# NDB Default Configuration                            #
134########################################################
135
136# The 'M' is appended to DataMemory and IndexMemory sizes later in script
137DATA_MEMORY=80
138INDEX_MEMORY=18
139
140# Extra config.ini default values
141STRING_MEMORY=25
142MAX_NO_OF_TABLES=4096
143MAX_NO_OF_ORDERED_INDEXES=2048
144MAX_NO_OF_UNIQUE_HASH_INDEXES=4096
145MAX_NO_OF_ATTRIBUTES=24576
146MAX_NO_OF_CONCURRENT_SCANS=256
147
148
149# Redo Log file Default Size
150NUM_FRAGMENT_LOGFILES=6
151FRAGMENT_LOGFILE_SIZE=256M
152
153# Default Number of Replicas
154NUM_REPLICAS=2
155
156# Default hostname for Mgm Server
157MGM_HOST=$LOCALHOST
158
159# Disk write b/w used for checkpoints
160DISK_CHECKPOINT_SPEED=10
161
162# Disk write b/w for checkpoints when restarting a node
163DISK_CHECKPOINT_SPEED_IN_RESTART=100
164
165# Disk Buffer used when writing checkpoints
166DISK_SYNC_SIZE=4
167
168# Size of the Redo Log Buffer
169REDO_BUFFER=32
170
171# This parameter states the maximum time that is permitted to lapse
172# between operations in the same transaction before the transaction is aborted.
173TRANSACTION_INACTIVE_TIMEOUT=2000
174
175# Time for master to ping all ndbds
176TIME_BETWEEN_GLOBAL_CHECKPOINTS=1000
177
178# Amount of Bytes in 2^N before local checkpoint is started
179# 20 is the default value, where 4MB of writes need to be executed before a
180# Local Checkpoint (LCP) is performed. If you set to '21', it's 8MB of writes, etc.
181TIME_BETWEEN_LOCAL_CHECKPOINTS=20
182
183# Time between replication events
184TIME_BETWEEN_EPOCHS=100
185
186# Memory Usage Reports Entered into the cluster log every X/2 minutes
187MEMORY_REPORT_FREQUENCY=10
188
189# Backup reports entered into cluster log every X/2 minutes
190BACKUP_REPORT_FREQUENCY=5
191
192# Prevents cluster db from being swapped to disk
193LOCK_PAGES_IN_MAIN_MEMORY=1
194
195# Name of clusterlog file
196CLUSTER_LOG_FILENAME=cluster.log
197
198# Node-ID for the Management Server
199MGMD_ID=63
200
201########################################################
202# MySQL Server Default Configuration                   #
203########################################################
204
205# Default values for my.cnf configuration variables
206MYSQL_PID=
207DEFAULT_MGM_PORT=1186
208MGM_PORT=$DEFAULT_MGM_PORT
209MYSQL_PORT=3306
210MYSQL_SOCK=/tmp/mysql.sock
211SKIP_INNODB= #"skip-plugin-innodb"
212MYSQL_HOST="127.0.0.1"  #localhost
213REPLICATION_MASTER=
214BINARY_LOG=
215SERVER_ID=
216
217
218########################################################
219# ndbinstaller.sh SCRIPT PARAMETERS                    #
220########################################################
221
222FORCE_GENERATE_SSH_KEY=0
223PARAM_NUM_NODES=
224PARAM_CONFIG_DEFAULT=0
225PARAM_NODEID=
226PARAM_USERNAME=0
227NDBD_PARAM_NO=0
228MGM_HOST_NOT_SET=1
229MGM_PORT_NOT_SET=1
230PARAM_DEFAULT_INSTALL_NDB_DIR=0
231PARAM_DEFAULT_INSTALL_MYSQL_DIR=0
232PARAM_DEFAULT_MYSQL_SETTINGS=0
233
234########################################################
235# Script Internal Configuration Params                 #
236########################################################
237
238LOCALHOST="localhost" #127.0.0.1
239
240
241# Default values for user install actions
242SYSTEM_INSTALL=1
243SYMBOLIC_LINK=1
244INSTALL_DB=1
245GET_BINARIES=1
246UNTAR=1
247DEBUG=0
248INITIAL=0
249USERNAME=mysql
250HOMEDIR=
251INSTALL_BINARIES=1
252REMOVE_EXPANDED_BINARIES_AFTER_INSTALL=0
253START_WITH_SSH=0
254ADD_MYSQLD=0
255
256# failure codes returned by script
257SUCCESS=0
258FAILURE=-1
259DIR_NOT_FOUND=-2
260CONFIG_ERROR=-3
261COULD_NOT_START_NDBS=-4
262EXIT_SIGNAL_CAUGHT=-5
263COULD_NOT_CREATE_USER=-6
264COULD_NOT_CHANGE_PASSWD=-7
265
266SCRIPTNAME=`basename $0`
267
268# Default values for the generated startup scripts
269NO_DAEMON=
270NO_DAEMON_LAUNCH=
271
272# Script names
273INIT_START=init-start-cluster
274NORMAL_START=start-noinit-cluster
275CLUSTER_START=node.sh
276NDBD_INIT=init-start-ndbd
277NDBD_START=start-noinit-ndbd
278CLUSTER_SHUTDOWN=shutdown-cluster.sh
279MGM_CLIENT_START=mgm-client.sh
280ROLLING_RESTART=rolling-restart
281MGMD_START=mgm-server-start
282START_BACKUP=start-backup.sh
283NDB_RESTORE=ndb-restore.sh
284ENTER_SINGLE_USER_MODE=enter-singleuser-mode.sh
285EXIT_SINGLE_USER_MODE=exit-singleuser-mode.sh
286MEMORY_USAGE_SCRIPT=memory-usage.sh
287
288# Temporary Scripts for Patching
289MYSQLSTART_TMP="/tmp/mysql-start.sh"
290MYSQL_SHUTDOWN_TMP="/tmp/mysql-shutdown.sh"
291
292# Default values for cluster startup from script
293MGM_STARTUP_TIME=15
294NDB_WAIT=40 # 20 seconds =4 minutes to wait for NDBDs to be started
295NDB_START_WAIT=60 # 1 minute max
296NUM_NODES_TO_START=2
297NUM_MYSQLS=0
298NUM_MYSQL_BINS=0
299# Num seconds to wait when testing to see if a cluster is already running
300WAIT_CLUSTER_ALREADY_RUNNING=2
301# Time to wait for a NDBD to restart during a rolling restart
302NDBD_RESTART_TIMEOUT=300
303
304# User Installation Options Variables
305NUM_NODES=4
306INSTALL_LOG="cluster_"installation-${MYSQL_VERSION_MAJOR}.${MYSQL_VERSION_MINOR}.${MYSQL_VERSION_REV}".log"
307
308# Used by 'wget' to download binaries
309HTTP_PROXY=
310HTTP_USER=
311HTTP_PASS=
312PROXY=
313
314# Script-Internal Installation Variables
315NDB_NUM=
316FINISHED_INSTALLDIRS=0
317MOVE_BINARIES=0
318START_SCRIPTS=
319NDB_HOME=
320MYSQL_DATA_DIR=
321CHANGE_PORT_SCRIPT=
322CHANGE_SOCKET_SCRIPT=
323INSTALL_AS_DAEMON_HELP=
324MYSQL_INSTALLED=
325MYSQL_BINARIES_INSTALLED=
326MYSQLD_STARTER=
327MYSQLD_STOPPER=
328LINUX_DISTRIBTUION=
329
330# Install action options
331#INSTALL_COMPILE=0
332INSTALL_LOCALHOST=1
333INSTALL_MGM=2
334INSTALL_NDB=3
335INSTALL_MYSQLD=4
336INSTALL_ANOTHER_MYSQLD_LOCALHOST=5
337INSTALL_LOCALHOST_MYSQLD=6
338INSTALL_ANOTHER_MYSQLD=7
339INSTALL_ACTION=
340NODEID=
341
342###################################################################################################
343# Sanity check for the script's current PATH
344###################################################################################################
345
346# Get the PATH where this script is stored
347# If script ran as: ./$SCRIPT_NAME, then it's the working directory
348CWD=`dirname $0`
349if [ "$CWD" = "." ] ; then
350    CWD=`pwd`
351fi
352
353i=0
354i=$(($i+`echo "$CWD" | grep -c \ `))
355i=$(($i+`echo "$CWD" | grep -c \*`))
356i=$(($i+`echo "$CWD" | grep -c \\\\\\\\`))
357i=$(($i+`echo "$CWD" | grep -c \"`))
358i=$(($i+`echo "$CWD" | grep -c \'`))
359i=$(($i+`echo "$CWD" | grep -c \\\``))
360if [ $i -ne 0 ];
361then
362  echo "Path to current working directory contains critical characters"
363  echo "like an asterisk, backslash, quotes or spaces. Since some system"
364  echo "tools will not cope with such characters this script will abort now."
365  echo "Unable to determine XFree86 Version. Stopping now." 
366  echo ""
367  exit 1
368fi
369
370####################################################################################################
371# HELP STRINGS
372####################################################################################################
373
374README="
375README for MySQL Cluster installed using ndbinstaller.\n
376\n
377NDBINSTALLER SCRIPTS\n
378Bash shell scripts for starting, stopping, accessing and administering\n
379your MySQL Cluster are located in:\n
380./ndb/scripts\n
381\n
382Please read all of this README before starting/stopping your cluster,\n
383as there are different scripts for the first startup of cluster,\n
384and subsequent startups. Use the --help switch to find out more\n
385information about the different scripts.\n
386\n
387\n
3881.\n
389move to the scripts directory:\n
390cd ndb/scripts\n
391\n
3921. FIRST TIME START OF MYSQL CLUSTER \n
393To start a 2-node cluster for the first time:\n
394./init-start-cluster-2node.sh\n
395\n
396If instead, you want to start a 4-node cluster (for the first time) use:\n
397./init-start-cluster-4node.sh\n
398\n
399These scripts perform an \"initial start\", where the contents of the\n
400database are deleted. Be care not to call these scripts if you\n
401have important data stored in the database.\n
402\n
4032. USE MGM CLIENT TO SEE IF CLUSTER IS WORKING PROPERLY\n
404./mgm-client.sh -e show\n
405\n
406This should show you the following (2 ndbd nodes running, 1 mgmd running,\n
407and a MySQL server connected to the cluster):\n
408Connected to Management Server at: localhost:1186\n
409Cluster Configuration\n
410---------------------\n
411[ndbd(NDB)]     2 node(s)\n
412id=1    @127.0.0.1  (mysql-5.1.24 ndb-6.3.16, Nodegroup: 0, Master)\n
413id=2    @127.0.0.1  (mysql-5.1.24 ndb-6.3.16, Nodegroup: 0)\n
414\n
415[ndb_mgmd(MGM)] 1 node(s)\n
416id=63   @127.0.0.1  (mysql-5.1.24 ndb-6.3.16)\n
417\n
418[mysqld(API)]   9 node(s)\n
419id=3    @127.0.0.1  (mysql-5.1.24 ndb-6.3.16)\n
420\n
421If this step failed, there was a problem starting your cluster.\n
422\n
423\n
4243. CREATE A TABLE USING THE MYSQL CLIENT \n
425./mysql-client-1.sh test\n
426\n
427mysql> create table test_ndb (id int) engine=ndbcluster;\n
428\n
429mysql> insert into test_ndb values (1),(2);\n
430\n
431mysql> show create table test_ndb\G\n
432*************************** 1. row ***************************\n
433       Table: test_ndb\n
434Create Table: CREATE TABLE test_ndb (\n
435  id int(11) DEFAULT NULL\n
436) ENGINE=ndbcluster DEFAULT CHARSET=latin1\n
4371 row in set (0.00 sec)\n
438\n
439# The above showed that we successfully created a ndb table \n
440\n
4414. SHUTTING DOWN MYSQL CLUSTER\n
442./shutdown-cluster.sh\n
443\n
444This stops the ndbd nodes, the ndb_mgmd node and the mysqld node.\n
445You can skip stopping the mysqld node using a switch.\n
446\n
4475. SUBSEQUENT STARTS OF MYSQL CLUSTER (after 1st time)\n
448Non-first-time start of a 2-node cluster is performed using:\n
449./start-noinit-cluster-2node.sh\n
450\n
451This script performs a \"normal start\", where the contents of the\n
452database are not deleted. \n
453 \n
454---------------------\n
455AUTHOR Jim Dowling      \n
456Date: Sept 1, 2008\n
457"
458
459USE_BINARIES_HELP="
460Use Existing Binaries Help\n
461===========================================================================
462\n
463You can use the existing MySQL binaries that are installed on this machine\n
464to run a Data Node, Management Server or MySQL Server.\n
465Data Nodes and MySQL Servers will install their own data directory,  under\n
466the \$NDB_HOME directory. So each Data Node or MySQL Server has its own\n
467data directory, but Data Nodes and MySQL Servers can share the same copy of\n
468the MySQL binaries.\n
469\n
470Use the existing binaries for this installation?"
471
472CPU_HELP="
473Which CPU Version Help\n
474===========================================================================
475\n
476To find out the CPU type of this machine, type 'less /proc/cpuinfo'.\n
477Data nodes and management servers must have the same type of CPU architecture.\n
478So, you cannot mix x86 and powerpc nodes in a cluster.\n
479It is not recommended to mix 32-bit and 64-bit data nodes in the same cluster.\n
480Requirements: this installer expects that you have libc version 2.3 installed."
481
482
483
484get_install_option_help()
485{
486  if [ $ROOTUSER -eq 1 ] ; then
487    INSTALL_AS_DAEMON_HELP="You are installing cluster as root user. The ndb_mgmd and\n ndbd processes will start as daemon processes."
488  else
489    INSTALL_AS_DAEMON_HELP="You are installing cluster as normal (non-root) user. The ndb_mgmd and\n ndbd processes will start as user-level processes in '--no-daemon' mode."
490  fi
491
492INSTALL_OPTION_HELP="
493Install Options Help\n
494===========================================================================\n
495A MySQL Cluster consists of up to 63 nodes:  1 or more Management Server, \n
496(ndb_mgmd),  Data Nodes (ndbd), and Clients (MySQL Servers and/or NDBAPI apps).\n
497$INSTALL_AS_DAEMON_HELP\n
498\n
499(1) Setup and start a localhost cluster. The cluster will run on this machine. \n
500    \t1 ndb_mgmd, 2/4 ndbds, and 1 mysqld will be configured.\n
501    \tScripts will generated that allow you to stop/start the cluster.\n
502    \tYou can start the cluster running at the end of the installation.\n
503(2) Add a MySQL Server ('mysqld') to an installed localhost cluster.\n
504    \tRequirement: You have run installation step (1).\n
505(3) Setup a distributed cluster. Installs a Management Server on the current\n
506    \thost. This is the first step in installing a distributed cluster.\n
507(4) Add a data node (the 'ndbd' process) to a distributed cluster.\n
508    \tRequirement: You have run installation step (3) on this or  another host.\n
509    \tRequirement: You know the 'connectstring' for the Management Server.\n
510(5) Add a MySQL Server ('mysqld') to an installed distributed cluster.\n
511    \tRequirement: You have run installation step (3).\n
512    \tRequirement: You know the 'connectstring' for the Management Server."
513
514}
515
516
517#    \tYou will optionally be asked to install a MySQL Server.\n
518#     \tData nodes store data in the Network Database (NDB).\n
519REPLICA_HELP="
520Number of Replicas Help\n
521===========================================================================
522\n
523A replica is a copy of a partition in the cluster.\n
524So, '2' replicas means '2' copies of the partition are stored in the cluster\n
525(not 2 extra copies of an existing copy).\n
526\n
527The number of Replicas is currently 2. Accept?"
528
529
530NODEID_HELP="The NodeID is a number that is assigned to a [NDBD] entry in the \$NDB_HOME/config-<NoOfNodes>Node.ini file. \n
531Select the NodeID that matches the HostName on which you are trying to start the ndbd."
532
533USERNAME_HELP="
534UID (user id) for Running MySQL Cluster Help\n
535===========================================================================
536\n
537The MySQL and NDB processes will be started and run with this user ID (uid). \n
538\n
539The default username that processes will be run as is '$USERNAME'.\n
540Accept?"
541
542DATA_MEMORY_HELP="
543DataMemory Help\n
544===========================================================================
545\n
546Reference:\n
547\n
548http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-ndbd-definition.html \n
549You need enough free RAM to store Data Memory, Index Memory for all replicas.\n
550Leave spare RAM (overhead) for other operating system processes.\n
551\n
552For example: \n
553On a host with 2GB of RAM, as part of a 2-node cluster with 2 Replicas:\n
554Data Memory could be 750MB, Index Memory could be 150MB.\n
555This would leave 200MB overhead for Operating System and other processes.\n
556\n
557Note: if you want to do an online alter table, after entering single-user mode,\n
558you will need enough spare memory to make a copy of your table in memory.\n
559\n
560Size of Data Memory for NDB nodes is 80MB.\n
561Accept?"
562
563index_memory_help_setup()
564{
565
566INDEX_MEMORY_HELP="
567IndexMemory Help\n
568===========================================================================
569\n
570Reference:\n
571http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-ndbd-definition.html\n
572\n
573You need enough free RAM to store Data Memory, Index Memory for all replicas.\n
574Leave spare RAM (overhead) for other operating system processes.\n
575\n
576For example:\n
577On a host with 2GB of RAM, as part of a 2-node cluster with 2 Replicas:\n
578Data Memory could be 750MB, Index Memory could be 150MB.\n
579This would leave 200MB overhead for Operating System and other processes.\n
580\n
581Note: if you want to do an online alter table, after entering single-user mode,\n
582you will need enough spare memory to make a copy of your table in memory.\n
583\n
584Size of Index Memory for NDB nodes is $INDEX_MEMORY MB.\n
585Accept?"
586}
587
588num_fragment_logfiles_help_setup()
589{
590NUM_FRAGMENT_LOGFILES_HELP="
591NoOfFragmentLogFiles Help\n
592===========================================================================
593\n
594References:\n
595http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-ndbd-definition.html\n
596http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-config-lcp-params.html\n
597\n
598The Redo Log is used when a node crashes to recover most its data.\n
599The size of the Redo Log is configured by changing the 'NoOfFragmentLogFiles'. \n
600The Redo Log is allocated in chunks of 64MB Fragment Log Files on local disk.\n
601The default value for NoOfFragmentLogFiles is '8'.\n
602This means 8 sets of four 16MB files (i.e., 8*64MB) for a total of 512MB. \n
603That is, you need to have 512MB of free disk space.\n
604If you have very high update rates (lots of writes/updates), you may need\n
605to set NoFragmentLogFiles substantially higher, e.g., up to a value of 300.\n
606\n
607The NumberOfFragmentLogFiles is $NUM_FRAGMENT_LOGFILES (64*$NUM_FRAGMENT_LOGFILES = $REDO_LOG_SIZE MB)\n
608Accept?"
609}
610
611DISK_CHECKPOINT_SPEED_HELP="
612DiskCheckpointSpeed Help\n
613===========================================================================
614\n
615References:\n
616http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-ndbd-definition.html\n
617http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-ndbd-definition.html\n
618\n
619The amount of data,in bytes per second, that is sent to disk during a \n
620local checkpoint.\n
621You can check how fast your hard disk can write to disk by checking the\n
622manufacturer's specification for you hard disk or by using a program\n
623such as Bonnie++. For debian/ubutunu:\n
624>apt-get install bonnie++       >bonnie++\n
625\n
626In any case, the algorithms for writing the local checkpoint will adapt\n
627the speed of writing to load on the cluster.\n
628\n
629The default value is 10M (10 megabytes per second).\n
630Accept?"
631
632
633DISK_CHECKPOINT_SPEED_IN_RESTART_HELP="
634DiskCheckpointSpeedInRestart Help\n
635===========================================================================
636\n
637References:\n
638http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-ndbd-definition.html\n
639http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-ndbd-definition.html\n
640\n
641
642The amount of data, in bytes per second, that is sent to disk during a \n
643local checkpoint that is performed when a node restarts.\n
644\n
645You can check how fast your hard disk can write to disk by checking the\n
646manufacturer's specification for you hard disk or by using a program\n
647such as Bonnie++. For debian/ubutunu: >apt-get install bonnie++\n
648\n
649In any case, the algorithms for writing the local checkpoint will adapt\n
650the speed of writing to load on the cluster.\n
651\n
652The default value is ${DISK_CHECKPOINT_SPEED_IN_RESTART}M (${DISK_CHECKPOINT_SPEED_IN_RESTART} megabytes per second).\n
653Accept?"
654
655
656DISK_SYNC_SIZE_HELP="
657DiskSyncSize Help\n
658===========================================================================
659\n
660References:\n
661http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-ndbd-definition.html\n
662http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-ndbd-definition.html\n
663\n
664This is the maximum number of bytes to store in the Redo Buffer before\n
665flushing the buffer to a local checkpoint file.\n
666\n
667If your hard disk is a bottleneck, then increasing the size of this parameter\n
668may help throughput when writing to disk.\n
669However, in the event of a node crash, the transactions in the Redo Buffer\n
670that were not written to disk will be lost (although they will be available in\n
671replica nodes).\n
672\n
673The default value is 4M (4 megabytes).\n
674Accept?"
675
676REDO_BUFFER_HELP="
677RedoBuffer Help\n
678===========================================================================
679\n
680References:\n
681http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-ndbd-definition.html\n
682http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-ndbd-definition.html\n
683\n
684If you have a write-intensive database or a slow disk subsystem, it is\n
685recommended that you increase the size of the redo buffer from the default\n
686value of 8Mb to 16Mb.\n
687\n
688The RedoBuffer sets the size of the buffer in which the REDO log is written.\n
689This buffer is used as a front end to the file system when writing REDO log\n
690records to disk. If this buffer is too small, the NDB storage engine issues\n
691error code 1221 (REDO log buffers overloaded).\n
692\n
693The default value is 8M (8 megabytes).\n
694Accept?"
695
696
697
698DELETE_DIR_HELP="
699\nAbove Directory already exists.\n
700\n
701You have already installed the NDB files or MySQL Binaries in this directory.\n
702\n
703If you have already installed a Mmgmt Server, and you want to install a\n
704Data Node, you can install it in this directory - do not delete it.\n
705\n
706Otherwise, do not delete this directory if you have important data here. \n
707For example, if you have already installed a Management Server,\n
708and have stored important data in it, this step may\n
709cause you to lose that data.\n
710If you delete this directory, you will do a clean install.\n
711\n
712Delete this directory?\n
713$FULL_DIR"
714
715MYSQL_PORT_HELP="
716MySQL Port Help\n
717===========================================================================\n
718A port can be used to connect to a MySQL server.\n
719\n
720For example:\n
721mysql --protocol=tcp --port=3306 -u root -p\n
722\n
723The port number for the mysqld is set to default (port $MYSQL_PORT).\n
724Accept?"
725
726MYSQL_SOCKET_HELP="
727MySQL Socket Help\n
728===========================================================================\n
729The socket can be used to connect to a MySQL server.\n
730For example:\n
731mysql -S /tmp/mysql.sock -u root -p\n
732\n
733The default location for the MySQL socket is:\n
734$MYSQL_SOCK\n
735Accept?"
736
737BINARY_LOG_HELP="
738MySQL Binary Log Help\n
739===========================================================================\n
740A binary log of updates to this MySQL server is required to support\n
741replication from this server. This server will be a Replication Master.\n
742\n
743The binary log will be stored in the MySQL server's data directory and will\n
744consume an increasing amount of disk space over time. You will need to\n
745write/download a script to rotate the binary logs to prevent them growing\n
746over time.\n
747\n
748\n
749Should binary logging be enabled for this MySQL Server?\n
750Accept?"
751
752
753SSH_HELP="
754SSH Help\n
755===========================================================================\n
756Requirements: \n
757These programs must installed on all hosts:\n
758ssh-keygen, scp, ssh.\n
759\n
760Generating a ssh-key makes it easier to initialise or start the cluster.\n
761Instead of having to logon to all hosts in the cluster and run the init or\n
762start scripts for all Data Nodes and Management Servers in the cluster, you\n
763will only need to run a single init or start script from the Management Server\n
764Host.\n
765\n
766A ssh-key is used to run a program on a remote host under a specified\n
767username. The ssh-key is used to allow you run a single script on the\n
768management server to initialise or start the management server (on the same\n
769host), and all the Data Nodes (on remote hosts) in the cluster. To start the\n
770Data Nodes, the single startup script calls the data node startup scripts on\n
771the remote hosts using ssh. The single scripts require that the ssh-key for\n
772the management server is installed on the Data Nodes.\n
773\n
774Do you want to generate a ssh-key?"
775
776AUTHORIZED_KEYS_HELP="
777SSH Authorized Keys Help\n
778===========================================================================\n
779An authorized_keys file should have been installed on the management server host under\n
780a user account. Normally, it is stored in the path:\n
781/home/\$USERNAME/.ssh/authorized_keys\n
782The authorized_keys file ensures that the \$USERNAME on the management\n
783can call scripts that start Data Nodes on remote hosts.\n
784\n
785Is /home/\$USERNAME/.ssh/authorized_keys the correct path for the authorized_keys file?"
786
787
788####################################################################################################
789# Replication Strings
790####################################################################################################
791
792
793binary_log_enable()
794{
795
796BINARY_LOG="log-bin=mysql-bin"
797
798# generate a server-id between 0 and 4,999 for the master
799# generate a server-id between 5,000 and 10,000 for the slave
800MASTER_ID=`expr $RANDOM % 5000`
801SLAVE_ID=`expr $RANDOM % 10000`
802SLAVE_ID=`expr $SLAVE_ID + 5000`
803SERVER_ID="server-id=$MASTER_ID"
804
805}
806
807replication_init()
808{
809#Create a slave account on the master (cluster) MySQL Server  with the appropriate privileges
810# ${MYSQL_HOST}
811# ${MGM_HOST}
812# run this on the master
813REPLICATION_MASTER=
814"log-bin=mysql-bin
815server-id=1111
816"
817REPLICATION_ACCOUNT_CREATE="
818GRANT REPLICATION SLAVE ON *.* TO '$USERID'@'$MYSQL_MASTER' IDENTIFIED BY '$PASSWORD';"
819
820# Write a warning that the my.cnf file is written in cleartext to a file in the MySQL Server's data directory
821REPLICATION_SLAVE="
822server-id=2222
823
824master-host=$MYSQL_MASTER
825master-port=3306
826master-user=$USERID
827master-password=$PASSWORD
828"
829}
830
831####################################################################################################
832# Test for user-id (if root) for generated cluster startup scripts
833####################################################################################################
834
835#TODO: make this a shell script in util dir
836test_userid()
837{
838TEST_USERID="
839USERID=\`id | sed -e 's/).*//; s/^.*(//;'\`
840if [ \"X\$USERID\" != \"X$USERNAME\" ]; then
841 if [ \"X\$USERID\" = \"Xroot\" ]; then
842   echo \"\"
843   echo \"You started cluster as user: 'root'.\"
844   echo \"You should start cluster as user: '$USERNAME'.\"
845   echo \"If you continue, you will change ownership of database files\"
846   echo \"from '$USERNAME' to 'root'.\"
847# TODO: return -2
848 else
849   echo \"\"
850   echo \"You started the cluster as user: '\$USERID'.\"
851   echo \"You should start the cluster as user: '$USERNAME'.\"
852   echo \"If you continue, you will change ownership of database files\"
853   echo \"from '$USERNAME' to '\$USERID'.\"
854# TODO: return -2
855 fi
856 
857 echo \"\"
858start_as_wrong_user()
859{
860  echo -n \"Do you really want to start the cluster as user '$USERID'? y/n/h(help) \"
861  read ACCEPT
862  case \$ACCEPT in
863   y | Y)
864      ;;
865   n | N)
866      echo \"\"
867      echo \"Bye..\"
868      echo \"\"
869      exit 1
870      ;;
871    *)
872      echo \"\"
873      echo -n \"Please enter 'y' or 'n'.\"
874      start_as_wrong_user
875      ;;
876   esac
877}
878start_as_wrong_user
879
880
881fi"
882}
883
884already_running()
885{
886ALREADY_RUNNING_CLUSTER="
887  echo \"\"
888  echo \"Testing to see if a cluster is already running on host '$CONNECTSTRING' ...\"
889  echo \"\"
890  ${MYSQL_BINARIES_DIR}/bin/ndb_mgm -c $CONNECTSTRING -t $WAIT_CLUSTER_ALREADY_RUNNING -e show 1> /dev/null
891
892  if [ \$? -eq 0 ] ; then
893      echo \"\"     
894      echo \"A management server is already running on $CONNECTSTRING\"
895      echo \"\"         
896      exit 2
897  fi
898"
899}
900
901
902get_connectstring_skip_mysqlds()
903{
904
905GET_CONNECTSTRING_SKIP_MYSQLDS="
906MGM_CONN=$CONNECTSTRING
907SKIP_MYSQLDS=0
908
909while [ \$# -gt 0 ]; do
910  case \"\$1\" in
911    -h|--help)
912              echo \"usage: <prog> [ -c | --connectstring MGMD_HOST:MGMD_PORT ] [ -s|--skip-mysqlds ]\"
913              echo \"\"
914              echo \"connectstring is set to $CONNECTSTRING\"
915              exit 0
916              ;;
917    -c|--connectstring)
918              shift
919              MGM_CONN=\$1
920              break
921              ;;
922    -s|--skip-mysqlds)
923              SKIP_MYSQLDS=1
924              ;;
925           * )
926              echo \"Unknown option '\$1'\"
927              exit -1
928  esac
929  shift       
930done
931"
932}
933
934get_connectstring()
935{
936
937GET_CONNECTSTRING="
938MGM_CONN=$CONNECTSTRING
939while [ \$# -gt 0 ]; do
940  case \"\$1\" in
941    -h|--help)
942              echo \"usage: <prog> [ -c | --connectstring MGMD_HOST:MGMD_PORT ] \"
943              echo \"\"
944              echo \"connectstring is set to $CONNECTSTRING\"
945              exit 0
946              ;;
947    -c|--connectstring)
948              shift
949              MGM_CONN=\$1
950              break
951              ;;
952           * )
953              echo \"Unknown option '\$1'\"
954              exit -1
955  esac
956  shift       
957done
958"
959}
960
961get_mgm_client_connectstring()
962{
963
964MGM_CLIENT_CONNECTSTRING="
965MGM_CONN=$CONNECTSTRING
966PARAMS=
967EXEC=
968while [ \$# -gt 0 ]; do
969  case \"\$1\" in
970    -h|--help)
971              echo \"usage: <prog> [ -c | --connectstring MGMD_HOST:MGMD_PORT ] ] [ -e [command] ] \"
972              echo \"\"
973              echo \"Default connectstring parameter = $CONNECTSTRING\"
974              echo \"\"
975              echo \"To view the state of the cluster (which nodes are connected), type:\"
976              echo \"./mgm-client.sh -e show\"
977              echo \"\"
978              exit 0
979              ;;
980    -e)
981              shift
982              EXEC=\"-e\"
983              while [ \$# -gt 0 ]; do
984                  PARAMS=\"\$PARAMS \$1\"
985                  shift
986              done
987              break
988              ;;
989    -c|--connectstring)
990              shift
991              MGM_CONN=\$1
992              break
993              ;;
994           * )
995              echo \"Unknown option '\$1'\"
996              exit -1
997  esac
998  shift       
999done
1000"
1001}
1002
1003
1004###################################################################################################
1005# INTERRUPT HANDLER FUNCTIONS
1006###################################################################################################
1007
1008# called by TrapBreak if interrupt signal is handled
1009CleanUpTempFiles()
1010{
1011
1012case $INSTALL_ACTION in
1013 $INSTALL_MYSQLD|$INSTALL_ANOTHER_MYSQLD_LOCALHOST|$INSTALL_LOCALHOST_MYSQLD|$INSTALL_ANOTHER_MYSQLD)
1014    if [ -d $MYSQL_DATA_DIR ] ; then
1015        echo ""
1016        echo "Cleaning up...."
1017        echo "Removing the mysql data directory:"
1018        echo "$MYSQL_INSTALL_DIR"
1019        echo ""
1020        # The install directory is the parent directory that needs to be removed
1021        rm -rf ${MYSQL_INSTALL_DIR}
1022    fi
1023  ;;
1024esac
1025echo ""
1026
1027test -e $MYSQLSTART_TMP && rm -rf $MYSQLSTART_TMP
1028test -e $MYSQL_SHUTDOWN_TMP && rm -rf $MYSQL_SHUTDOWN_TMP
1029
1030}
1031
1032# called if interrupt signal is handled
1033TrapBreak()
1034{
1035  trap "" HUP INT TERM
1036  # if ndbd or ndb_mgmd or mysqld are still running, kill them
1037#  [ -n "$MYSQL_PID" ] && kill -TERM "$MYSQL_PID" 2>/dev/null
1038#  [ -n "$pid" ] && killall "ndbd" 2>/dev/null
1039 
1040  echo -e "\n\nInstallation cancelled by user!"
1041  exit_error $EXIT_SIGNAL_CAUGHT
1042}
1043
1044
1045###################################################################################################
1046# USER INPUT HANDLER FUNCTIONS
1047###################################################################################################
1048
1049# Takes help strings as parameter
1050# $1 = "Is this
1051entry_ok()
1052{
1053  echo -n " y/n/h(help) "
1054  read ACCEPT
1055  case $ACCEPT in
1056   y | Y | yes | Yes | YES)
1057      return 1
1058      ;;
1059   n | N | no | No | NO)
1060      return 0
1061      ;;
1062   h | H | help | Help | HELP)
1063     # add escaped new-line characters
1064      if [ $# -eq 0 ] ; then
1065        echo -e "\nThere is no help available for this installation step."
1066      else
1067        clear
1068        echo -en $@
1069      fi
1070      entry_ok $@
1071      return $?
1072      ;;
1073    *)
1074      echo -n "Please enter 'y', 'n', or 'h (help)'." $ECHO_OUT
1075      entry_ok $@
1076      ;;
1077   esac
1078
1079  return 1
1080}
1081 
1082# $1 = accept phrase (what to accept)
1083# caller reads $ENTERED_STRING global variable for result
1084enter_string()
1085{
1086     echo "$1" $ECHO_OUT
1087     read ENTERED_STRING
1088}
1089
1090###################################################################################################
1091# SCREEN CLEAR FUNCTIONS
1092###################################################################################################
1093
1094clear_screen()
1095{
1096 echo "" $ECHO_OUT
1097 echo "Press ENTER to continue" $ECHO_OUT
1098 read cont < /dev/tty
1099 clear
1100}
1101
1102clear_screen_no_skipline()
1103{
1104 echo "Press ENTER to continue" $ECHO_OUT
1105 read cont < /dev/tty
1106 clear
1107}
1108
1109###################################################################################################
1110# ERROR HANDLER FUNCTIONS
1111###################################################################################################
1112
1113# $1 = String describing error
1114mkdir_error()
1115{
1116 echo "" $ECHO_OUT
1117 echo "Failure: couldn't create the directory:" $ECHO_OUT
1118 echo "$1" $ECHO_OUT
1119 echo "This script does not perform recursive directory creation. " $ECHO_OUT
1120 echo "Do not use '~/' as a path, use the full path (e.g., /home/user/..). " $ECHO_OUT
1121 echo "Exiting...." $ECHO_OUT
1122 echo "" $ECHO_OUT
1123 exit_error
1124}
1125
1126# $1 = String describing error
1127exit_error()
1128{
1129  #CleanUpTempFiles
1130
1131  echo "" $ECHO_OUT
1132  echo "Error number: $1" $ECHO_OUT
1133  echo "Exiting $PRODUCT $VERSION installer." $ECHO_OUT
1134  echo "" $ECHO_OUT
1135  exit 1
1136}
1137
1138# fix format of dir string, if necessary
1139# $1=directory to be fixed
1140fix_dir () {
1141  FIXDIR="$1"
1142  FIRSTCHAR=`expr "$FIXDIR" : '\(.\).*'`
1143  if [ "$FIRSTCHAR" != '/' ]; then
1144    currentdir=`pwd`
1145    echo "$currentdir/$FIXDIR" $ECHO_OUT
1146  else
1147    echo "$1" $ECHO_OUT
1148  fi
1149}
1150
1151
1152#####################################################################################################
1153# INSTALLER FUNCTIONS
1154#####################################################################################################
1155
1156# download binaries from MySQL mirror site
1157download_binaries()
1158{
1159cd $CWD
1160
1161FINISHED=0
1162while [ $# -ne 0 ] && [ $FINISHED = 0 ]
1163do
1164   echo "" $ECHO_OUT
1165   echo "Trying to download the MySQL binaries from the mirror:" $ECHO_OUT
1166   echo "$1" $ECHO_OUT
1167   echo "" $ECHO_OUT
1168   echo "Executing (proxy = ${http_proxy}):" $ECHO_OUT
1169
1170
1171# mysql-5.1.24-ndb-6.3.16/mysql-5.1.24-ndb-6.3.16-telco.tar.gz
1172# ftp://ftp.mysql.com/pub/mysql/download/cluster_telco/mysql-5.1.24-ndb-6.3.16/mysql-5.1.24-ndb-6.3.16-telco.tar.gz
1173# -${TELCO}
1174
1175   BASE_VER="mysql-${MYSQL_VERSION_MAJOR}.${MYSQL_VERSION_MINOR}.${MYSQL_VERSION_REV}-ndb-${NDB_VERSION_MAJOR}.${NDB_VERSION_MINOR}.${NDB_VERSION_REV}"
1176
1177   echo "wget $PROXY $HTTP_USER $HTTP_PASS $MIRROR${BASE_VER}/${VERSION}.tar.gz" $ECHO_OUT
1178   wget $PROXY $HTTP_USER $HTTP_PASS ${MIRROR}/${BASE_VER}/$VERSION.tar.gz
1179
1180   # update version to the filename of the distro: mysql-5.1.24-ndb-6.3.16-telco
1181
1182   if [ $? -eq 0 ] ; then
1183       FINISHED=1
1184   else
1185     echo "" $ECHO_OUT
1186     echo "Could not download the MySQL binaries from the mirror $1" $ECHO_OUT
1187     echo "" $ECHO_OUT
1188     if [ $# -gt 1 ] ; then
1189       echo "Trying next mirror...." $ECHO_OUT
1190     fi
1191   fi
1192   shift
1193done
1194
1195if [ $FINISHED -eq 0 ] ; then
1196   echo "" $ECHO_OUT
1197   echo "Failure. Could not download the MySQL binaries from the following mirrors:" $ECHO_OUT
1198#   for i in ${MIRRORS[@]} ; do
1199#        echo "${i}"
1200#   done
1201   echo "" $ECHO_OUT
1202   echo "Try downloading the binaries using your Browser to: $CWD" $ECHO_OUT
1203   echo "Then re-run ./$SCRIPTNAME" $ECHO_OUT
1204   echo "" $ECHO_OUT
1205   echo "Exiting......." $ECHO_OUT
1206   exit_error
1207fi
1208
1209
1210#if [ "$INSTALL_ACTION" = "$INSTALL_COMPILE" ] ; then
1211     echo "" $ECHO_OUT
1212     echo "You now need to build the binaries from the sources just downloaded." $ECHO_OUT
1213     echo "" $ECHO_OUT
1214#fi
1215
1216
1217}
1218
1219#
1220# Generic function to create the installation directories (ndb, mysql) for root/normal-user
1221# Very hacked function - needs to know what you're installing ndb, mysql data, mysql binaries
1222#
1223# $1=$NDB_DIR or $MYSQL_BINARIES_DIR or $MYSQL_INSTALL_DIR
1224# $2=$NDB_INSTALL_DIR or $MYSQL_INSTALL_DIR or $MYSQL_DATA_DIR
1225# $3=informational text
1226# $4=$NDB_VERSION or $VERSION
1227# $5=Accept default directory
1228#
1229install_dir() {
1230
1231 FULL_DIR=$1
1232 INSTALL_DIR=$2
1233
1234FINISHED_INSTALLDIRS=0
1235while [ $FINISHED_INSTALLDIRS -eq 0 ] ; do
1236
1237 echo "" $ECHO_OUT
1238 echo "The name of the $3 directory must be:" $ECHO_OUT
1239 echo "$4" $ECHO_OUT
1240 echo "" $ECHO_OUT
1241 echo "We recommend installing this directory in the following path:" $ECHO_OUT
1242 echo "$FULL_DIR" $ECHO_OUT
1243
1244 if [ "$5" != "1" ] ; then
1245 echo -n "Do you agree to install in the above path?"
1246 entry_ok "The $3 files will be installed to directory:\n $FULL_DIR/$4\n\nIn a later step of this installation, you will be able to create a shorter directory name using a symbolic link to the $3 directory.\n\nDo you agree to install in the above path?\n"
1247
1248  if [ $? -eq 0 ] ; then
1249    echo "" $ECHO_OUT
1250    echo "Enter the complete installation path. Do not use ~/ in the path!" $ECHO_OUT
1251    echo "" $ECHO_OUT
1252    if [ $ROOTUSER -eq 1 ] ; then
1253      echo "E.g., '/usr/local' installs the distribution in" $ECHO_OUT
1254      echo "      '/usr/local/$VERSION'" $ECHO_OUT
1255    else
1256      echo "E.g., '/home/YOUR_USERNAME/.mysql' installs the distribution in" $ECHO_OUT
1257      echo "      '/home/YOUR_USERNAME/.mysqld/$VERSION'" $ECHO_OUT
1258    fi
1259    echo "" $ECHO_OUT
1260    printf 'Enter installation path: '
1261    read dir
1262    INSTALL_DIR=$dir
1263  fi
1264 fi
1265  if [ $ROOTUSER -eq 1 ] ; then
1266  # root users must enter a full pathname
1267      FULL_DIR=$INSTALL_DIR/$4
1268  else
1269  # fix the user-level dir if necessary
1270      FULL_DIR=`fix_dir "$INSTALL_DIR"`
1271      FULL_DIR=$FULL_DIR/$4
1272  fi
1273 
1274  # set return value using global variable
1275  WHICH_INSTALL=$4
1276  # compare version start string with "mysql"
1277  TO_UPDATE=${WHICH_INSTALL:0:5}
1278
1279  if [ "$TO_UPDATE" = "mysql" ] ; then
1280      MYSQL_INSTALL_DIR=$INSTALL_DIR
1281      MYSQL_BINARIES_DIR=$FULL_DIR
1282  fi
1283
1284  TO_UPDATE=${WHICH_INSTALL:0:3}
1285  if [ "$TO_UPDATE" = "ndb" ] ; then
1286          NDB_INSTALL_DIR=$INSTALL_DIR 
1287          NDB_DIR=$FULL_DIR
1288  fi
1289
1290  TO_UPDATE=${WHICH_INSTALL:0:6}
1291  if [ "$TO_UPDATE" = "var" ] ; then
1292     MYSQL_INSTALL_DIR=$INSTALL_DIR 
1293  fi
1294
1295
1296  # Now create directory if it doesn't exist
1297  # MYSQL_INSTALL_DIR is the parent of MYSQL_BINARIES_DIR
1298  if [ ! -d $INSTALL_DIR ] ; then
1299
1300      if [ "$5" != "1" ] ; then
1301       echo "" $ECHO_OUT
1302       echo "Directory : $INSTALL_DIR" $ECHO_OUT
1303       echo -n "Create this directory?" $ECHO_OUT
1304       entry_ok "Directory does not exist: \n $INSTALL_DIR \n It is recommended that you create it."
1305
1306       if [ $? -eq 1 ] ; then
1307            FINISHED_INSTALLDIRS=1
1308            mkdir $INSTALL_DIR
1309            if [ $? -ne 0 ] ; then
1310              mkdir_error $INSTALL_DIR
1311            fi
1312       else
1313            FINISHED_INSTALLDIRS=0
1314       fi
1315      else
1316            mkdir $INSTALL_DIR
1317            if [ $? -ne 0 ] ; then
1318              mkdir_error $INSTALL_DIR
1319            fi
1320            FINISHED_INSTALLDIRS=1
1321      fi
1322   else
1323            FINISHED_INSTALLDIRS=1
1324   fi
1325
1326   # FULLDIR IS THE CONVENTION NAME FOR THE INSTALL (mysql-version, ndb-version, data)
1327   if [ -d $FULL_DIR ] ; then
1328       echo "" $ECHO_OUT
1329       echo "WARNING: this install directory already exists:" $ECHO_OUT
1330       echo "$FULL_DIR" $ECHO_OUT
1331
1332       echo "" $ECHO_OUT