Thursday, August 19, 2010

Windows - Create file to test filesystem - utility

To create a file filled with zero's on windows;

fsutil file createnew name-of-file.txt 2000 (this is the length in bytes)

This will create a new file with 2000 bytes.


This can usefull for copy / perfomance disk testing.
.
.

Wednesday, August 11, 2010

Varnish - cache "invention" - Load balacing squid's

I tested load balacing squid proxys with HAproxy, and it was nice, then i had a crazy thought;
"what if i used varnish, and load-balance "and" cache at the same time...?"

Varnish its a great software for reverse-caching webservers... i'm not using it for what it was created, but i had this crazy idea...:P

Well, i took varnish and started "inventing" a way...

This is my setup to load-balance and cache, with varnish, 3 squid's :P (yep, crazy i know):

Request---> varnishd:8080 --> refered has "webfarm"
            /    |    \
           /     |     \
       proxy1  proxy2  proxy3

config file: default.vcl

 backend proxy1 {
     .host = "10.30.1.171";
     .port = "8080";
 }


 backend proxy2 {
     .host = "10.30.1.172";
     .port = "8080";
 }

 backend proxy3 {
     .host = "10.30.1.173";
     .port = "8080";
 }

 director webfarm round-robin {
 {
  .backend = proxy1;
 }
 {
  .backend = proxy2;
 }
 {
  .backend = proxy3;
 }
 }

 sub vcl_recv {
  if (client.ip == "10.1.5.10" )
   { set req.backend = webfarm; }
}.


Well it worked...but i'm not very sure about the perfomance...varnish was not created for this :P
.

HAproxy - LoadBalancer - balancing 3 squid's

Trying to loadbalance requests across 3 squid-cache proxys, very nice, i'm enjoiyng HAproxy a lot, great software.

Here it goes:

Client request <-----> HAproxy <---> squid1 \ 
                               <---> squid2  -- web
                               <---> squid3 /


Config file: haproxy.cfg

global
        log 127.0.0.1   local0
        log 127.0.0.1   local1 notice
        #log loghost    local0 info
        maxconn 4096
        #nbproc 2
        #chroot /usr/share/haproxy
        user haproxy
        group haproxy
        daemon
        #debug
        #quiet

defaults
        log     global
        mode    http
        option  httplog
        option  dontlognull
        retries 3
        option redispatch
        maxconn 2000
        contimeout      5000
        clitimeout      50000
        srvtimeout      50000



# reverse proxy-squid
listen  webfarm 0.0.0.0:8000
        mode http
        cookie  SERVERID insert indirect nocache
        balance roundrobin
        option httpclose
        option forwardfor header X-Client
        server  squid1 10.30.1.171:8080 check inter 2000 rise 2 fall 5
        server  squid2 10.30.1.172:8080 check inter 2000 rise 2 fall 5
        server  squid3 10.30.1.173:8080 check inter 2000 rise 2 fall 5


listen admin_stats 0.0.0.0:81
        mode http
        stats uri       /stats
        stats realm     Global\ statistics
        stats auth      username:password

        #errorloc       502     http://192.168.114.58/error502.html
        #errorfile      503     /etc/haproxy/errors/503.http
        errorfile       400     /etc/haproxy/errors/400.http
        errorfile       403     /etc/haproxy/errors/403.http
        errorfile       408     /etc/haproxy/errors/408.http
        errorfile       500     /etc/haproxy/errors/500.http
        errorfile       502     /etc/haproxy/errors/502.http
        errorfile       503     /etc/haproxy/errors/503.http
        errorfile       504     /etc/haproxy/errors/504.http

 
------------------------------ EOF ------------------------------------



.
To access the haproxy stats, use: (the "uri" defined)
http://webfarm:81/stats

Well it works, very nice, and it does backend servers check, and statistics NICE !
.

Monday, July 26, 2010

Active Directory Database - Files

Important files of Active Directory.

Active Directory Database is stored in %systemroot%\NTDS\
the DB file is ntds.dit

The files in this directory, and what they do;
1:ntds.dit : this is the main database file for active directory.
2:edb.log  : When a transaction is performed to AD database, it will be stored to this file, and then after it will be sent to the Database
3:res1.log : Used as a reserved free space, in case of disk low space, default size is 10MB.
4:res2.log : Same of the above.
5:edb.chk  : Records transactions committed to the AD database. During shutdown, "shutdown statement" is written to this file, if it is not found during system startup the AD database checks the edb.log for updated information.

Ntdsutil: tool that can verify database integrity

.