Monthly Archives: August 2013

MySQL Can’t open file: ‘.//mysql_table.frm’ (errno: 24)

this error means that too many files are open for the given process. There is a read-only mysql variable called open_files_limit that will show how many open files are allowed by the mysql server.

SHOW VARIABLES LIKE 'open%'

A lot systems set this to something very low, like 1024. Unfortunately, the following will NOT work:

SET open_files_limit=100000

MySQL will respond with:

ERROR 1238 (HY000): Variable 'open_files_limit' is a read only variable

However, it is possible to make a change to /etc/my.cnf. This file may not exist, if not, just create it. Be sure it has the following contents:

[mysqld]
open_files_limit = 100000

Then, be sure to restart mysql:

sudo /etc/init.d/mysql restart

Now, SHOW VARIABLES LIKE 'open%' should show 100000. The number you use may be different.

Install Directadmin on Centos OS

directadmin pre-install:

yum install wget screen gcc gcc-c++ flex bison make bind bind-libs bind-utils openssl openssl-devel perl quota libaio libcom_err-devel libcurl-devel gd zlib-devel libcap-devel  bzip2 db4-devel cyrus-sasl-devel perl-ExtUtils-Embed autoconf automake libtool

run screen and install:

screen

wget http://www.directadmin.com/setup.sh && chmod 755 setup.sh

begin directadmin installation: ./setup.sh

 

SSH public/private keys

ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa):
Created directory ‘/root/.ssh’.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_dsa.
Your public key has been saved in /root/.ssh/id_dsa.pub.
The key fingerprint is:
43:c9:50:3d:3f:28:b5:c5:88:60:79:bb:35:f3:c7:35 [email protected]
The key’s randomart image is:
+–[ DSA 1024]—-+
| ++.o o |
| ..oo.= o |
| .+o * |
| .o * o E.|
| S+ + o ..|
| .. . o |
| . |
| |
| |
+—————–+

Now you can use ssh-copy-id to move your public key to remote server.

Ploop backups

Image-based backup

Assuming you have a running container identified by $CTID. The following needs to be done:

# Known snapshot ID
ID=$(uuidgen)
VE_PRIVATE=$(VEID=$CTID; source /etc/vz/vz.conf; source /etc/vz/conf/$CTID.conf; echo $VE_PRIVATE)

# Take a snapshot without suspending a CT and saving its config
vzctl snapshot $CTID --id $ID --skip-suspend --skip-config

# Perform a backup using your favorite backup tool
# (cp is just an example)
cp $VE_PRIVATE/root.hdd/* /backup/destination

# Delete (merge) the snapshot
vzctl snapshot-delete $CTID --id $ID

File-based backup

Assuming you have a running container identified by $CTID. The following needs to be done:

# Known snapshot ID
ID=$(uuidgen)

# Directory used to mount a snapshot
MNTDIR=./mnt
mkdir $MNTDIR

# Take a snapshot without suspending a CT and saving its config
vzctl snapshot $CTID --id $ID --skip-suspend --skip-config

# Mount the snapshot taken
vzctl snapshot-mount $CTID --id $ID --target $MNTDIR

# Perform a backup using your favorite backup tool
# (tar is just an example)
tar cf backup.tar.xz $MNTDIR

# Unmount the snapshot
vzctl snapshot-umount $CTID --id $ID

# Delete (merge) the snapshot
vzctl snapshot-delete $CTID --id $ID

OpenVZ ploop advantages

  • File system journal is not bottleneck anymore
  • Large-size image files I/O instead of lots of small-size files I/O on management operations
  • Disk space quota can be implemented based on virtual device sizes; no need for per-directory quotas
  • Number of inodes doesn’t have to be limited because this is not a shared resource anymore (each CT has its own file system)
  • Live backup is easy and consistent
  • Live migration is reliable and efficient
  • Different containers may use file systems of different types and properties

In addition:

  • Efficient container creation
  • [Potential] support for QCOW2 and other image formats
  • Support for different storage types

How to start?

In global VZ configuration file /etc/vz/vz.conf:

VE_LAYOUT=ploop 

 

WARNING: POSSIBLE DNS SPOOFING DETECTED!

If you see this error message or something like WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!  you should don’t worry if you know your server RSA key was really changed, like your server was re installed. What to do?

The RSA host key for linux4you.tk has changed,
and the key for the corresponding IP address 5.199.164.77
is unchanged. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.

ssh-keygen -R linux4you.tk