9942 Code

Chapter 1

The config.ini file can be shown as follows:

[ndb_mgmd]

Id=1

HostName=10.0.0.5

DataDir=/var/lib/mysql-cluster

[ndbd default]

DataDir=/var/lib/mysql-cluster

NoOfReplicas=2

[ndbd]

id=3

HostName=10.0.0.1

[ndbd]

id=4

HostName=10.0.0.2

[mysqld]

id=11

HostName=10.2.0.3

[mysqld]

id=12

HostName=10.2.0.4

[mysqld]

id=13

[mysqld]

id=14

mysql-cluster data directory can be created as follows:

[root@node5 mysql-cluster]# mkdir -p /usr/local/mysql-cluster

To see the cluster structure use:

ndb_mgm> SHOW

To see the status of all nodes:

ndb_mgm> ALL STATUS

To start the SQL node:

[root@node1 ~]# service mysql start

To restart mysql:

[root@node1 ~]# service mysql restart

Chapter 2

To download the world.sql file in /tmp, use:

[root@node1 ~]# cd /tmp/

[root@node1 tmp]# wget http://downloads.mysql.com/docs/world.sql.gz

Uncompress the file using following command:

[root@node1 tmp]# gunzip world.sql.gz

Create database world to hold new tables:

mysql> CREATE DATABASE world;

Import the SQL file:

[root@node1 tmp]# mysql world < world.sql

To see the different tables inside the world database:

mysql> SHOW TABLES;

To convert tables to NDBCLUSTER, use:

mysql> ALTER table City ENGINE=NDB;

mysql> ALTER table Country ENGINE=NDB;

mysql> ALTER table CountryLanguage ENGINE=NDB;

To change the database engine on-the-fly, use:

[root@node1 tmp]# cat world.sql | sed -e 's/ENGINE=MyISAM/ENGINE=NDBCLUSTER/g' | mysql world;

To see the number of rows from City table:

mysql> SELECT COUNT(ID) from City;

To start a backup, use:

ndb_mgm> START BACKUP

To start the restore of storage node with Id 3:

[root@node1 BACKUP-1]# ndb_restore -m -b 1 -n 3 -r /tmp/BACKUP-1/

To import the backup to a new database world_new, use:

[root@node1 ~]# mysql world_new < /tmp/backup-world-2009-07-28_00\:14\:56.sql

Chapter 3

To confirm the disk usage on Linux, use the command df –h as follows:

[root@node1 mysql-cluster]# df -h

To fragment table, use:

mysql> optimize table City;

To create Nodegroup of different nodes:

ndb_mgm> CREATE NODEGROUP 4,5

To change master, use:

mysql> CHANGE MASTER TO MASTER_HOST='10.0.0.1', MASTER_USER='slave',

MASTER_PASSWORD='password', MASTER_LOG_FILE='node1-bin.000001', MASTER_

LOG_POS=318

To check the different databases:

[node in slave cluster] mysql> SHOW DATABASES;

To check that you have sufficient storage on your storage nodes using a command such

as df as follows:

[root@node1 ~]# df -h | grep mysql-cluster

To create a log file and undo file:

mysql> CREATE LOGFILE GROUP world_log ADD UNDOFILE 'world_undo.dat'

INITIAL_SIZE=200M ENGINE=NDBCLUSTER;

To create a TABLESPACE using the CREATE TABLESPACE SQL command (you can execute

this on any SQL node in the cluster):

mysql> CREATE TABLESPACE world_ts ADD DATAFILE 'world_data.dat' USE

LOGFILE GROUP world_log INITIAL_SIZE=500M ENGINE=NDBCLUSTER;

To view the logfiles, use the following query that shows the active logfiles and their parameters:

mysql> SELECT LOGFILE_GROUP_NAME, LOGFILE_GROUP_NUMBER, EXTRA FROM

INFORMATION_SCHEMA.FILES;

To view the data files, then execute the following query that shows you each data

fi le, its size, and its free capacity:

mysql> SELECT

-> FILE_NAME,

-> (TOTAL_EXTENTS * EXTENT_SIZE)/(1024*1024) AS 'Total MB',

-> (FREE_EXTENTS * EXTENT_SIZE)/(1024*1024) AS 'Free MB',

-> EXTRA

-> FROM

-> INFORMATION_SCHEMA.FILES;

To use Create logfile group command, add the UNDO_BUFFER_SIZE parameter to the command:

mysql> CREATE LOGFILE GROUP world_log UNDO_BUFFER_SIZE 200M ADD UNDOFILE

'world_undo.dat' INITIAL_SIZE=200M ENGINE=NDBCLUSTER;

To delete a tablespace, use the DROP TABLESPACE statement:

mysql> DROP TABLESPACE world_ts ENGINE=NDBCLUSTER;

To install a compiler, use:

[root@node1 ~]# yum install gcc

To install the DBD::mysql Perl module from CPAN as follows:

