Записи с Меткой ‘ apache

ApacheBench=ab

aptitude install apache2-utils

Натравливать так:
ab -c 1 -n 10 http://site.ru/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking site.ru (be patient)…..done

Server Software: nginx/0.7.67
Server Hostname: site.ru
Server Port: 80

Document Path: /
Document Length: 56349 bytes

Concurrency Level: 1
Time taken for tests: 1.569 seconds
Complete requests: 10
Failed requests: 5
(Connect: 0, Receive: 0, Length: 5, Exceptions: 0)
Write errors: 0
Total transferred: 567473 bytes
HTML transferred: 563493 bytes
Requests per second: 6.37 [#/sec] (mean)
Time per request: 156.945 [ms] (mean)
Time per request: 156.945 [ms] (mean, across all concurrent requests)
Transfer rate: 353.10 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 1 1 0.1 1 1
Processing: 135 156 37.5 143 258
Waiting: 61 76 37.6 65 182
Total: 136 157 37.5 143 259

Percentage of the requests served within a certain time (ms)
50% 143
66% 144
75% 151
80% 176
90% 259
95% 259
98% 259
99% 259
100% 259 (longest request)

Или

The following line uses keepalive for 50,000 connections, at a concurrency of 50 and a timeout of 20 seconds. Be sure to end root domains with a slash.

ab -k -n 50000 -c 53 -t 20 http://daf-uts.ru/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking daf-uts.ru (be patient)
Finished 2909 requests


Server Software:        nginx/1.2.1
Server Hostname:        daf-uts.ru
Server Port:            80

Document Path:          /
Document Length:        15834 bytes

Concurrency Level:      53
Time taken for tests:   20.004 seconds
Complete requests:      2909
Failed requests:        0
Write errors:           0
Keep-Alive requests:    0
Total transferred:      46645815 bytes
HTML transferred:       46061106 bytes
Requests per second:    145.42 [#/sec] (mean)
Time per request:       364.450 [ms] (mean)
Time per request:       6.876 [ms] (mean, across all concurrent requests)
Transfer rate:          2277.23 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   0.8      1      15
Processing:    21  361 381.7    252    2934
Waiting:       18  358 381.6    249    2932
Total:         22  362 381.7    253    2935

Percentage of the requests served within a certain time (ms)
  50%    253
  66%    301
  75%    335
  80%    394
  90%    519
  95%    614
  98%   1463
  99%   2808
 100%   2935 (longest request)

 

zabbix apache2

Zabbix
добавим шаблон apache2 zabbix_agentd.conf
UserParameter=apache.proc,ps ax | grep httpd | wc -l

открываем веб-морду заббикса
создаем item Template App Apache, где ключ будет apache.proc

будет выглядеть вот так.

dd81cd

теперь у нас появились данные апача и заббикса и видно так

fa9852

а теперь добавим триггеров на свой вкус.
мне таких хватает за глаза. по аналогии можно и другие процессы мониторить.

Чрезвычайная Critical time Apache than 5 minutes on {HOSTNAME} {Template App Apache:apache.proc.min(300)}&gt;200 Активировано
Предупреждение Too many Apache on {HOSTNAME} {Template App Apache:apache.proc.last(0)}&gt;100 Активировано
Высокая Warning Apache on {HOSTNAME} {Template App Apache:apache.proc.last(0)}&gt;200 Активировано

 

ну вот и все.

web cluster debian

debian 7

drbd + heartbeat + drbdlinks + php5 + mysql 5.5 + apache + nginx + memcached + eAcceleration

0. vim /etc/apt/sources.list

deb http://packages.dotdeb.org wheezy all
deb-src http://packages.dotdeb.org wheezy all

 

wget http://www.dotdeb.org/dotdeb.gpg
sudo apt-key add dotdeb.gpg
sudo apt-get update

 

1. Настройка Сети
vim /etc/network/interfaces

Node1

# The secondary network interface work
allow-hotplug eth1
iface eth1 inet static
address 192.168.0.51
netmask 255.255.255.0
network 192.168.0.255
gateway 192.168.0.254
dns-nameservers 192.168.0.254

Node2

# The secondary network interface
allow-hotplug eth1
iface eth1 inet static
address 192.168.0.52
netmask 255.255.255.0
gateway 192.168.0.254
dns-nameservers 192.168.0.254

vim /etc/hosts

Node1

127.0.0.1 localhost
127.0.1.1 node1
192.168.0.50 nodewww
192.168.0.51 node1
192.168.0.52 node2

Node2

127.0.0.1 localhost
127.0.1.1 node2
192.168.0.50 nodewww
192.168.0.51 node1
192.168.0.52 node2

2. SSH frendly — делаем аналогично allnode

NOTE: You dont have to create an interface and set this IP or make a IP alias. Heartbeat
will take care of it. Automaticaly.

Now exchange and save authorized keys between node1 and node2.

Key exchange:

On node1:

Generate the key:

[root@hb_test1 ~]# ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa):
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:
9f:5d:47:6b:2a:2e:c8:3e:ee:8a:c2:28:5c:ad:57:79 root@hb_test1.lap.work

Pass the key to node2:
[root@hb_test1 ~]# scp .ssh/id_dsa.pub hb_test2.lap.work:/root/.ssh/authorized_keys

On node2:

Generate the key:

[root@hb_test2 ~]# ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa):
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:
40:66:t8:bd:ac:bf:68:38:22:60:d8:9f:18:7d:94:21 root@hb_test2.lap.work

Pass the key to node1:
[root@hb_test2 ~]# scp .ssh/id_dsa.pub hb_test1.lap.work:/root/.ssh/authorized_keys

2. Настройка времени — allnode

apt-get ntpdate ntp

tzselect, date

 

3. DRBD

vim  /etc/drbd.conf нужно разнести на несколько томов, новый том = новый порт.

apt-get install drbd8-utils drbdlinks

!!!!!!!!!! modprobe drbd >>> /etc/rc.local -на ОБЕИХ нодах.

 

global {usage-count no;
        }
common {
}

resource r0 {
        protocol C;

handlers {
        #split-brain “/usr/lib/drbd/notify-split-brain.sh root”;
        #pri-on-incon-degr “/usr/lib/drbd/notify-pri-on-incon-degr.sh; /usr/lib/drbd/notify-emergency-reboot.sh; echo b > /proc/sysrq-trigger ; reboot -f”;
        #pri-lost-after-sb “/usr/lib/drbd/notify-pri-lost-after-sb.sh; /usr/lib/drbd/notify-emergency-reboot.sh; echo b > /proc/sysrq-trigger ; reboot -f”;
        #local-io-error “/usr/lib/drbd/notify-io-error.sh; /usr/lib/drbd/notify-emergency-shutdown.sh; echo o > /proc/sysrq-trigger ; halt -f”;
}

startup {
        degr-wfc-timeout 120;
        }

disk {
        on-io-error detach;
        }
net {
#       after-sb-0pri disconnect;
#       after-sb-1pri disconnect;
#       after-sb-2pri disconnect;
#       rr-conflict disconnect;
        max-buffers 2048;
        ko-count 4;
}

syncer {
        rate 30M;
        al-extents 257;
        }

on node1 {
        device /dev/drbd0;
        disk /dev/sdb1;
        address 192.168.0.51:7788;
        flexible-meta-disk internal;
        }

on node2 {
        device /dev/drbd0;
        disk /dev/sdb1;
        address 192.168.0.52:7788;
        flexible-meta-disk internal;
        }
}

4.  Drbdlinks start | stop | status | list | monitor

vim  /etc/drbdlinks.conf

mountpoint('/drbd')
link('/etc/apache2')
link('/var/www')
#link('/usr/lib/cgi-bin')
link('/var/lib/mysql')
link('/etc/mysql')
link('/etc/php5')
link('/etc/phpmyadmin')

5.  Heartbeat

apt-get install heartbeat

vim  /etc/ha.d/ha.cf

debugfile       /var/log/ha-debug
logfile         /var/log/ha-log
logfacility     local0
keepalive       2
deadtime        10
warntime        30
initdead        60
udpport         694
auto_failback   off
node    node1
node    node2
debug   1
ucast eth1 192.168.0.52
#bcast eth1
ping 192.168.0.254

vim  /etc/ha.d/haresources

#Node1 

node1 IPaddr::192.168.0.50/24/eth1:1 drbddisk Filesystem::/dev/drbd0::/drbd::ext3 mysql apache2 drbdlinks

#Node2

node2 IPaddr::192.168.0.50/24/eth1:1 drbddisk Filesystem::/dev/drbd0::/drbd::ext3 mysql apache2 drbdlinks

vim /etc/ha.d/authkeys — на обеих нодах

auth 3
3 md5 specialshop