Server BackUP

Au trecut cred ca vreo 2 luni de cand nu am mai facut un backup general la servere asa Backupca, azi a venit momentul sa’mi asigur un somn mai “linistit” si am facut un backup la bazele de date , pe care le consider cele mai importante, pentru ca oricum restul informatiei o am pe calculatoarele personale in special temele la bloguri!

Si cum de la ultimul backup am invatat o lectie buna: “nu folosi ZIP sau altceva pentru arhivare”, am folosit ceea ce am gasit ca se potriveste pentru necesitatile mele: 7-Zip.

De ce  sa nu folosesti formatul ZIP ? Pentru ca exista riscul ca arhiva sa depaseasca 2Gb si atunci nu o poti salva de pe server (asta daca nu umbli prin matzele din linux)! Apoi, parca retin eu, ca ZIP nu stie multi-archive sub linux (poate ca ma insel si am uitat eu).

Asa ca, am decis sa folosesc 7-Zip care suporta volume pe arhiva, are o rata de compresie mai buna, face arhive si sub format sfx, merge si pe windows, este free, etc…

Asta ptr maniaci ca mine care au baze de date de ordinul a 10Gb !

linux cpu usage

Type the top command:

# top

top - 16:54:34 up 15 days, 13:29,  1 user,  load average: 0.30, 0.18, 0.23Tasks: 136 total,   1 running, 134 sleeping,   1 stopped,   0 zombie
Cpu(s):  9.5%us,  1.8%sy,  0.0%ni, 88.5%id,  0.0%wa,  0.0%hi,  0.2%si,  0.0%stMem:   1026584k total,   886792k used,   139792k free,    78664k buffers
Swap:  2096472k total,   197728k used,  1898744k free,   377476k cached
PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
28780 apache    20   0 59432  21m 6236 S   13  2.1   4:00.40 httpd
24553 mysql     20   0  152m  19m 2976 S    9  1.9 979:12.36 mysqld
12124 root      20   0  2200 1028  796 R    0  0.1   0:00.02 top
1 root      20   0  2040  472  444 S    0  0.0   0:10.80 init
2 root      15  -5     0    0    0 S    0  0.0   0:00.00 kthreadd

or with sysstat

For install sysstat in FedoraCore:

# yum install sysstat

after install use command:

# mpstat 1 10

04:59:25 PM  CPU   %user   %nice    %sys %iowait    %irq   %soft  %steal   %idle    intr/s
04:59:26 PM  all    7.96    0.00    1.00    0.00    0.00    0.00    0.00   91.04     54.00
04:59:27 PM  all    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00     42.57
04:59:28 PM  all    9.00    0.00    0.00    0.00    0.00    0.00    0.00   91.00     21.00
04:59:29 PM  all    8.54    0.00    0.50    0.00    0.00    0.00    0.00   90.95     41.00
04:59:30 PM  all   18.00    0.00    1.00    0.00    0.00    0.00    0.00   81.00     78.0
04:59:31 PM  all    0.00    0.00    0.50    0.00    0.00    0.50    0.00   99.01     78.00

who is monopolizing the CPUs ?
use:

# ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10

%CPU   PID USER     COMMAND
4.3 24553 mysql    /usr/libexec/mysqld --defaults-file=/etc/my.cnf --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --socket=/var/lib/mysql/mysql.sock
1.2 32501 apache   /usr/sbin/httpd
1.2 28803 apache   /usr/sbin/httpd
1.2 28780 apache   /usr/sbin/httpd
1.2  2825 apache   /usr/sbin/httpd
1.1  5893 apache   /usr/sbin/httpd
1.1  4080 apache   /usr/sbin/httpd
1.1  4042 apache   /usr/sbin/httpd
1.1  4029 apache   /usr/sbin/httpd

Install ImageMagick FC6

How to Install ImageMagick on Fedora Core 6 (FC6)

Easy, use YUM:

yum install ImageMagick

after 1 minute:

Installed: ImageMagick.i386 0:6.2.8.0-4.fc6
Dependency Installed: ghostscript.i386 0:8.15.4-1.fc6 ghostscript-fonts.noarch 0:5.50-13.1.1 lcms.i386 0:1.15-1.2.2 libcroco.i386 0:0.6.1-2.1 libgsf.i386 0:1.14.1-7 librsvg2.i386 0:2.16.1-1.fc6 libwmf.i386 0:0.2.8.4-10 urw-fonts.noarch 0:2.3-6.1.1
Complete!

