Skip to main content

Posts

Showing posts from 2012

MySQL Cluster Set Up

1) Management node 192.168.0.1 -Management (MGM) node MySQL-ndb-tools-5.1.11-0. glibc23.rpm MySQL-ndb-management-5.1.11-0. glibc23.rpm 192.168.0.2 - MySQL server (SQL) node  MySQL-server-5.1.11-0.glibc23. rpm MySQL-shared-5.1.11-0.glibc23. rpm MySQL-client-5.1.11-0.glibc23. rpm 192.168.0.3 - Data (NDBD) node "A"  MySQL-ndb-tools-5.1.11-0. glibc23.rpm MySQL-client-5.1.11-0.glibc23. rpm MySQL-ndb-storage-5.1.11-0. glibc23.rpm MySQL-server-5.1.11-0.glibc23. rpm ( Optional ) 192.168.0.4 - Data (NDBD) node "B"  MySQL-ndb-tools-5.1.11-0. glibc23.rpm MySQL-client-5.1.11-0.glibc23. rpm MySQL-ndb-storage-5.1.11-0. glibc23.rpm MySQL-server-5.1.11-0.glibc23. rpm( Optional ) Step by Step configuration: Each data node or SQL node requires a my.cnf file that provides two pieces of information: - A connect string to find the MGM node - A line which says the MySQL server on this host to run in NDB mode. The  my.cnf  file for data node (ndb) For each data node and S...

Monitoring MySQL performance

If monitoring MySQL performance by analyzing its status values Performance Monitoring of MySQL Server: Following are the command which we can use for session or server level performance for MySQL server. SHOW GLOBAL STATUS – shows global server status SHOW LOCAL STATUS  - This is used for session level server status Have to check following values to know how server works. Aborted_clients:   Usually no need to worry for this because many programs/application don’t close connection properly. Aborted_connects:  This means authentication failure, network timeout or any other error. If the value is high than its possible that someone tries to break the password or something. Com_XXX:  This can be used to check server load that which statements are running most on server. §   Temporary Objects Created_tmp_tables:  Temporary tables can often be avoided by query optimization. Created_tmp_disk_tables:  Not enough memory is allo...

MySQL Source Installation on linux

  1. Ensure that you’re logged in as root: [user@host]#   su - root 2. Switch to the directory containing the source tarball, and extract the files within it. (Note that you will need approximately 80 MB of free space for the source tree.) [root@host]#   cd /tmp [root@host]#   tar -xzvf mysql-4.0.9-gamma.tar.gz Remember to replace the file name in italics with the file name of your source tarball. 3. Move into the directory containing the source code, [root@host]#   cd mysql-4.0.9-gamma and take a look at the contents with   ls : [root@host]#   ls -l Take a look at the sidebar entitled “Up a Tree” for more information on what each directory contains. 4. Now, set variables for the compile process via the included configure script. (Note the use of the   --prefix   argument to configure, which sets the default installation path for the compiled binaries.) [ root@host]#   ./configure --prefix=/usr/local/mysql ...

MySQL Binary Installation On Linux Machine

############################## ############################## ############################## ### mysql-5.5.25-linux2.6-i686. tar.gz generic binary installation on redhat ############################## ############################## ############################## ### step 1) Downlaod the above package from  http://dev.mysql.com/ downloads/mysql/ step 2) # groupadd mysql     # useradd -r -g mysql mysql     # scp mysql-5.5.25-linux2.6-i686. tar.gz /usr/local         # cd /usr/local         # tar zxvf mysql-5.5.25-linux2.6-i686. tar.gz     # ln -s mysql-5.5.25-linux2.6-i686 mysql     # cd mysql     # chown -R mysql .     # chgrp -R mysql .     #  ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/ data      # chown -R root .  ...

MySQL Enterprise Monitoring Agent Installation

Mysql monitor is the nagios of Database. It is especially useful when you have a bunch of mysql DB servers to manage. http://www.mysql.com/products/enterprise/monitor.html Here are 8 steps to enable the monitoring agent on the DB server. It is assumed that the monitor server is already configured and active on a server (for e.g. 10.10.10.63) 1) sudo root 2) download agent 3) Change file permissions chmod +x mysqlmonitoragent-2.3.1.2044-linux-glibc2.3-x86-64bit-installer.bin 4) Run file [root@localhost]# ./mysqlmonitoragent-2.3.1.2044-linux-glibc2.3-x86-64bit-installer.bin 5) Start agent /etc/init.d/mysql-monitor-agent start 6) check status ps -ef | grep monitor 7) check log cat /opt/mysql/enterprise/agent/mysql-monitor-agent.log 8) create mysql user for e.g. mysql> grant all on *.* to 'agent'@'%' identified by 'agent'; _____ The following options must be selected very carefully or else monitor will not work as expected. Instal...

MySQL Resetting root password

If you have forgotten your root password, you will need to start mysql service with --skip-grant-tables mode and then run the following 2 commands to reset it to root / root@123 UPDATE mysql.user SET Password = password('root@123') WHERE Host = 'localhost' AND User = 'root'; REPLACE INTO mysql.user VALUES ('%','root','*A00C34073A26B40AB4307650BFB9309D6BFA6999', 'Y','Y','Y','Y','Y','Y','Y','Y', 'Y','Y','Y','Y','Y','Y','Y','Y', 'Y','Y','Y','Y','Y','Y','Y','Y', 'Y','Y','Y','Y','Y','','','','', 0,0,0,0,'',''); You may now remove the skip grant tables option and restart mysql service. I assume you are not using old-passwords option in my.cnf that makes it compa...

MySQL start new instance with new data-directory

Sometimes you need fresh mysql installation. You need to run script to create default mysql database and system tables. The script is called "mysql_install_db" and is either in the bin or in scripts directory of your mysql installation. Change the my.cnf to reflect new datadir and run mysql_install_db for it to create mysql database and system tables in the new datatir and then start mysqld_safe. /usr/bin/mysql_install_db --datadir=/mnt/mysql3310 

MySQL Master Slave Replication on Linux Environment

1) Check if the server-id variable is set in my.cnf on both master and slave. If the IP is 192.178.90.51 then the id can be server-id=1789051 # config on master server to start binary logs log-bin=/var/log/mysql/mysql-bin.log max_binlog_size=1024M expire_logs_days=40 2) Take backup of master server using the following command or set it in a cron: 50 13 * * * /usr/bin/mysqldump -uroot -pPassWord dbName --routines --single-transaction --master-data=2 > /backup/dumpmysqldaily/ACCNT`date +'%d-%b-%Y-%H-%M'`.sql 2> /backup/dumpmysqldaily/ACCNT_err.txt 3) Create a "slave_user" user for replication purpose on the slave. GRANT REPLICATION SLAVE ON *.* TO 'slave_user'@'%' IDENTIFIED BY 'slave_user'; 4) Copy the dump file from master to slave. Restore the dump on slave server mysql -uroot -pPassWord myDBname < /root/ACCNT07-Jan-2010-11-30.sql Do not forget to turn off binary/ slow/ general logs of slave server. The logging may...