Tuesday, October 3, 2017

Upgrade freebsd 10.3 to 11

Ref: https://sysadmin-note.ru/obnovlenie-freebsd-s-10-3-do-11-0/

Sunday, October 1, 2017

housekeeping old files

find /path/to/check/ -name '*.sql' -type f -mtime +6 -exec rm -rfv "{}" \;

delete file older that +n day

https://www.cyberciti.biz/faq/how-do-i-add-jobs-to-cron-under-linux-or-unix-oses/

Monday, August 21, 2017

Tuning Apache

Letak dulu.. Nanti Refer balik :

https://rudd-o.com/linux-and-free-software/tuning-an-apache-server-in-5-minutes
http://tweenpath.net/simple-way-to-tune-apache-performance-using-mpm-prefork-module/
https://www.devside.net/articles/apache-performance-tuning
https://www.woktron.com/secure/knowledgebase/133/How-to-optimize-Apache-performance.html


https://www.cyberciti.biz/faq/freebsd-command-to-get-ram-information/

https://serverfault.com/questions/241636/what-does-apache-busy-workers-idle-workers-means

https://stackoverflow.com/questions/15922194/problems-with-apache-servers-and-a-lot-of-httpd-processes

https://www.maketecheasier.com/optimizing-apache-part-1/


Okay for my case, I did calculation as below
#dmesg | grep memory
SRAT: No CPU found for memory domain 0
real memory  = 8589934592 (8192 MB)
avail memory = 8252219392 (7869 MB)


 # ps aux | grep 'httpd' | awk '{print $6}'
48552
49872
61092
48516
48516
48516
48512
48516
25860
49032
51148
50984
2376

# ps aux | grep 'mysql' | awk '{print $6}'
907112
2556
2204


MaxRequestWorkers would be:
(Total Memory – Critical Services Memory) / Size Per Apache process
(8252219392 - 907112) /51148   = 161322.2859153828 /1024 = 157



Wednesday, June 14, 2017

Script to backup application and database in linux

#!/bin/sh
TIME=`date +%y%m%d`
FILENAME=$TIME-folderapps-site.tar.gz
SRCDIR=/data/folderapps
DESDIR=/data/backup/
tar -zcvf $DESDIR/$FILENAME $SRCDIR
#tar -zcvf /data/backup/ $TIME-folderapps-site.tar.gz data/folderapps

FILENAME1=$TIME-database_apps26.sql
mysqldump -h172.15.100.22 -udb_admin -pP@ssW0rD --default-character-set=utf8 database_apps26 > $FILENAME1
#backup database

Monday, January 16, 2017

Failover Cluster can’t access when Disk Quorum witness is outage

The problem is when the disk quorum witness is full, we cannot expend or do anything.

Here is the solution that we did;

1. The "disk quorum" which is offline -> we remove it from the "Failed Cluster Manager"-Storage-Disks- Disk quorum- right click remove

2. In my case : the disk is "Disk 1"






















PowerShell command:
Clear-ClusterDiskReservation –Disk
Source: http://technet.microsoft.com/en-us/library/ee461016.aspx
In my case : Clear-ClusterDiskReservation –Disk 1


Then, resize the harddisk by making it online -> right click-> extend

Finish -> then right click -> offline the hardisk

3. Then add back the disk (Add Disk) to the cluster storage;

4. Then configure cluster quorum settings ->  use default quorum configuration setting.






Tuesday, January 10, 2017

Apache 2.4 from 2.2

Here is the refference of changes in apache 2.4 from apache 2.2.
Ref: https://httpd.apache.org/docs/2.4/upgrading.html

From :
    AllowOverride none
    Require all granted

To:
        Options Indexes FollowSymLinks MultiViews
        AllowOverride FileInfo  All
        Order allow,deny
        Allow from all
        Require all granted


Wednesday, November 23, 2016

Upgrade Ubuntu 14.05 to Ubuntu 16.04

Here is the step: (but may be there is some lack here and there in the step)

At the first step I try to upgrade using this step: 
Ref:  https://www.digitalocean.com/community/tutorials/how-to-upgrade-to-ubuntu-16-04-lts

Then everything turn problem.. All services cannot started :( 

Here we go.. lets find out the solution :)
1. I notice that the version of php5 is already replace with php7. Which maybe the culprit of this problem. 
2. Mysql also cannot restart. 
3. Nginx problem because of the php5-fpm already deinstall and cannot be install again. 

Ok.. Lets start to patch;
1. uninstall all the package including all the dependancy of the package mysql.
#dpkg -P --force depends mysql-server mysql-server-5.7 mysql-common mysql-server-core-5.7 php5-mysql mysql-client-5.7 mysql-client-core-5.7 libdbd-mysql-perl libmysqlclient18:amd64 libmysqlclient20:amd64

2. uninstall all the package including all the dependancy of php
#apt-get purge php5-common php5-curl php5-json php5-mysql

3. unistall nginx 
#apt autoremove nginx

Then reinstall back
1. apt-get install mysql-server mysql-client mysql-common dbconfig-mysql
2. apt-get install php-fpm php-mysql



Changes in Mysql

#systemctl stop mysql

#nano /etc/mysql/mysql.conf.d/mysqld.cnf
datadir=/mnt/data/mysql

#nano /etc/apparmor.d/tunables/alias
alias /var/lib/mysql/ -> /mnt/data/mysql/,

#systemctl restart apparmor
#systemctl start mysql

Ref: https://www.digitalocean.com/community/tutorials/how-to-move-a-mysql-data-directory-to-a-new-location-on-ubuntu-16-04

Changes in php
Do some changes at 
#nano /etc/php/7.0/fpm/php.ini
;cgi.fix_pathinfo=1
cgi.fix_pathinfo=0


#systemctl status php7.0-fpm
#systemctl start php7.0-fpm

Changes in Nginx
#nano /etc/nginx/sites-available/default 
fastcgi_pass unix:/run/php/php7.0-fpm.sock;

Ref: https://www.digitalocean.com/community/tutorials/how-to-upgrade-to-php-7-on-ubuntu-14-04
Ref: https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-in-ubuntu-16-04

Others command;
apt-cache show mysql-server | grep Version    ; check version mysql 
dpkg --get-selections | grep php      ; check list package with php
lsb_release -a          ;check version ubuntu
nginx -t      ;test nginx config