Install vzdump on Centos for OpenVZ

1. Download vzdump rpm package from

http://download.openvz.org/contrib/utils/vzdump/

wget http://download.openvz.org/contrib/utils/vzdump/vzdump-x.x.noarch.rpm

2. Download cstream rpm package from

ftp://ftp.pbone.net/mirror/ftp.freshrpms.net/pub/freshrpms/pub/dag/redhat/el5/en/

  • select i386 or x86_64 according to OS you installed
  • click to RPMS.dag folder

Example for 32bit OS

wget ftp://ftp.pbone.net/mirror/ftp.freshrpms.net/pub/freshrpms/pub/dag/redhat/el5/en/i386/RPMS.dag/cstream-2.7.4-3.el5.rf.i386.rpm

 

3. Download perl(LockFile::Simple) rpm package

wget http://dag.wieers.com/rpm/packages/perl-LockFile-Simple/perl-LockFile-Simple-0.206-1.el5.rf.noarch.rpm 4.

 

4. Install rpms

rpm -Uvh –force perl-LockFile-Simple-0.206-1.el5.rf.noarch.rpm

rpm -Uvh –force cstream-2.7.4-3.el5.rf.i386.rpm

rpm -Uvh –force vzdump-1.2-4.noarch.rpm

Note: We use -Uvh –force to update any installed package

 

5. Type

ln -s /usr/share/perl5/PVE/ /usr/lib/perl5/5.8.8/PVE

 

Source: http://www.dataquantum.com/en/kb.php?cat=6&action=article&id=27

Pretty print JSON

Source: http://www.php.net/manual/en/function.json-encode.php#80339 

How to Free up RAM Memory in Centos RHEL Redhat Linux

Writing to this will cause the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become free.

To free pagecache:

echo 1 > /proc/sys/vm/drop_caches

To free dentries and inodes:

echo 2 > /proc/sys/vm/drop_caches

To free pagecache, dentries and inodes:

echo 3 > /proc/sys/vm/drop_caches

As this is a non-destructive operation and dirty objects are not freeable, the user should run `sync’ first.

Sync Database Table

 

 

 

Reference:

http://stackoverflow.com/questions/1759236/synchronize-identical-tables-in-separate-databases-with-php

http://codeinthehole.com/writing/how-to-sync-a-mysql-table-between-two-remote-databases/

Cleaning Up Stale Transients

WordPress transients are very similar to DB options but they also support expiration times. The Transients API documentation states:

Our transient will die naturally of old age once $expiration seconds have passed since we last ran set_transient()

What you might not know if you haven’t explored the source code of the transients API is that transients stored in the database* will not actually “die of old age”. Instead, a stale transient will stick around until someone tries to access it. Only then will WordPress notice that the transient has expired and delete it. If no-one ever attempts to read a stale transient – e.g. because the plugin that created it has been uninstalled – it will stay in your database forever.

* If you have a suitable caching plugin installed, transients can be stored in a fast in-memory cache like APC or Memcached instead of the database.

Fortunately, since the expiration time of each transient is also stored in the database, we can easily clean up stale transients with a little bit of SQL magic. Run the two queries below to delete all stale transients. You can use either phpMyAdmin or a plugin like WP-DBManager to execute SQL queries.

 Source: http://w-shadow.com/blog/2012/04/17/delete-stale-transients/