1. start raid
mdadm --assemble --scan
2. start raid in case if you do not have /etc/mdadm.conf (should have raid UUID)
mdadm /dev/md0 --assemble -u e6d85d3d:d20ddcfc:c7cxxxxx:6a0xxxx
3. generate /etc/mdadm.conf
mdadm --detail --scan >> /etc/mdadm.conf
1/20/2012
1/10/2012
[mdadm] 2 how-tos
1. how to cancel sync:
in order to cancel raid sync its necessary to left only one drive as active (we are talking about raid1):
2. how to re-add failed disk into existing array and restart scan :)
We can check the status of the arrays on the system with:
in order to cancel raid sync its necessary to left only one drive as active (we are talking about raid1):
mdadm --fail /dev/md2 /dev/sda3and we will receive something like that (in my case it was md2 and /dev/sda3):
mdadm --detail /dev/md2/dev/sda3 was set as failed.
/dev/md2:
Version : 0.90
Creation Time : Fri Feb 4 21:22:50 2011
Raid Level : raid1
Array Size : 1462766336 (1395.00 GiB 1497.87 GB)
Used Dev Size : 1462766336 (1395.00 GiB 1497.87 GB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 2
Persistence : Superblock is persistent
Update Time : Tue Jan 10 18:37:27 2012
State : clean, degraded
Active Devices : 1
Working Devices : 1
Failed Devices : 1
Spare Devices : 0
UUID : 71b91f85:bdd01b3f:776c2c25:004bd7b2
Events : 0.28394
Number Major Minor RaidDevice State
0 0 0 0 removed
1 8 19 1 active sync /dev/sdb3
2 8 3 - faulty spare /dev/sda3
2. how to re-add failed disk into existing array and restart scan :)
- set disk as failed (we already did that in 1st how-to )
- remove device from array
- add device one more time
mdadm --remove /dev/md2 /dev/sda3
mdadm --add /dev/md2/ /dev/sda3
We can check the status of the arrays on the system with:
watch -n .1 cat /proc/mdstator
mdadm --detail /dev/md0
10/04/2011
Zabbix auto install script
few weeks ago I've noticed that Zabbix team actively developed version 2 of their nice monitoring tool. I decided to install beta version with Postgresql 9.1. Unfortunately Zabbix 1.9.6 does not support Psql 9.1, but with my help :) they fixed that issue. meanwhile I've prepared script which install zabbix from source on clean Centos with Psql 8.4 support.
there is download link to that script https://www.dropbox.com/s/e205kh9vnwyppp8/zabbix_install_centos.sh
this script will be good for testers, sys admins who want to check new features of zabbix :)
there is download link to that script https://www.dropbox.com/s/e205kh9vnwyppp8/zabbix_install_centos.sh
this script will be good for testers, sys admins who want to check new features of zabbix :)
9/03/2011
reboot hung server
The "magic SysRq key"
provides a way to send commands directly to the kernel through the
/proc filesystem. It is enabled via a kernel compile time option,
CONFIG_MAGIC_SYSRQ, which seems to be standard on most distributions.
First you must activate the magic SysRq option:
echo 1 > /proc/sys/kernel/sysrqWhen you are ready to reboot the machine simply run the following:
echo b > /proc/sysrq-triggerThis does not attempt to unmount or sync filesystems, so it should only be used when absolutely necessary, but if your drive is already failing then that may not be a concern.
7/14/2011
How to upgrade Postgres 8.4.x to 9.0.x
I've found a couple of manuals where this procedure is described, but I faced with the problem with postgres-libs which were required for my SVN.
so there is my way how to perfom upgrade
Have fun with new Psql version :)
so there is my way how to perfom upgrade
1. service postgresql stop
2. rsync -a -v --progress /var/lib/pgsql/ /var/lib/pgsql.old/ #this will backup everything
3. wget http://yum.pgrpms.org/reporpms/9.0/pgdg-centos-9.0-2.noarch.rpm
4. rpm -i pgdg-centos-9.0-2.noarch.rpm
5. /etc/yum.repos.d/CentOS-Base.repo and add 'exclude=postgresql*' to the [base] and [updates] sections
6. yum remove postgresql84*
7. rpm -e postgresql-libs --nodeps
8. yum install postgresql90 postgresql90-server postgresql90-libs postgresql90-contrib postgresql90-devel
9. service postgresql-9.0 initdb
10. export PATH=/usr/pgsql-9.0/bin:$PATH
11. su - postgres ; export PATH=/usr/pgsql-9.0/bin:$PATH ; pg_upgrade --old-datadir "/var/lib/pgsql.old/data" --new-datadir "/var/lib/pgsql/9.0/data" --old-bindir "/usr/bin" --new-bindir "/usr/pgsql-9.0/bin"
12. cp /var/lib/pgsql.old/data/pg_hba.conf /var/lib/pgsql/9.0/data/pg_hba.conf
13. service postgresql-9.0 start
14. vacuumdb --all --analyze-only
Have fun with new Psql version :)
5/31/2011
replace mysql-server with percona server
what is percona-server:
now if you want to have such miracle on your cpanel server you need to do this steps for replacing mysql-server with percona-server:
1. backup VPS.
2. dump all dbs.
3. stop all services on the vps
4. make sure that everything is stopped
5. check what mysql packages are installed
in my case it was MySQL-client MySQL-devel MySQL-test MySQL-bench MySQL-shared MySQL-server
so I run this command to completely remove mysql from vps
6. add percona repo
7. check what packages are available in percona repo
should be something like
8. decide what version you need 5.1 or 5.5
in my case I've installed percona 5.5
9. after Percona-server installation it is necessary to check if it started correctly as some variables in my.cnf are not supported.
10. after successful start it is necessary to run mysql_upgrade.
11. for finishing installation run easyapache and recompile apache/php/etc
12. Go to Server Configuration -> Update Config and set MySQL to "never", save, double check it has been done
13. Test new Apache to be sure server is working
Quote:
Percona Server is an enhanced drop-in replacement for MySQL. With Percona Server,
Your queries will run faster and more consistently.
You will consolidate servers on powerful hardware.
You will delay sharding, or avoid it entirely.
You will save money on hosting fees and power.
You will spend less time tuning and administering.
You will achieve higher uptime.
You will troubleshoot without guesswork.
Does this sound too good to be true? It's not. Percona Server offers breakthrough performance, scalability, features, and instrumentation. Its self-tuning algorithms and support for extremely high-performance hardware make it the clear choice for companies who demand the utmost performance and reliability from their database server
Your queries will run faster and more consistently.
You will consolidate servers on powerful hardware.
You will delay sharding, or avoid it entirely.
You will save money on hosting fees and power.
You will spend less time tuning and administering.
You will achieve higher uptime.
You will troubleshoot without guesswork.
Does this sound too good to be true? It's not. Percona Server offers breakthrough performance, scalability, features, and instrumentation. Its self-tuning algorithms and support for extremely high-performance hardware make it the clear choice for companies who demand the utmost performance and reliability from their database server
now if you want to have such miracle on your cpanel server you need to do this steps for replacing mysql-server with percona-server:
1. backup VPS.
2. dump all dbs.
3. stop all services on the vps
Code:
/etc/init.d/httpd stop ; /etc/init.d/exim stop ; /etc/init.d/pure-ftpd stop ; /etc/init.d/dovecot stop ; /etc/init.d/cpanel stop ; /etc/init.d/lfd stop ; /etc/init.d/munin-node stop ; /etc/init.d/crond stop ; /etc/init.d/mysql stop ; /etc/init.d/exim stop ;
4. make sure that everything is stopped
5. check what mysql packages are installed
Code:
rpm -qa | grep -i mysql
in my case it was MySQL-client MySQL-devel MySQL-test MySQL-bench MySQL-shared MySQL-server
so I run this command to completely remove mysql from vps
Code:
yum remove MySQL-client MySQL-devel MySQL-test MySQL-bench MySQL-shared MySQL-server
6. add percona repo
Code:
rpm -Uhv http://www.percona.com/downloads/percona-release/percona-release-0.0-1.x86_64.rpm
7. check what packages are available in percona repo
Code:
yum list | grep percona
should be something like
Code:
# yum list | grep percona
percona-release.x86_64 0.0-1 installed
Percona-SQL-50-debuginfo.x86_64 5.0.92-b23.85.rhel5 percona
Percona-SQL-client-50.x86_64 5.0.92-b23.85.rhel5 percona
Percona-SQL-devel-50.x86_64 5.0.92-b23.85.rhel5 percona
Percona-SQL-server-50.x86_64 5.0.92-b23.85.rhel5 percona
Percona-SQL-shared-50.x86_64 5.0.92-b23.85.rhel5 percona
Percona-SQL-shared-compat.x86_64 5.1.43-2 percona
Percona-SQL-test-50.x86_64 5.0.92-b23.85.rhel5 percona
Percona-Server-51-debuginfo.x86_64 5.1.56-rel12.7.224.rhel5 percona
Percona-Server-55-debuginfo.x86_64 5.5.11-rel20.2.115.rhel5 percona
Percona-Server-client-51.x86_64 5.1.56-rel12.7.224.rhel5 percona
Percona-Server-devel-51.x86_64 5.1.56-rel12.7.224.rhel5 percona
Percona-Server-server-51.x86_64 5.1.56-rel12.7.224.rhel5 percona
Percona-Server-shared-51.x86_64 5.1.56-rel12.7.224.rhel5 percona
Percona-Server-test-51.x86_64 5.1.56-rel12.7.224.rhel5 percona
gnuplot.x86_64 4.2.6-14 percona
gnuplot-emacs.x86_64 4.2.6-14 percona
maatkit.noarch 7284-1 percona
xtrabackup.x86_64 1.6-245.rhel5 percona
xtrabackup-debuginfo.x86_64 1.6-245.rhel5 percona
percona-release.x86_64 0.0-1 installed
Percona-SQL-50-debuginfo.x86_64 5.0.92-b23.85.rhel5 percona
Percona-SQL-client-50.x86_64 5.0.92-b23.85.rhel5 percona
Percona-SQL-devel-50.x86_64 5.0.92-b23.85.rhel5 percona
Percona-SQL-server-50.x86_64 5.0.92-b23.85.rhel5 percona
Percona-SQL-shared-50.x86_64 5.0.92-b23.85.rhel5 percona
Percona-SQL-shared-compat.x86_64 5.1.43-2 percona
Percona-SQL-test-50.x86_64 5.0.92-b23.85.rhel5 percona
Percona-Server-51-debuginfo.x86_64 5.1.56-rel12.7.224.rhel5 percona
Percona-Server-55-debuginfo.x86_64 5.5.11-rel20.2.115.rhel5 percona
Percona-Server-client-51.x86_64 5.1.56-rel12.7.224.rhel5 percona
Percona-Server-devel-51.x86_64 5.1.56-rel12.7.224.rhel5 percona
Percona-Server-server-51.x86_64 5.1.56-rel12.7.224.rhel5 percona
Percona-Server-shared-51.x86_64 5.1.56-rel12.7.224.rhel5 percona
Percona-Server-test-51.x86_64 5.1.56-rel12.7.224.rhel5 percona
gnuplot.x86_64 4.2.6-14 percona
gnuplot-emacs.x86_64 4.2.6-14 percona
maatkit.noarch 7284-1 percona
xtrabackup.x86_64 1.6-245.rhel5 percona
xtrabackup-debuginfo.x86_64 1.6-245.rhel5 percona
8. decide what version you need 5.1 or 5.5
in my case I've installed percona 5.5
Code:
# rpm -qa | grep Percona
Percona-Server-client-55-5.5.11-rel20.2.115.rhel5
Percona-Server-server-55-5.5.11-rel20.2.115.rhel5
Percona-Server-shared-55-5.5.11-rel20.2.115.rhel5
Percona-Server-shared-compat-5.5.11-rel20.2.115.rhel5
Percona-Server-devel-55-5.5.11-rel20.2.115.rhel5
Percona-Server-test-55-5.5.11-rel20.2.115.rhel5
Percona-Server-client-55-5.5.11-rel20.2.115.rhel5
Percona-Server-server-55-5.5.11-rel20.2.115.rhel5
Percona-Server-shared-55-5.5.11-rel20.2.115.rhel5
Percona-Server-shared-compat-5.5.11-rel20.2.115.rhel5
Percona-Server-devel-55-5.5.11-rel20.2.115.rhel5
Percona-Server-test-55-5.5.11-rel20.2.115.rhel5
9. after Percona-server installation it is necessary to check if it started correctly as some variables in my.cnf are not supported.
10. after successful start it is necessary to run mysql_upgrade.
11. for finishing installation run easyapache and recompile apache/php/etc
12. Go to Server Configuration -> Update Config and set MySQL to "never", save, double check it has been done
13. Test new Apache to be sure server is working
3/25/2011
add json support into Flex4
Adobe itself made a JSON library that you can find at https://github.com/mikechambers/as3corelib Follow these steps to add your JSON library to your Flex project:
- Download the .zip archive and extract it. What you need is the .swc file in the lib folder.
- In Flex Builder / Flash Builder, go to your project’s properties, and then to the Flex Build Path panel.
- Click on Add SWC, and select the as3corelib.swc file
- In your project, add the following line: import com.adobe.serialization.json.JSON;

12/17/2010
where is my free disk space :)
To list files larger than 10M:
find / -type f -size +10000k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'
To list files larger than 100M:
find / -type f -size +100000k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'
find / -type f -size +10000k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'
To list files larger than 100M:
find / -type f -size +100000k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'
11/29/2010
how to convert tables to InnoDB
Using nice tool from Maatkit, we can easy convert tables from any storage engine to other. there is example how to convert from myisam to innodb
mk-find db-name --engine MyISAM --exec "ALTER TABLE %D.%N ENGINE=INNODB" --print
Subscribe to:
Posts (Atom)