ZIP - End-of-central-directory signature

Aveti de arhivat ceva mare … si din pacate e prea mare … pana la urma arhivati dar beleaua e ca nu puteti sa’l si scoateti prin http (browser) de ex de pe server. Ce e de facut !? Folositi comanda SPLIT din Linux dupa care reconstituiti cu comanda cat fisierul original. La dezarhivare surpriza:

End-of-central-directory signature not found. Either this file is not a Zip file ...

omg , asta e chiar o problema daca acolo era un site important sau baze de date … ce e de facut !?

Exista: p7zip (http://www.7-zip.org/) care va ajuta la extractie chiar daca ceva este neinregula … o sa extraga cu erori daca au aparut erori dar totusi nu va fi ca nimik !!! Asta in cazul in care ajungeti in situatia mea. Daca totusi vreti sa nu aveti astfel de probleme ar fi indicat sa instalati in prealabil p7zip si sa’l folositi la arhivare (in Fedora Core instalati cu: yum install p7zip) .

Pentru help e suficient sa scrieti comada fara parametrii in linia de comada si or sa apare informatiile necesare. Puteti sa faceti si multi-volume (care este foarte important daca serverul de http - apache - nu suporta fisere mai mari de 2Gbyte) chiar si SFX (care nu stiu exact cum merge sub linux) si banuiesc ca nu are limita de dimensiune la arhivare.

UPDATE DONE

Cu chiu cu vai am reusit sa fac upgrade la FC6 si sa restaurez totul : domenii, subdomenii, baze de date, date, pagini, etc … aproximativ totul ;) , asta ptr ca am uitat sa fac un backup la ultimele posturi din blogu asta … dar nu’i bai, nu moare nima din cauza asta ;) !!! see u later !

Cu ocazia asta am dat de cateva setari greiste (default) la godadd ptr upgrade la FC6 dar le’am rezolvat eu cumva … ( o problema legata de subdomenii si dns, o problema cu mysql si cu phpmyadmin) aaa… si mai e o problema legata de config email la domenii in control panel, sper sa o rezolv cat mai rpd.

Linux - Deleting folder recursively

rm -rf directories

Will delete the existing directory named ‘directories‘ and all directories and files below it. Even if it runs into an exception that it would usually prompt for user interaction.

the r is recursive and the f is force.

Linux - List only Directories

1. ls -d */

2. ls -l | grep “^d”

3. find -L -maxdepth 1 -type d -name “*” ! -name “.*” -printf “%f\n”

4. find -L -maxdepth 1 -type d -name “*” ! -name “.*”

5. find -type d

Linux - backup ALL MySQL databases

mysqldump -u root -h localhost -pMyPassword -A | gzip -9 > allmy-db.sql.gz

backup all database from srv to allmy-db.sql.gz file!

———-

To restore compressed backup files you can do the following:

gunzip < allmy-db.sql.gz | mysql -u root -pMyPassword

or uncompress gz file: gunzip allmy-db.sql.gz

and use:
mysql -u root -pMyPassword -h localhost -A < /path/allmy-db.sql
or
mysql
-u root -pMyPassword -h localhost -e “source /path/allmy-db.sql” -A

MINIX 3

MINIX 3 is an operating system designed to be highly reliable, flexible, and secure. It is based somewhat on previous versions of MINIX, but is fundamentally different in many key ways. MINIX 1 and 2 were intended as teaching tools; MINIX 3 adds the new goal of being usable as a serious system on resource-limited and embedded computers and for applications requiring high reliability.

Homepage:
http://www.minix3.org/

One of the formats in which minix 3 can be downloaded is as a VMware-VM ready to run in the VMware player.

Linux - Deleting folder recursively

rm -rf directories

Will delete the existing directory named ‘directories‘ and all directories and files below it. Even if it runs into an exception that it would usually prompt for user interaction.

the r is recursive and the f is force.

Moka
Public
Domain
Free
Photos

My Topsites List
Entertainment blogs Entertainment Blogs - Blog Top Sites Bloggapedia, Blog Directory - Find It! ByREV Article Directory BRDTracker
Entertainment Blog Today.com Entertainment Blogs TopOfBlogs
Directorio-RSS.com imagen Subscribe with Bloglines blog search directory Add to Technorati Favorites Blogverzeichnis - Blog Verzeichnis bloggerei.de