I told you that would happen...

how to resize/expand a LVM partition on a GPT partition table in CentOS 6

Some dummy somewhere removed the 'resize' command from `parted`. But this old version didn't work with LVM partition types anyway. You need parted 3.2

# yum install device-mapper-devel readline-devel libuuid-devel
# mkdir /opt/parted
# cd /opt/parted
# wget "https://ftp.gnu.org/gnu/parted/parted-3.2.tar.xz"
# tar xJvf parted-3.2.tar.xz
# cd parted-3.2
# ./configure
# make
# ./parted/parted /dev/sda
GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Model: AMCC 9650SE-8LP DISK (scsi)
Disk /dev/sda: 10000GB

Installing MySQL 5.6 from rpm

Oracle has broken various aspects of installation of MySQL 5.6 via RPM.
See, among others, http://bugs.mysql.com/bug.php?id=72724

If you want to install with a non-default data directory (/db_data/mysql in this example), here are some steps you need to take:

1. set up your /etc/my.cnf with datadir setting, etc
2. install the RPM (yum install MySQL-server)
3. rm /usr/my.cnf (WTF???)
4. mv /var/lib/mysql/* /db_data/mysql/ (installer generally obeys datadir, but 'mysql_install_db' does not)
5. start mysql (service mysql start)
6. clear root password or set it to something else:
TEMPPW=$(foo=`cat /root/.mysql_secret`; echo ${foo##* });
mysql --connect-expired-password -p$TEMPPW -e "SET PASSWORD = '';"

continue as normal.

mysql grant subqueries

MySQL doesn't allow subqueries inside GRANT statements (only inside SELECT, INSERT, UPDATE, DELETE, SET, or DO). Here's a workaround using bash, when you want to grant based on a wildcard pattern in the schema name:

mysql -e "grant select on $(mysql -N -e "select distinct table_schema from information_schema.tables where table_schema like 'foo%';").* to user@host;"

Flowchart of InnoDB writes (logs, buffers)

I whipped this up originally to aid in explaining how Xtrabackup works, but I find useful for explaining replication as well. Feel free to complain at me if you find any inaccuracies or omissions :)

(edit: sorry I can't immediately figure out how to make the Drupal theme wider, and I'm too lazy to resize the image. Click on it for a full view.)

activate serial console on CentOS 6 (or RedHat EL 6)

How to activate the serial console in CentOS 6. Useful for logging into a virtual guest via 'virsh console'.


# ttyS0 - agetty

stop on runlevel [016]
start on runlevel [345]

instance ttyS0
pre-start exec /sbin/securetty ttyS0
exec /sbin/agetty /dev/ttyS0 115200 vt100-nav

then run
start ttyS0

MySQL: count tables by Schema and Storage Engine

select table_schema, engine, count(*) from information_schema.tables where table_schema not in ('mysql', 'information_schema', 'test') group by table_schema, engine;

| table_schema | engine | count(*) |
| gallery2     | InnoDB |       56 | 
| gallery2     | MyISAM |        2 | 
| foo          | NULL   |        1 | 
| foo          | InnoDB |        3 | 
| foo          | MyISAM |        1 | 

Installing CentOS 6 or RedHat EL 6 on a partition larger than 2.2T

CentOS/Redhat 6 support installing and booting using GPT partitions, which can be larger than 2 TB. Your BIOS must also support UEFI booting. For a new install on an unpartitioned drive, wait for Anaconda (the graphical installer) to start, then press ctrl+alt+F2 to get a shell prompt. Create a new partition table on the blank drive:

parted /dev/sda
> mklabel gpt
> quit

Press ctrl+alt+F6 to return to the installer, Anaconda should recognize the drive at its full size and let you partition as normal. Make sure you don't choose the option to wipe the entire drive, or you'll get an old DOS partition table. That's it!

rsync over ssh via an intermediate proxy host

rsync -av -e 'ssh -o "ProxyCommand ssh user@proxyhost exec nc %h %p 2>/dev/null"' /var/lib/mysql/* user@host:/var/lib/mysql/

MySQL hot backup, streamed via SSH

innobackupex --stream=tar ./ | ssh user@host "(cd /var/lib/mysql && tar -xif -)"

installing Glassfish on CentOS

Assuming Java is already installed and JAVA_HOME is set

cd /opt
wget http://download.java.net/glassfish/3.1/release/glassfish-3.1.zip
unzip -q glassfish-3.1.zip
groupadd glassfish
useradd -s /bin/bash -g glassfish glassfish
chown -R glassfish:glassfish /opt/glassfish3/


#! /bin/bash
# glassfish Start/Stop the glassfish application server
# chkconfig: 345 80 20
# description: GlassFish is an open source application server project \
#              led by Sun Microsystems for the Java EE platform
Syndicate content