[root@node1 ~]# perl -MCPAN -e 'install DBD::mysql'

Chapter 4

To check the location of the error log, use:

mysql> SHOW VARIABLES LIKE 'log_error';

To translate the NDB error number to an english description use the POSIX error command, perror:

[root@node1 mysql-cluster]# perror --ndb 830

To check whether same ports are available locally as on remote hosts, use:

[root@node1 mysql-cluster]# nmap localhost

Chapter 5

To check which replication mode a MySQL server is running in, select the value of the

binlog_format system variable:

mysql> SHOW VARIABLES LIKE 'binlog_format';

To tell the slave where the master is, what user account to use in order to

log in, what logfile to start reading from, and what position to jump to, use CHANGE MASTER TO:

mysql> CHANGE MASTER TO master_host = '10.0.0.1', master_

user='replication', master_password='password', master_log_

file='node1.000003', master_log_pos=107;

To check the status of slave node:

mysql> SHOW SLAVE STATUS\G;

To check if you have space in a volume group, use the vgs command:

[root@node2 mysql]# vgs

To download MMM on all nodes, use:

[root@node4 ~]# mkdir mmm

[root@node4 ~]# cd mmm

[root@node4 mmm]# wget http://mysql-mmm.org/_media/:mmm2:mysql-mmm-

2.0.9.tar.gz

To start MMM agent on the node, use:

[root@node6 mysql-mmm-2.0.9]# service mysql-mmm-agent start

To configure MMM to start on boot, use:

[root@node6 mysql-mmm-2.0.9]# chkconfig mysql-mmm-agent on

To start the monitoring daemon, use:

[root@node4 ~]# service mysql-mmm-monitor start

To move the active writer role (on node6) to node5, using the

move_role command:

[root@node4 ~]# mmm_control move_role writer node5

Chapter 6

To install relevant Cluster Filesystem, use:

[root@node2 ~]# yum groupinstall clustering

To start the ntp service, use:

[root@node2 ~]# yum install ntp

[root@node2 ~]# chkconfig ntpd on

[root@node2 ~]# service ntpd start

To create a physical volume on the shared disk, /dev/sdb use:

[root@node1 ~]# pvcreate /dev/sdb

To create a volume group (clustervg) with the new physical

volume in it, use:

[root@node1 ~]# vgcreate clustervg /dev/sdb

To install luci, use:

[root@node6 cluster]# yum install luci

To install gfs utilities:

[root@node1 ~]# yum -y install gfs2-utils

To check the current space available in our volume groups:

[root@node1 ~]# vgs

Chapter 7

To install the DRBD user-space tools, the kernel module, and the MySQL server, use:

[root@node3 ~]# yum -y install drbd kmod-drbd mysql-server

To get the drbd overview information, use:

[root@node3 ~]# drbd-overview

To create a EXT3 Filesystem on first node, use:

[root@node3 ~]# mkfs.ext3 /dev/drbd0

To mount the new filesystem, use:

[root@node3 ~]# mount /dev/drbd0 /var/lib/mysql/

To check that the filesystem has mounted correctly and with the expected size, use:

[root@node3 ~]# df -h /var/lib/mysql

To install heartbeat on the nodes, use:

[root@node3 ~]# yum install heartbeat

Chapter 8:

To install the sysstat package, use:

[root@node1 etc]# yum -y install sysstat

To check the kernel parameters at the command line, use sysctl:

[root@node1 etc]# sysctl vm.swappiness

To confirm if a query is using a conditional pushdown or not, you can use a EXPLAIN SELECT

query,

mysql> EXPLAIN select * from titles where emp_no < 10010;

Appendix A:

Kickstart file given separately: kickstart.txt

Appendix B:

To install perl config ini files, use:

[root@node2 ~]# yum -y install perl-Config-IniFiles perl-TimeDate

To download mylvmbackup and extract the tar.gz file as follows:

[root@node2 ~]# cd /usr/src/

[root@node2 src]# wget http://lenzg.net/mylvmbackup/mylvmbackup-0.13.tar.gz

To test your back up, use:

[root@node1 ~]# mylvmbackup


Wyszukiwarka

Podobne podstrony:
ISM Code 97 2003
LSA Code
Diagnostic Trouble Code (DTC) D Nieznany
Generating CNC Code with Edgeca Nieznany
ISPS Code
Dress Code id 141853 Nieznany
Konwersja DXF do G Code
NORTH AMERICAN STRATIGRAPHIC CODE
BMW E6x Code List
Assembler Intel Code Table
ki power, korean bushido code and a martial arts technique potpourri unite in hwarangdo
code do siliver
2004 Code of Safe Practice for Solid Bulk?rgoesid 171
Pytania i odpowiedzi ? 5 ISM CODE Training
c wxSmith and Code Blocks build error Stack Overflow
G code
#05 ISM CODE

więcej podobnych podstron