Friday, February 1, 2013

Different between ESX vs ESXi

This is very usefull, to who people want to implement Vmware vSphere ESXi

Compassion between ESX and ESXi























http://www.vmware.com/files_inline/images/vsphere_detailed_comparison.gif

Monday, January 14, 2013

Trying ZFS dedup in FreeBSD 9.1 R

I research ZFS with deduplication running on FreeBSD.

In computing, data deduplication is a specialized data compression technique for eliminating duplicate copies of repeating data. Related and somewhat synonymous terms are intelligent (data) compression and single-instance (data) storage. The technique is used to improve storage utilization and can also be applied to network data transfers to reduce the number of bytes that must be sent. In the deduplication process, unique chunks of data, or byte patterns, are identified and stored during a process of analysis. As the analysis continues, other chunks are compared to the stored copy and whenever a match occurs, the redundant chunk is replaced with a small reference that points to the stored chunk. Given that the same byte pattern may occur dozens, hundreds, or even thousands of times (the match frequency is dependent on the chunk size), the amount of data that must be stored or transferred can be greatly reduced.
http://en.wikipedia.org/wiki/Data_deduplication

My box is running FreeBSD 9.1 R.



root@skyline:/root # uname -v
FreeBSD 9.1-RELEASE #0 r243825: Tue Dec  4 09:23:10 UTC 2012     root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC
root@skyline:/root # zpool list
NAME    SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
zroot  1.81T  1.49G  1.81T     0%  1.00x  ONLINE  -
root@skyline:/root #
root@skyline:/root # zfs get all zroot

NAME    PROPERTY    VALUE    SOURCE           
                  
zroot    type    filesystem    -           
                     
zroot    creation    Fri    Jan    11    16:52    2013
                       
zroot    used    3.55G    -           
                       
zroot    available    1.78T    -           
                       
zroot    referenced    373M    -           
                       
zroot    compressratio    1.50x    -           
                       
zroot    mounted    yes    -           
                       
zroot    quota    none    default           
                       
zroot    reservation    none    default           
                       
zroot    recordsize    128K    default           
                       
zroot    mountpoint    legacy    local           
                       
zroot    sharenfs    off    default           
                       
zroot    checksum    fletcher4    local           
                       
zroot    compression    off    default           
                       
zroot    atime    on    default           
                       
zroot    devices    on    default           
                       
zroot    exec    on    default           
                       
zroot    setuid    on    default           
                       
zroot    readonly    off    default           
                       
zroot    jailed    off    default           
                       
zroot    snapdir    hidden    default           
                       
zroot    aclmode    discard    default           
                       
zroot    aclinherit    restricted    default           
                       
zroot    canmount    on    default           
                       
zroot    xattr    off    temporary           
                       
zroot    copies    1    default           
                       
zroot    version    5    -           
                       
zroot    utf8only    off    -           
                       
zroot    normalization    none    -           
                       
zroot    casesensitivity    sensitive    -           
                       
zroot    vscan    off    default           
                       
zroot    nbmand    off    default           
                       
zroot    sharesmb    off    default           
                       
zroot    refquota    none    default           
                       
zroot    refreservation    none    default           
                       
zroot    primarycache    all    default           
                       
zroot    secondarycache    all    default           
                       
zroot    usedbysnapshots    0    -           
                       
zroot    usedbydataset    373M    -           
                       
zroot    usedbychildren    3.19G    -           
                       
zroot    usedbyrefreservation    0    -           
                       
zroot    logbias    latency    default           
                       
zroot    dedup    off    default           
                       
zroot    mlslabel    -               
                       
zroot    sync    standard    default           
                       
zroot    refcompressratio    1.00x    -           
                       
zroot    written    373M    -
root@skyline:/root #

Because the dedup function is turning off, so I have to make it on.

root@skyline:/root # zfs set dedup=on zroot
root@skyline:/root # zfs get compression,dedup zroot
NAME   PROPERTY     VALUE          SOURCE
zroot  compression  off            local
zroot  dedup        on             local
root@skyline:/root #

From that information the dedup musbe on. I am making simulation that the dedup is working.

root@skyline:/ # cd /home/
root@skyline:/home # ls
root@skyline:/home # mkdir Testdedup1
root@skyline:/home # mkdir Testdedup2
root@skyline:/home # mkdir Testdedup3
root@skyline:/home #

root@skyline:/home # du -hs Testdedup*
1.5k    Testdedup1
1.5k    Testdedup2
1.5k    Testdedup3

root@skyline:/home # df -h
Filesystem         Size    Used   Avail Capacity  Mounted on

zroot              1.8T    372M    1.8T     0%    /
devfs              1.0k    1.0k      0B   100%    /dev
zroot/tmp          1.8T     35k    1.8T     0%    /tmp
zroot/usr          1.8T    377M    1.8T     0%    /usr
zroot/usr/ports    1.8T    406M    1.8T     0%    /usr/ports
zroot/usr/src      1.8T    358M    1.8T     0%    /usr/src
zroot/var          1.8T    6.3M    1.8T     0%    /var
zroot/var/empty    1.8T     31k    1.8T     0%    /var/empty
zroot/var/run      1.8T     59k    1.8T     0%    /var/run
zroot/var/tmp      1.8T     32k    1.8T     0%    /var/tmproot@skyline:/home # du -hs /home
6.0k    /home
root@skyline:/home #


root@skyline:/root # zpool list
NAME    SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
zroot  1.81T  1.49G  1.81T     0%  1.00x  ONLINE  -
root@skyline:/root #

As we can see, that the free ALLOC is 1.49 TB. I will copy the 2.2 GB to the zroot, and other Testdedup folder.

root@skyline:/root # zpool list
NAME    SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
zroot  1.81T  3.61G  1.81T     0%  1.00x  ONLINE  -
root@skyline:/root #

root@skyline:/home # du -hs *
2.1G    Testdedup1
1.5k    Testdedup2
1.5k    Testdedup3
root@skyline:/home #

root@skyline:/home # cp Testdedup1/FreeBSD-8.2-RELEASE-i386-dvd1.iso Testdedup2/
root@skyline:/home # du -hs *
2.1G    Testdedup1
2.1G    Testdedup2
1.5k    Testdedup3


root@skyline:/home # zpool list
NAME    SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
zroot  1.81T  3.62G  1.81T     0%  2.00x  ONLINE  -
root@skyline:/home #

I copy to another Testdedup3

cp Testdedup1/FreeBSD-8.2-RELEASE-i386-dvd1.iso Testdedup3/
root@skyline:/home # du -hs *
2.1G    Testdedup1
2.1G    Testdedup2
2.1G    Testdedup3
root@skyline:/home #

How about if I rename the source file to FreeBSD-8.2-RELEASE-i386-dvd1.iso.renamefile

root@skyline:/home # mv Testdedup1/FreeBSD-8.2-RELEASE-i386-dvd1.iso Testdedup1/FreeBSD-8.2-RELEASE-i386-dvd1.iso.renamefile
root@skyline:/home # ls
TestRenameDedup1        Testdedup1              Testdedup2              Testdedup3
root@skyline:/home # du -hs *
1.5k    TestRenameDedup1
2.1G    Testdedup1
2.1G    Testdedup2
2.1G    Testdedup3
root@skyline:/home # cp Testdedup1/FreeBSD-8.2-RELEASE-i386-dvd1.iso.renamefile TestRenameDedup1/
root@skyline:/home # du -hs *
2.1G    TestRenameDedup1
2.1G    Testdedup1
2.1G    Testdedup2
2.1G    Testdedup3
root@skyline:/home #

root@skyline:/home # ls -al TestRenameDedup1/
total 2225265
drwxr-xr-x  2 root  wheel           3 Jan 14 11:43 .
drwxr-xr-x  6 root  wheel           6 Jan 14 11:42 ..
-rw-r--r--  1 root  wheel  2276931584 Jan 14 11:44 FreeBSD-8.2-RELEASE-i386-dvd1.iso.renamefile
root@skyline:/home #

root@skyline:/home # zpool list
NAME    SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
zroot  1.81T  3.62G  1.81T     0%  4.00x  ONLINE  -
root@skyline:/home #


As we can see that,  the ALLOC is still 3.62 GB

Note :
from man zpool hereis the some of explanation.

alloc          Amount of storage space within the pool that has been physi-
                  cally allocated.
capacity     Percentage of pool space used. This property can also be
                  referred to by its shortened column name, "cap".
dedupratio  The deduplication ratio specified for a pool, expressed as a
                  multiplier.  For example, a value of 1.76 indicates that 1.76
                  units of data were stored but only 1 unit of disk space was
                  actually consumed. See zfs(8) for a description of the dedu-
                  plication feature.
 free           Number of blocks within the pool that are not allocated.
 size           Total size of the storage pool.









Friday, January 4, 2013

Data Center Basic, a brief

Today, ICT stand for Information and Communication Technology, for some people specially in big city in the world is basic needs. As we can see, the technology is growth so fast. Internet connection and telecommunication right now is never sleep. Start from my experience on 1995 my first experience browsing using modem 28 kbps, and today my internet connection in my house is 1 mbps, and the contents is vary from text or news become streaming. So that's why the rapid growth of data become exponential growth.
Data center is vital, from data center design, architecture, requirement etc, must be calculate.

A data center or computer centre (also datacenter) is a facility used to house computer systems and associated components, such as telecommunications and storage systems. It generally includes redundant or backup power supplies, redundant data communications connections, environmental controls (e.g., air conditioning, fire suppression) and security devices. 

http://en.wikipedia.org/wiki/Data_center 


Availability, in other word is no downtime, even planed or unplanned downtime.

Availability % Downtime per year Downtime per month* Downtime per week
90% ("one nine") 36.5 days 72 hours 16.8 hours
95% 18.25 days 36 hours 8.4 hours
97% 10.96 days 21.6 hours 5.04 hours
98% 7.30 days 14.4 hours 3.36 hours
99% ("two nines") 3.65 days 7.20 hours 1.68 hours
99.5% 1.83 days 3.60 hours 50.4 minutes
99.8% 17.52 hours 86.23 minutes 20.16 minutes
99.9% ("three nines") 8.76 hours 43.8 minutes 10.1 minutes
99.95% 4.38 hours 21.56 minutes 5.04 minutes
99.99% ("four nines") 52.56 minutes 4.32 minutes 1.01 minutes
99.999% ("five nines") 5.26 minutes 25.9 seconds 6.05 seconds
99.9999% ("six nines") 31.5 seconds 2.59 seconds 0.605 seconds
99.99999% ("seven nines") 3.15 seconds 0.259 seconds 0.0605 seconds

http://en.wikipedia.org/wiki/High_availability


As we can see above, total allowable downtime for planned and unplanned downtime. Base on the SLA/SR
In real life, the cause of downtime can several factors for example blackout power electricity, UPS failure, wrong calcutation, hardware failure, software bugs, human error/unskilled operator.

ICT  especially Enterprise/middle scale must be managed and organize correctly. Strategic, design, transition, operation and continual service improvement should be implement correctly (base on ITIL), YES it's not easy, but it doesn't mean impossible.


The calculation cause by downtime from "IT outage" impact to the lost of revenue.We can calculate base on this equation below.



Quantify Lost Revenue Costs

Revenue Cost = (Revenue / Annual Hours) X Impact X Outage Hours

Revenue = Gross annual revenue
Annual Hours = Total annual business hours
Impact = Percentage impact (e.g. % reduction in transactions or dollars during outage)
Outage Hours = Number of hours of outage






Quantify Lost Labor Costs

Labor Cost = People X Impact X Rate X Hours

People = Number of workers affected
Impact = Avg. % of work they could not perform
Rate = Average employee cost per hour
Hours = Number of hours of outage


http://www.firescope.com/QuickStart/Unify/Article.asp?ContentID=15

Well, even I work in mining company it's really different with retail or banking etc,  but I believe that calculation is close to the real cost.
































Solaris fail to boot, stack in grub

In December 10, 2012, my file server getting failure with unknown reason. After booting the system, it stack in grub command with the following error.

"Error 15: File not found"

Information after repair the grub.
[root@northern ~]#uname -a
SunOS northern.myserver.com 5.10 Generic_141445-09 i86pc i386 i86pc
[root@northern ~]#
[root@northern ~]#isainfo -kv
64-bit amd64 kernel modules
[root@northern ~]#


I got the idea and reference from this following link

https://forums.oracle.com/forums/thread.jspa?messageID=8220143

After making plan (because this zpool contain about 1.7 TB) I decided to try repair the boot loader.

Here is my step :
1. Boot from disk solaris.
2. Choose the "Single User Shell"
3. It will search for Installed OS instances ...
4. OS was found with the following list.
 somethink like this :

1 zfs-RAID-5.0:DiskID   ROOT/s10x_u8wos_08a

5. Try to mount the ZFS pool. Choose the number
6. cd /a
7. Make sure the drive can be read, try with ls command
8. cd /a/boot/grub
9. installgrub stage1 stage 2 /dev/rdsk/c0t0d0s0

Reboot the system, and the system is UP again.

I must check the zpool healthy, unfortunately the zpool is degraded.

[root@northern rdsk]#zpool list
NAME           SIZE   USED  AVAIL    CAP  HEALTH  ALTROOT
zfs-RAID-5.0  1.81T  1.77T  48.4G    97%  DEGRADED  -
[root@northern rdsk]#
[root@northern rdsk]#zpool status
pool: zfs-RAID-5.0
 state: DEGRADED
status: One or more devices has experienced an error resulting in data
        corruption.  Applications may be affected.
action: Restore the file in question if possible.  Otherwise restore the
        entire pool from backup.
   see: http://www.sun.com/msg/ZFS-8000-8A
 scrub: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        zfs-RAID-5.0  DEGRADED     0     0    14
          c0t0d0s0  DEGRADED     0     0    28  too many errors

errors: 1 data errors, use '-v' for a list
[root@northern rdsk]#


This mean that the disk is degraded.

For disaster recovery, always make backup and secondary backup. Make some scenario for disaster recovery, drill the operator and so on.



Wednesday, January 2, 2013

Nginx Configuration example

Here is nginx configuration for some purpose. This example is for roundcube, drupal, and postfix.


server {
        listen       80 ;
        listen       443 ssl;


        #server_name  localhost;
        server_name myserver.com;

        ssl_certificate      server.crt;
        ssl_certificate_key  server.key;

        ssl_session_timeout  5m;

        ssl_protocols  SSLv2 SSLv3 TLSv1;
        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers   on;
        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   /usr/local/www/nginx;
            index  index.html index.htm index.php;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/local/www/nginx-dist;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /usr/local/www/$fastcgi_script_name;
            include        fastcgi_params;
        }



# Alias Directory

        location /roundcube {
        alias //usr/local/www/roundcube; # Roundcube directory
        #deny all;
        allow 192.168.7.0/24;
        deny all;
        index index.php;
        }

        location ~ /roundcube/.*\.php$ {
        if ($fastcgi_script_name ~ /roundcube(/.*\.php)$) {
        set $valid_fastcgi_script_name $1;
        }

        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /usr/local/www/roundcube$valid_fastcgi_script_name;
        include fastcgi_params;
}

location /postfixadmin {
        alias //usr/local/www/postfixadmin; # Postifx Directory
        #deny all;
        allow 192.168.7.0/24;
        deny all;
        index index.php index.html index.htm;
        }

        location ~ /postfixadmin/.*\.php$ {
        if ($fastcgi_script_name ~ /postfixadmin(/.*\.php)$) {
        set $valid_fastcgi_script_name $1;
        }

        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /usr/local/www/postfixadmin$valid_fastcgi_script_name;
        include fastcgi_params;
}

location /portal {
        alias //usr/local/www/portal; # Drupal directory
        #deny all;
#        allow 192.168.7.0/24;
        allow all;
        index index.php index.html index.htm;
        }

        location ~ /portal/.*\.php$ {
        if ($fastcgi_script_name ~ /portal(/.*\.php)$) {
        set $valid_fastcgi_script_name $1;
        }

        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /usr/local/www/portal$valid_fastcgi_script_name;
        include fastcgi_params;
}
# End of alias directory
...


Friday, December 28, 2012

Upgrading FreeBSD 8.2 to STABLE

After for a long time not posting blogspot. In my spare time making documentation for upgrading FreeBSD release to stable. This is old topic and so many documentation around but it's still important who is consider for upgrading FreeBSD to Stable one.

So whats the different between Current and Stable? Well, I think you should read this link :)

http://www.freebsd.org/doc/en/books/handbook/current-stable.html

This is my email server.

mail# uname -a
FreeBSD mail.myserver.com 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Tue Dec 25 00:22:30 WIT 2012     root@mail.myserver.com:/usr/obj/usr/src/sys/PAE-PF-ALTQ  i386
mail#

As we can see, is using FreeBSD 8.2-RELEASE, and I need to upgrade to STABLE one.

First, install cvsup using ports.
/usr/ports/net/cvsup
mail#make install clean
 ....
cp `cat ../M3TARGET`/cvpasswd.1 /usr/local/man/man1/cvpasswd.1
chmod 644 /usr/local/man/man1/cvpasswd.1
===>   Compressing manual pages for cvsup-without-gui-16.1h_4
===>   Registering installation for cvsup-without-gui-16.1h_4
===> SECURITY REPORT:
      This port has installed the following files which may act as network
      servers and may therefore pose a remote security risk to the system.
/usr/local/sbin/cvsupd
/usr/local/bin/cvsup
/usr/local/bin/cvpasswd

      If there are vulnerabilities in these programs there may be a security
      risk to the system. FreeBSD makes no guarantee about the security of
      ports included in the Ports Collection. Please type 'make deinstall'
      to deinstall the port if this is a concern.

      For more information, and contact details about the security
      status of this software, see the following webpage:
http://www.cvsup.org/
mail#

After everything is OK, copy the default configuration of stable supfile in :
mail# cp /usr/share/examples/cvsup/stable-supfile /root/

Edit stable-supfile.

Here is for example :

*default host=CHANGE.TO.NEAREST.SERVER
*default base=/var/db
*default prefix=/usr
*default release=cvs tag=RELENG_8
*default delete use-rel-suffix

# If you seem to be limited by CPU rather than network or disk bandwidth, try
# commenting out the following line.  (Normally, today's CPUs are fast enough
# that you want to run compression.)
*default compress

## Main Source Tree.
#
# The easiest way to get the main source tree is to use the "src-all"
# mega-collection.  It includes all of the individual "src-*" collections.
# Please note:  If you want to track -STABLE, leave this uncommented.
src-all

mail# cvsup -g -L 2 stable-supfile &
Checkout src/usr.sbin/zzz/Makefile
Checkout src/usr.sbin/zzz/zzz.8
Checkout src/usr.sbin/zzz/zzz.sh
Shutting down connection to server
Finished successfully

[1]    Done                          cvsup -g -L 2 stable-supfile

Remove OLD obj in directory /usr/obj if needed.

Now is time to buildworld, because I custimize my kernel options, so I have to build kernel too.
You can skip this, if using default kernel options.

mail#cd /usr/src
mail# make buildworld
mail# make buildkernel KERNCONF=MYKERNEL

After for awhile, compile kernel is complete

text    data     bss     dec     hex filename
8465186  752516  608536 9826238  95efbe kernel.debug
objcopy --only-keep-debug kernel.debug kernel.symbols
objcopy --strip-debug --add-gnu-debuglink=kernel.symbols kernel.debug kernel
--------------------------------------------------------------
>>> Kernel build for MYKERNEL completed on Fri Dec 28 06:49:32 WIT 2012
--------------------------------------------------------------

mail# make installkernel KERNCONF=MYKERNELmail# make installworld
mail# reboot

Check server using this command below.

mail# uname -a
FreeBSD mail.myserver.com 8.3-STABLE FreeBSD 8.3-STABLE #0: Fri Dec 28 06:49:27 WIT 2012     root@mail.myserver.com:/usr/obj/usr/src/sys/PAE-PF-ALTQ  i386
mail#

Done.


Tuesday, December 25, 2012

Simple command and very useful in Windows

I use this command for administering My server, Microsft Windows 2003 Enterprise.


xcopy /c /e /f /h /i /a /s /v /D /z /Y Z:\ E:\share

FORFILES /P D:\Backup /S /M *.bak /D 01/06/2012 /C "cmd /c xcopy @file F:\DB1011\2011 /Y"

FORFILES /P %backupgl% /S /M *.bak /D -366 /C "cmd /c del @file"

Robocopy X:\*.* C:\temp /E /Z /SEC /MIR /R:1 /LOG:%log%

Robocopy command you can download it from microsoft website.

Saturday, December 1, 2012

viperbsd# uname -a
FreeBSD viperbsd.org 7.0-RELEASE FreeBSD 7.0-RELEASE #0: Sat Jun 7 01:50:54 WIT 2008 root@viperbsd.org:/usr/src/sys/i386/compile/viperbsd i386
viperbsd#

#cd /usr/src
# make buildworld
# make buildkernel KERNCONF=ROUTER
# make installkernel KERNCONF= ROUTER
# make installworld
# reboot

DTrace on FreeBSD

DTrace, also known as Dynamic Tracing, was developed by Sun™ as a tool for locating performance bottlenecks in production and pre-production systems. It is not, in any way, a debugging tool, but a tool for real time system analysis to locate performance and other issues. (http://www.freebsd.org/doc/en/books/handbook/dtrace.html)

Well, I am trying to install on my old machine, FreeBSD 7.1

Add this following options to your configuration kernel.

options KDTRACE_HOOKS # Kernel DTrace hooks
options DDB_CTF

Compile your kernel with this options WITH_CTF=1

This articel is out of date. Not open my blog for long time, still in draft.

Friday, June 8, 2012

Installing Spamassassin Postfix/Dovecot on FreeBSD 8.2


I decided to install SpamAssassin in my email server. Actually, I already using spamcop, for at least more than 6 months our email server never get SPAM, fight using header_check, upgrading to pcre support. Well now I need install SpamAssassin.

On 2012 until this day we got huge traffic email. I have to protect the users from SPAM.

Email Traffic

Mails successfully sent

1,028,599448.49 GB
(457.2 KB/Mails)
Mails failed/refused

936,17323.55 GB


First, I upgrade my ports collections using cvsup.
#cvsup –L 2 port-supfiles
My old perl version is 5.8, so I have to upgrade to new one.
Don’t forget to read the UPDATING in /usr/ports/UPDATING (20110517)
This file, will explain many thinks.
#cd /usr/ports/mail/p5-Mail-SpamAssassin
#make clean
#make install

And I got these error :

NOTE: the optional HTTP::Date module is not installed.

  The "sa-update" program requires this module to make HTTP
  If-Modified-Since GET requests.

REQUIRED module missing: HTML::Parser
REQUIRED module missing: Net::DNS
REQUIRED module missing: NetAddr::IP
optional module missing: Digest::SHA1
optional module missing: Mail::SPF
optional module missing: IP::Country
optional module missing: Razor2
optional module missing: Net::Ident
optional module missing: IO::Socket::INET6
optional module missing: IO::Socket::SSL
optional module missing: Mail::DKIM
optional module missing: DBI
optional module missing: LWP::UserAgent
optional module missing: HTTP::Date

warning: some functionality may not be available,
please read the above report before continuing!

Can't open Makefile: No such file or directory.
===>  Building for p5-Mail-SpamAssassin-3.3.2_6
make: cannot open Makefile.
*** Error code 1
Stop in /usr/ports/mail/p5-Mail-SpamAssassin.
*** Error code 1
Stop in /usr/ports/mail/p5-Mail-SpamAssassin.


So I have to install perl module.
#perl –MCPAN –e shell
….
cpan[1]> install HTML::Parser Net::DNS NetAddr::IP Digest::SHA1 Mail::SPF IP::Country Razor2 Net::Ident IO::Socket::INET6 IO::Socket::SSL Mail::DKIM DBI LWP::UserAgent HTTP::Date
#cd /usr/ports/mail/p5-Mail-SpamAssassin
#make clean  (Don’t forget always make clean after getting error)
#make install
Some package maybe just already installs with older version, just make deinstall, make clean then, start again.

sa-update now places state files in /var/db/spamassassin and not
/var/lib/spamassassin.  This is to be consistant with Freebsd file
directory conventions.

If you run sa-compile, you will notice that files are in
/var/db/spamassassin/compiled// instead of
/var/db/spamassassin/compiled/.
No attempts have been made to move old versions over. You must recomp            ile.

If you are running with spamd, you must add the following to rc.conf:
spamd_enable="YES"

Security Note:  If you did NOT deselected AS_ROOT, spamd will be runn            ing
as root. To change this, also add this to rc.conf:
spamd_flags="-u spamd -H /var/spool/spamd"
===> Correct pkg-plist sequence to create group(s) and user(s)
===>   Compressing manual pages for p5-Mail-SpamAssassin-3.3.2_6
===>   Running ldconfig
/sbin/ldconfig -m /usr/local/lib
===>   Registering installation for p5-Mail-SpamAssassin-3.3.2_6
# netstat -a |grep LISTEN
tcp4       0      0 localhost.783          *.*                    LISTEN
….
Before configure main.cf and master.cf please READ CAREFULLY this http://www.postfix.org/FILTER_README.html

Spamassasin configuration local.cf

rewrite_header Subject **SPAM**
required_score 6.0
report_safe 1
use_bayes 1
bayes_path /var/spool/spamd/.spamassassin/bayes
skip_rbl_checks 0
use_razor2 0
use_dcc 0
use_pyzor 0
dns_available yes
header LOCAL_RCVD Received =~ /.*\(\S+\.mydomain\.com\s+\[.*\]\)/
describe LOCAL_RCVD Received: from mydomain.com
score LOCAL_RCVD -50
score BAYES_99 4.300
score BAYES_90 3.500
score BAYES_80 3.000


I want to pool, all spam to one email account.here is  a script :

filter.sh
#!/bin/sh
#Filter Script
SENDMAIL="/usr/sbin/sendmail -i"
EGREP=/usr/bin/egrep

EX_UNAVAILABLE=69
SPAMLIMIT=6
 

trap "rm -f /var/spool/spamd/filter/out.$$" 0 1 2 3 15
cat | /usr/local/bin/spamc -u spamd | sed 's/^\.$/../' > /var/spool/spamd/filter                      /out.$$

if $EGREP -q "^X-Spam-Level: \*{$SPAMLIMIT,}" < /var/spool/spamd/filter/out.$$
then
   $SENDMAIL spampooler@mydomain.com < /var/spool/spamd/filter/out.$$
else
  $SENDMAIL "$@" < /var/spool/spamd/filter/out.$$
fi


exit $?

edit the master.cf
#smtp      inet  n       -       n       -       -       smtpd
smtp      inet  n       -       n       -       -       smtpd
#        -o content_filter=filter:dummy
         -o content_filter=spamassassin:dummy
#
#SPAMFILTERi/SPAMASSASSIN
spamassassin    unix  -       n       n       -       10      pipe
    flags=Rq user=spamd argv=/usr/sbin/filter.sh -f ${sender} -- ${recipient}
maillog

Jun  8 16:52:36 blade postfix/qmgr[49965]: C8F22F7550: from=, size=1345, nrcpt=1 (queue active)
Jun  8 16:52:36 blade postfix/smtpd[96866]: disconnect from smtp.example.com[10.1.1.201]
Jun  8 16:52:36 blade spamd[86197]: spamd: connection from localhost [127.0.0.1] at port 17055
Jun  8 16:52:36 blade spamd[86197]: spamd: processing message <4FD1CB80.6080506@example.com> for spamd:58
Jun  8 16:52:36 blade spamd[86197]: spamd: clean message (-2.9/6.0) for spamd:58 in 0.1 seconds, 1353 bytes.
Jun  8 16:52:36 blade spamd[86197]: spamd: result: . -2 - ALL_TRUSTED,BAYES_00,T_RP_MATCHES_RCVD scantime=0.1,size=1353,user=spamd,uid=58,required_score=6.0,rhost=localhost,raddr=127.0.0.1,rport=17055,mid=<4FD1CB80.6080506@example.com>,bayes=0.000000,autolearn=ham
Jun  8 16:52:37 blade postfix/pickup[94779]: 002A3F7574: uid=58 from=
Jun  8 16:52:37 blade postfix/cleanup[97102]: 002A3F7574: message-id=<4FD1CB80.6080506@example.com>
Jun  8 16:52:37 blade postfix/pipe[97103]: C8F22F7550: to=, relay=spamassassin, delay=0.18, delays=0.02/0/0/0.16, dsn=2.0.0, status=sent (delivered via spamassassin service)
Jun  8 16:52:37 blade postfix/qmgr[49965]: C8F22F7550: removed
Jun  8 16:52:37 blade spamd[1622]: prefork: child states: II
Jun  8 16:52:37 blade postfix/qmgr[49965]: 002A3F7574: from=, size=1683, nrcpt=1 (queue active)
Jun  8 16:52:37 blade postfix/virtual[97142]: 002A3F7574: to=, relay=virtual, delay=0.13, delays=0.06/0/0/0.07, dsn=2.0.0, status=sent (delivered to maildir)
Jun  8 16:52:37 blade postfix/qmgr[49965]: 002A3F7574: removed


Header

Subject: **SPAM** =?GB2312?B?16jStcPYyunQ0NX+yMvUsby8xNzM4cn9?=
Date: Thu, 7 Jun 2012 05:44:11 +0800
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
     smtp.mydomain.com
X-Spam-Flag: YES
X-Spam-Level: **************
X-Spam-Status: Yes, score=15.0 required=6.0 tests=BAYES_99,DOS_OE_TO_MX,
     FORGED_MUA_OUTLOOK,MISSING_MID,RCVD_IN_BRBL_LASTEXT,RCVD_IN_PSBL,
     RCVD_IN_SORBS_WEB,RDNS_NONE,TO_NO_BRKTS_MSFT autolearn=spam version=3.3.2
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----------=_4FCFCF20.8B19D0B7"
Message-Id: <20120606214400.8012FF7551@smtp.mydomain.com>
















Wednesday, November 30, 2011

SHINC

• SHINC: Sundays and holidays included
• SHEX: SHINC plus a dollar
• CQD: SHINC plus five dollars
• BOOKING NOTE: Gencon plus ten dollars bends
• CENTROCON LOAD: A technical term for robbery
• GROSS LOAD: SHINC plus your grandmother’s age, but you won’t get it
• MECH LOAD: Similar to Centrocon load but less owner friendly. Alt. Theft"
• WEATHER WORKING DAYS –CQD: plus four days (eight if grain)
• HSS: Heavy grains, Soya, Sorghum
• WHEAT: HSS less fifty cents
• BARLEY: WHEAT with hair
• "LIGHTS": A term for grain houses to use in order to lie about what they paid for HSS
• MILLET: Wheat for poor people and budgies
• TANKERS: Gearless vessels with no hatches
• MILO: Who knows?

got from this link:
http://virtualshipbroker.blogspot.com/2010/02/excellent-commercial-question-from.html
by: Suraz said...

Monday, November 21, 2011

Splunk Log Management

Here is the example of logging using Splunk.
(Splunk is enterprise software used to monitor, report and analyze the machine data produced by the applications, systems and infrastructure that run a business,http://en.wikipedia.org/wiki/Splunk.)

I am running Solaris
bash-3.00# uname -a
SunOS atlas.haritamineral.com 5.10 Generic_141445-09 i86pc i386 i86pc
bash-3.00#

Using syslog for logging jetty log.
The configuration of log4j.properties looks like:
log4j.rootCategory=INFO, CONSOLE, LOGFILE, SYSLOG

log4j.appender.SYSLOG=org.apache.log4j.net.SyslogAppender
log4j.appender.SYSLOG.Threshold=INFO
log4j.appender.SYSLOG.Target=com.haritamineral
log4j.appender.SYSLOG.layout=org.apache.log4j.PatternLayout
log4j.appender.SYSLOG.layout.ConversionPattern=%d{dd/MMM/yy HH:mm:ss} %5p %t %c{1}:%L - %m%n
log4j.appender.SYSLOG.SyslogHost=localhost
log4j.appender.SYSLOG.Facility=Local2
log4j.appender.SYSLOG.FacilityPrinting=true

and the syslog.conf in /etc
I Just add one line
#jetty
local2.info @master.haritamineral.com

Where is master.haritamineral.com is splunk server that listen logging UDP and TCP running on port 514.

for restart, disable, enable the syslog is using svcadm command.
#svcadm restart system-log

First try, I am getting error :

Nov 21 14:34:25 atlas.haritamineral.com syslogd: line 20: unknown priority name

After googling, that my mistakes is using of space instead of TAB key.

as you can see you can see my log4j in my jetty applications in Splunk Log Management.

Monday, January 3, 2011

Is Data ONTAP Based On UNIX?

Is Data ONTAP Based On UNIX?

A customer recently asked, “Is Data ONTAP based on UNIX?” Complicated question.

The first version of Data ONTAP borrowed lots of code from Berkeley Net/2 (one of the earliest open-source releases of UNIX), including the TCP/IP stack, system boot code, and device drivers. Since then, we’ve borrowed liberally from other open-source UNIX releases. We wrote the command line interface from scratch, but we designed it to look like UNIX, since our first market was UNIX system administrators. Clearly, ONTAP is related to UNIX.

On the other hand, ONTAP’s architecture is very different from UNIX. There is no user-space, the filesystem is completely different, the RAID and diskubsystems are completely different and most important of all, the interaction between subsystems is very different. The key data paths from network to disk look nothing at all like UNIX.

You can imagine two completely different ways of building an appliance. You could start with UNIX and strip out, disable, or hide the pieces you don’t want. sOr else you could start from scratch, inventing a new architecture optimized for the task at hand, but borrowing liberally from the UNIX code-base as appropriate. We chose the latter.

Interestingly, our advanced ONTAP GX architecture is built on top of a full UNIX release. We took Data ONTAP, including WAFL and RAID, combined it with the new code from our Spinnaker acquisition, and hosted the combined result on FreeBSD in a combination of user processes and kernel modules. For security and simplicity we have disabled and hidden many parts of FreeBSD.

Even for ONTAP GX, this isn’t quite the “start with UNIX and slim it down” approach, because most of the system lives in large kernel modules that kick UNIX out of the way. They grab control of almost all of the memory, as well as the critical device drivers, and we even re-wrote the scheduler to make sure the UNIX parts don’t get in the way. We’re still not using the normal UNIX data paths.

Why the difference? One reason is that CPUs are way more powerful now than when we started, so a little bit of extra overhead matters less. (Our first product used a 50 megahertz 486.) In addition, UNIXs have gotten much better. When we started, there was no Linux, no FreeBSD, and AT&T and UC Berkeley were still in a legal battle over big chunks of the Berkeley Net/2 Release.

Although these two approaches feel very different to engineers developing the systems, each with its own advantages and disadvantages, there is little if any difference to the end-user.

(note: without permission to dave)

Tuesday, November 16, 2010

Superkomputer China Resmi Kalahkan Amerika

Superkomputer China Resmi Kalahkan Amerika
Senin, 15 November 2010 | 22:15 WIB
Superkomputer buatan China yang diberi nama Tianhe-1A berlokasi di National Supercomputer Center, Tianjin.
TERKAIT


BEIJING, KOMPAS.com — China secara resmi mencatatkan diri sebagai negara yang memiliki superkomputer tercepat di dunia. Ini adalah kali pertama superkomputer buatan China masuk daftar peringkat pertama superkomputer tercepat dunia yang dirilis situs web www.top500.com dan mengalahkan superkomputer-superkomputer buatan Amerika Serikat.

Tianhe-1 atau berarti Bima Sakti, nama superkomputer yang dibangun di National Supercomputing Centre di Tianjin, melampaui kecepatan hingga 2,570 petaflop atau triliun kalkulasi per detik. Di urutan kedua terdapat Jaguar, superkomputer milik Pemerintah AS di Tennessee dengan 1,750 petaflop.

Tidak hanya satu superkomputer China yang unjuk gigi. Di urutan ketiga pun terdapat superkomputer milik China, yakni Nebulae, di National Supercomputing Centre di Shenzhen. Superkomputer buatan ASmemang masih mendominasi daftar tersebut. Dari 500 unit, lebih dari setengah berada di AS. China mencatat 42 unit dan melampaui jumlah superkomputer Jepang, Perancis, Jerman, dan Inggris. Namun, superkomputer-superkomputer di China menggunakan cip buatan perusahaan AS, antara lain Nvidia.

Sebagai informasi, pengumuman daftar 500 superkomputer tercepat dilakukan rutin dua kali setahun. Penilaian berdasarkan kecepatan yang dicapai dengan tes benchmark ini dirancang ahli Jerman dan Amerika. Bukan kali pertama superkomputer Amerika dikalahkan negara Asia karena pada tahun 2002, Jepang pernah melakukannya.

PENANGGALAN HIJRIAH Memahami Perbedaan Idul Adha 1431 H

PENANGGALAN HIJRIAH
Memahami Perbedaan Idul Adha 1431 H
Selasa, 16 November 2010 | 09:07 WIB
KOMPAS
Ijtimak Awal Zulhijah 1431 Hijriah 6 November 2010 pukul 15.52 WIB
TERKAIT:

* Meneguhkan Semangat Berkurban
* Wukuf Tentukan Waktu Shalat Idul Adha
* Sebagian Umat Shalat Idul Adha Pagi Ini

M ZAID WAHYUDI

KOMPAS.com - Potensi adanya perbedaan Idul Adha 1431 Hijriah sudah diprediksi para ahli hisab rukyat dan astronom sejak beberapa tahun lalu. Perbedaan itu terwujud saat ini dengan adanya sebagian umat Islam Indonesia yang memperingati Idul Adha pada Selasa ini, sama seperti di Arab Saudi, dan sebagian lagi Rabu esok.

Melalui sidang isbat atau penetapan yang dilakukan Kementerian Agama dan dihadiri wakil berbagai organisasi massa Islam, pemerintah menetapkan Idul Adha 10 Zulhijah 1431 H jatuh pada 17 November 2010.

Anggota Badan Hisab Rukyat Kementerian Agama yang juga Profesor Riset Astronomi Lembaga Penerbangan dan Antariksa Nasional Thomas Djamaluddin di Jakarta, Senin (15/11), mengatakan, secara teoretis atau hisab, bulan sabit tipis atau hilal tidak mungkin diamati pada 6 November karena ketinggiannya di atas ufuk masih di bawah dua derajat. Hal itu juga didukung dengan data pengamatan yang menunjukkan hilal belum bisa dilihat atau dirukyat di seluruh Indonesia.

Dengan demikian, bulan Dzulqa’dah atau bulan ke-11 dalam kalender Islam dibulatkan menjadi 30 hari sehingga 1 Zulhijah bertepatan dengan 8 November.

Di Indonesia, lanjut Djamaluddin, jika ada yang menetapkan Idul Adha pada 16 November, hal itu karena menggunakan kriteria wujudul hilal atau terbentuknya hilal (tanpa perlu diamati) sehingga bulan Dzulqa’dah hanya 29 hari.

Perbedaan lain muncul dengan ketetapan Pemerintah Arab Saudi yang menetapkan Idul Adha juga pada 16 November sehingga puncak ibadah haji berupa wukuf di Arafah dilakukan pada 9 November kemarin.

Menurut Djamaluddin, keputusan Pemerintah Arab Saudi menentukan Idul Adha tahun ini tergolong kontroversial. Secara teoretis, hilal tidak bisa dirukyat pada 6 November di Mekah. Namun, ternyata otoritas setempat menentukan berbeda.

Sebagai catatan, dalam keputusan penentuan hari raya, Pemerintah Arab Saudi sering kali digugat oleh para astronom di Timur Tengah dan kawasan lain. Meskipun Arab Saudi menggunakan metode melihat hilal untuk menentukan awal bulan, tapi sering kali hilal yang diklaim bisa dilihat itu secara teoretis astronomi tidak mungkin bisa dilihat.

Garis penanggalan bulan

Anggota Badan Hisab Rukyat Kementerian Agama lainnya yang juga ahli kalender di Program Studi Astronomi, Institut Teknologi Bandung, Moedji Raharto, mengatakan, garis penanggalan pada kalender Hijriah berbeda dengan garis penanggalan kalender Masehi.

Garis penanggalan Masehi didasarkan pada patokan garis bujur timur atau garis bujur barat 180 derajat. Dalam penanggalan ini, daerah yang memiliki garis bujur sama atau berdekatan mulai dari kutub utara hingga kutub selatan akan selalu memiliki hari yang sama. Perubahan hari dimulai pada pukul 00.00.

Daerah yang lebih timur juga dipastikan akan lebih dahulu waktunya dibandingkan daerah di baratnya. Karena itu, dalam sistem penanggalan Masehi, waktu di Jakarta atau waktu Indonesia barat (WIB) selalu empat jam lebih dulu dibandingkan waktu Mekkah.

Namun, garis penanggalan bulan berbeda. Garis penanggalan bulan memiliki 235 variasi. Setiap bulannya, garis penanggalan bulan berbeda-beda. Garis penanggalan bulan akan kembali di dekat tempat yang sama sekitar 19 tahun kemudian.

Banyaknya variasi garis penanggalan bulan ini ditentukan oleh posisi Bulan terhadap Bumi, dan posisi sistem Bumi-Bulan terhadap Matahari.

Daerah yang pertama kali melihat hilal akan mengawali hari lebih dulu. Hal ini berarti, daerah yang terletak pada garis bujur yang sama atau berdekatan, hari atau awal bulan Hijriahnya bisa berbeda. Hari dimulai setelah Matahari terbenam atau magrib, bukan pukul 00.00.

Kondisi ini, lanjut Moedji, yang membuat waktu di Jakarta tidak selalu lebih dahulu dibanding Mekkah. Jika diasumsikan, hilal pada Zulhijah kali ini pertama kali dilihat di Mekkah, maka sesudah magrib atau sekitar pukul 18.00 di Mekkah sudah masuk bulan baru.

Saat itu, di Jakarta sudah pukul 22.00 WIB. Baru pada magrib keesokan harinya, Jakarta memasuki Zulhijah. Artinya, pada bulan Zulhijah kali ini waktu di Jakarta tertinggal 20 jam dibandingkan waktu Mekkah.

”Dalam penanggalan Hijriah, waktu di Indonesia bisa jadi lebih dulu dibandingkan waktu di Arab Saudi. Namun, bisa jadi pula Arab Saudi lebih dulu dibanding Indonesia,” tambahnya.

Menurut Moedji, perbedaan awal hari dalam kalender Hijriah inilah yang sering dipahami secara salah. Mereka beranggapan, karena waktu di Indonesia lebih cepat dibanding Mekkah, maka saat di Mekkah berhari raya, di Indonesia juga harus berhari raya. Padahal, konsep ini didasarkan atas pencampuradukkan konsepsi kalender Hijriah dan Masehi sehingga menimbulkan kerancuan.

”Umat Islam Indonesia harus memahami bahwa mereka menggunakan dua sistem kalender. Kalender Masehi untuk keperluan sehari-hari dan kalender Hijriah untuk keperluan ibadah. Setiap kalender memiliki konsep dan konsekuensi masing-masing yang berbeda,” ungkapnya.

Meskipun berbeda, baik Moedji maupun Djamaluddin mengajak umat Islam menghormati perbedaan yang ada. Kejadian ini harus kembali memacu umat Islam Indonesia untuk segera membuat kriteria penentuan awal bulan Hijriah secara bersama yang berlaku nasional.

Jika sudah ada, maka konsepsi ini bisa disosialisasikan secara regional dan internasional sehingga diperoleh sistem penanggalan Hijriah yang bisa berlaku secara global.

”Sistem penanggalan Hijriah memang lebih kompleks dibandingkan penanggalan Masehi, tapi itu bukan berarti tidak bisa distandardisasi,” ujar Moedji.

Friday, September 17, 2010

Ngeper Perang Siaga di Perundingan

Ngeper Perang Siaga di Perundingan

SEMANGAT tempur bergelora di dada Sersan Kepala Edy Musyawan. Gigi gerahamnya gemerutuk menahan amarah. Prajurit TNI Angkatan Laut itu berdiri di atas dek kapal perang KRI Rencong dengan mata menyala. Edy seakan hendak menerkam kapal perang Malaysia yang berkeliaran di sekitar Ambalat, perbatasan RI-Malaysia, di Laut Sulawesi.

"Kalau mau tempur, siap!" kata Edy sembari mengacungkan tinjunya. Ia bilang, naluri perangnya tertantang saat melihat manuver provokatif kapal perang Malaysia. Di mata Edy, kapal negara jiran itu makin lama kian kurang ajar. Sejak Kamis pekan silam, jumlah armada mereka yang lalu lalang di kawasan sengketa itu makin bertambah banyak.

Sebelumnya, hanya terlihat dua kapal perang. Kini enam kapal Kerajaan Malaysia yang berpatroli. Dengan teropong KRI K.S. Tubun, Gatra melihat armada tempur Malaysia bergerak ke wilayah Indonesia. Kapal perang Diraja Malaysia (KD) Sri Johor berada di barisan terdepan. Disusul KD Buang dan KD Kota Baharu. Mereka konvoi bersama dua kapal patroli polisi Malaysia.

Manuver tentara Diraja Malaysia itu tak dibiarkan oleh tentara Indonesia. Tiga kapal perang Indonesia --KRI Wiratno, KRI Tongkol, dan KRI Tedong Naga-- segera menghadang. KD Sri Johor putar haluan setelah berhadapan dengan KRI Tongkol dalam jarak sekitar 30 meter. Begitu juga kapal Malaysia lainnya.

Tidak terjadi pembicaraan lewat radio antara dua awal kapal perang yang berseteru itu. "Kontak radio dengan mereka? No way," ujar Komandan KRI K.S. Tubun, Letnan Kolonel I Nyoman Gede Aryawan. "Arahan dari pimpinan TNI sudah jelas, jangan diskusi di lapangan," Aryawan menegaskan. Sebelumnya, sempat terjadi perang mulut lewat radio antara KRI Rencong dan kapal perang Malaysia KD Kerambit.

Dua kapal perang itu nyaris bentrok di perairan sekitar Takat Unarang --nama resmi Karang Unarang, Sabtu dua pekan lalu. Waktu itu, KRI Rencong berpatroli mengawal pembangunan rambu suar di situ. Ternyata, di perairan itu sudah ada KD Kerambit. KRI Rencong berada di perairan Indonesia, koordinat 03.59 lintang utara (LU)-118.4 bujur timur (BT).

Sedangkan KD Kerambit berada di posisi 04.01 LU-118.05 BT. Jarak mereka tak sampai sepelemparan peluru. "Mungkin area tersebut telah diklaim pihak Malaysia sebagai wilayahnya," kata Letnan Kolonel Marsetio, Kepala Staf Gugus Tempur Laut Komando Armada RI Kawasan Timur.

Lewat kontak radio, awak kapal perang Malaysia menyebut KRI Rencong memasuki wilayah perairannya. KD Kerambit menyuruh KRI Rencong putar haluan. Mendengar seruan itu, KRI Rencong langsung menjawab bahwa kapal Malaysia yang justru masuk wilayah Indonesia. "Sempat terjadi adu argumen mengenai kedaulatan wilayah tersebut," kata Marsetio pula.

Setelah berulang kali KRI Rencong mengingatkan bahwa laut yang diarungi KD Kerambit adalah wilayah RI, kapal Malaysia itu putar haluan. KRI Rencong terus membuntuti kapal tersebut hingga jarak sekitar 900 meter. Melalui radio, awak kapal Malaysia berkecepatan 21 knot itu mendesak agar pembangunan suar di Takat Unarang dihentikan.

Indonesia tak menggubris permintaan Malaysia itu. Pembangunan rambu suar di Takat Unarang jalan terus. Agar para pekerja tenang, pembangunan menara suar itu ditunggui 10 personel pasukan Marinir TNI Angkatan Laut. Sampai akhir pekan lalu, pembangunan menara suar itu sudah mencapai 60%.

Meruncingnya hubungan RI-Malaysia bermula dari langkah perusahaan minyak Malaysia, Petronas, yang memberi konsesi eksplorasi kepada perusahaan Inggris-Belanda, Shell, 16 Februari lalu. Malaysia mengklaim wilayah sebelah timur laut Kalimantan Timur itu miliknya. Ia menyebut wilayah Ambalat Blok XZY berdasarkan peta yang dibuatnya pada 1979.

Indonesia menyebut blok yang sama sebagai Blok Ambalat dan Blok Ambalat Timur. Wilayah di kedua blok ini diperkirakan mengandung minyak dan gas ratusan juta barel. Di Blok Ambalat ini, Indonesia telah memberikan konsesi eksplorasi kepada ENI, perusahaan minyak Italia. Blok Ambalat Timur diberikan kepada perusahaan Amerika Serikat, Unocal. Dalam rangka mengamankan Blok Ambalat, Indonesia lantas mendirikan menara suar di Takat Unarang, masih terbilang kawasan Ambalat.

Kemudian terjadilah insiden Takat Unarang. Sebanyak 17 pekerja Indonesia ditangkap oleh awak kapal perang Malaysia KD Sri Malaka, 21 Februari lalu. Mareka baru dilepaskan setelah dijemur selama empat jam di atas geladak kapal perang KD Sri Malaka. Mendengar kabar tak sedap itu, KRI Rencong dan KRI Tongkol yang sedang berpatroli di laut Sulawesi Selatan diperintahkan meluncur menuju lokasi panas.

Lima kapal Indonesia lainnya menyusul. Kelimanya adalah KRI K.S. Tubun, KRI Nuku, KRI Singa, KRI Tedong Naga, dan KRI Wiratno. Kehadiran tujuh kapal Indonesia di kawasan Ambalat ini untuk sementara mampu mencegah gerakan kapal perang Malaysia ke wilayah Indonesia.

Namun Malaysia tidak mau diam. Sebuah pesawat pengintai ditengarai kembali melintas di wilayah udara Indonesia, Senin pekan lalu. Peristiwa itu terjadi sekitar pukul 12.00 di dekat Pulau Sebatik, Kalimantan Timur. "Saya tidak bisa memastikan jenis pesawatnya. Tapi, yang jelas, telah memasuki wilayah RI," ujar Prajurit Satu Agus Sugiyono, anggota Batalyon Marinir III Surabaya yang bertugas di Pulau Sebatik.

Sejumlah prajurit Marinir TNI Angkatan Laut sebetulnya telah siap membidikkan senjata mesin berat berpeluru kaliber 12,7 mm. Namun, karena tidak ada perintah untuk menembak, pasukan Marinir urung memuntahkan pelurunya. "Kalau ada perintah, ya, kami tembak," kata Agus Sugiyono.

Manuver Malaysia tidak hanya sebatas itu. Jauh hari sebelumnya, persisnya 7 Januari, Tentara Diraja Malaysia juga menguber-uber kapal motor nelayan Daya Sakti. Kapal berawak enam orang itu sempat dihujani tembakan dan dilempar granat. Daya Sakti yang berada 4 mil di sebelah barat Takat Unarang itu dianggap memasuki wilayah Malaysia.

"Kapal itu rusak karena sempat ditabrak patroli Malaysia," kata H.M. Yusuf, Ketua Himpunan Nelayan Kabupaten Nunukan. Akibat insiden itu, para nelayan takut mencari ikan di seputar Ambalat. H.M. Yusuf yang asli Makassar itu pun meminta bantuan TNI untuk menjaga para nelayan yang melaut di seputar Ambalat. "Tanpa ada jaminan keamanan, ya, berat, karena tentara Malaysia tidak segan menembak kami," katanya.

Ulah tengil kapal patroli Diraja Malaysia terulang, Senin lalu. Ketika KRI K.S. Tubun yang ditumpangi Presiden Susilo Bambang Yudhoyono berlayar dari Nunukan menuju Sebatik, dua kapal perang Malaysia, KD Pari dan KD Paus, melintas di depan KRI K.S. Tubun. Jaraknya sekitar dua mil laut atau sekitar 3,2 kilometer.

Berbagai provokasi Malaysia itu tidak urung membuat geram masyarakat Indonesia. Selain dihadang TNI, langkah Malaysia hendak mencaplok Ambalat juga disambut kemarahan masyarakat Indonesia. Demo anti-Malaysia bermunculan di sejumlah kota di Tanah Air. Berbagai kelompok masyarakat dan mahasiswa turun ke jalan untuk menyerang Malaysia. Demo itu diwarnai pembakaran bendera Malaysia.

Jargon "Ganyang Malaysia" yang digelorakan Bung Karno pada 1960-an kembali dikumandangkan para demonstran. Anggota Komisi I DPR-RI, Permadi, pun ikut berdemo bersama mahasiswa. Komisi yang mengurusi bidang pertahanan, luar negeri, dan informasi itu menggelar aksi di depan Kedutaan Besar Malaysia, Jalan H.R. Rasuna Said, Jakarta Selatan. "Usir Malaysia," teriak para demonstran.

Di luar demo anti-Malaysia, ada juga kelompok demonstran yang menuding Pemerintah Indonesia sengaja membelokkan isu kenaikan harga bahan bakar minyak (BBM) ke kasus sengketa minyak di Ambalat. Sekelompok mahasiswa Unversitas Negeri Jember, Jawa Timur, misalnya, menuduh pemerintahan Presiden Yudhoyono sengaja menutupi isu kenaikan harga BBM dengan sengketa Ambalat. Demo anti-kenaikan harga BBM sama serunya dengan gerakan anti-Malaysia.

Hanya saja, sebagian warga Malaysia sepertinya cuek saja menghadapi gerakan anti-Malaysia itu. Tidak ada serangan balik dari negeri jiran. Yang ada hanya seruan agar warga Malaysia mengurangi pemakaian tenaga kerja Indonesia. Anjuran ini datang dari Persekutuan Majikan-majikan Malaysia (MEF).

Ketua Eksekutif Majikan Malaysia, Shamsudin Bardan, menyarankan agar Kerajaan Malaysia membuka peluang lebih lebar untuk mengambil pekerja dari negara lain. "Dengan begitu, Kerajaan Malaysia tidak terlalu bergantung pada tenaga kerja dari Indonesia," kata Shamsudin Bardan, yang dikutip Utusan Malaysia, koran terbesar Malaysia.

Pemberitaan pers Malaysia tentang sengketa Ambalat juga tak segencar media di Tanah Air. Media cetak dan elektronik Malaysia hanya memberi porsi kecil pada berita yang berkaitan dengan Ambalat. Sedangkan media massa Indonesia, selama sepekan belakangan ini, menjadikan Ambalat sebagai headline. Pemberitaan pers Indonesia sempat membuat gusar Menteri Luar Negeri Malaysia, Syed Hamid Albar.

Dia menilai sikap media di Indonesia memicu sentimen anti-Malaysia. "Ini tidak kondusif bagi upaya penyelesaian masalah," ujar Hamid Albar. Soal sengketa wilayah itu, menurut Syed Hamid Albar, Pemerintah Malaysia akan melindungi kepentingan dan kedaulatan negaranya. Tapi dia juga menegaskan, Malaysia tidak menginginkan konfrontasi dengan Indonesia. "Kalau kami melindungi kepentingan dan kedaulatan kami, tidak berarti kami menginginkan konfrontasi," Hamid Albar menegaskan.

Ia berniat menggunakan lintasan diplomatik untuk membereskan sengketa Ambalat. Pertemuan Syed Hamid Albar dengan Menteri Luar Negeri RI Hassan Wirajuda di Jakarta menyepakati, penyelesaian masalah perbatasan laut kedua negara melalui jalan damai. Selanjutnya tim teknis Indonesia dan Malaysia akan bertemu pada 22-23 Maret mendatang.

Kedua negara juga setuju mengambil langkah untuk mengurangi ketegangan yang berkembang beberapa hari terakhir. Hanya saja, jalur perundingan yang dijajal Hassan Wirajuda dan Syed Hamid Albar tidak mengendurkan semangat TNI untuk menempatkan pasukan di Laut Sulawesi. Panglima TNI Jenderal Endriartono Sutarto menegaskan, prajurit TNI tetap disiagakan di perairan penuh minyak yang kini diincar Malaysia itu.

"TNI wajib menjaga negara," kata Endriartono Sutarto. Jumlah pasukan dan alat tempur yang ditempatkan di garis batas akan disetarakan dengan pasukan Malaysia. Saat ini, pasukan Marinir TNI Angkatan Laut yang dikomandani Letnan Dua Willy Udianto disiagakan di Pulau Sebatik. Sedikitnya, tiga senjata mesin berat ditempatkan di sana.

Moncong senjata berat buatan Rusia dan Belgia yang punya daya jangkau tembak 1.200-2.500 meter diarahkan ke kota Tawau, Malaysia. Di wilayah sekitar Pulau Sebatik, sedikitnya terdapat enam pos pertahanan perbatasan. Antara lain pos Marinir di Tinabasan dan Sungai Bolong. Lalu pos TNI Angkatan Laut di Nunukan, Sei Pancang, Sei Nyamuk, dan Sei Taiwan.

Rencananya, satu batalyon Marinir dari Surabaya dikirim ke Tarakan. Pasukan elite TNI Angkatan Laut itu dilengkapi berbagai mesin perang. Antara lain peluncur roket yang mampu memuntahkan 40 peluru sekaligus dalam tiga detik. Jarak tembaknya 24 kilometer, dengan daya hancur 2 kilometer persegi. Selain itu, puluhan tank amfibi BTR-80, yang merupakan tank terbaru Marinir, juga dipersiapkan untuk dikirim ke perbatasan.

Kepala Staf TNI Angkatan Darat Letnan Jenderal Djoko Santoso menyatakan, pasukan TNI Angkatan Darat siap mendukung operasi di Ambalat. ''Kami tidak akan membiarkan satu jengkal tanah pun diambil negara lain," kata Djoko Santoso.

TNI Angkatan Udara mengirim empat pesawat tempur F-16 ke Balikpapan. Pesawat yang semula berada di Madiun itu dipindahkan ke Kalimantan Timur untuk memudahkan kontrol atas Ambalat. Lima kapal perang TNI Angkatan Laut bersenjata lengkap berpatroli di Ambalat. Yakni KRI Nuku, KRI Wiratno, KRI K.S. Tubun, KRI Rencong, dan KRI Tongkol.

Operasi Ambalat juga diperkuat dua pesawat pengintai Nomad, dua pesawat Cassa, dan satu helikopter Bolko yang disiagakan di KRI K.S. Tubun. Pesawat itu bertugas mengawasi gerakan kapal Malaysia yang berusaha menerobos masuk ke wilayah Nusantara sejak sengketa Ambalat mencuat. Menurut Menteri Pertahanan RI Juwono Sudarsono, Malaysia menggunakan sengketa Ambalat sebagai uji coba terhadap kekuatan militer Indonesia. "Karena kita dinilai tidak terlalu kuat," tutur Juwono Sudarsono.

Belakangan Malaysia ngeper, karena dalam waktu singkat Indonesia mampu menggerakkan tujuh kapal perangnya ke Ambalat. Apa boleh buat, sikap armada tempur Malaysia di Laut Sulawesi telah membuat geregetan anggota TNI seperti Sersan Kepala Edy Musyawan tadi. Prajurit yang berdinas di Angkatan Laut selama 11 tahun itu mengaku rindu perang. "Kalau Malaysia itu berani jualan, pasti akan kami beli."

Heddy Lugito, Bernadetta Febriana, Luqman Hakim Arifin, dan Alexander Wibisono (Ambalat)
[Laporan Utama, Gatra Nomor 18 Beredar Senin, 14 Maret 2005]

Tuesday, September 7, 2010

Pemimpin, Keberanian, dan Perubahan

Adjie Suradji

Terdapat dua jenis pemimpin cerdas, yaitu pemimpin cerdas saja dan pemimpin cerdas yang bisa membawa perubahan.

Untuk menciptakan perubahan (dalam arti positif), tidak diperlukan pemimpin sangat cerdas sebab kadang kala kecerdasan justru dapat menghambat keberanian. Keberanian jadi satu faktor penting dalam kepemimpinan berkarakter, termasuk keberanian mengambil keputusan dan menghadapi risiko. Kepemimpinan berkarakter risk taker bertentangan dengan ciri-ciri kepemimpinan populis. Pemimpin populis tidak berani mengambil risiko, bekerja menggunakan uang, kekuasaan, dan politik populis atau pencitraan lain.

Indonesia sudah memiliki lima mantan presiden dan tiap presiden menghasilkan perubahannya sendiri-sendiri. Soekarno membawa perubahan besar bagi bangsa ini. Disusul Soeharto, Habibie, Gus Dur, dan Megawati.

Soekarno barangkali telah dilupakan orang, tetapi tidak dengan sebutan Proklamator. Soe- harto dengan Bapak Pembangunan dan perbaikan kehidupan sosial ekonomi rakyat. Habibie dengan teknologinya. Gus Dur dengan pluralisme dan egaliterismenya. Megawati sebagai peletak dasar demokrasi, ratu demokrasi, karena dari lima mantan RI-1, ia yang mengakhiri masa jabatan tanpa kekisruhan. Yang lain, betapapun besar jasanya bagi bangsa dan negara, ada saja yang membuat mereka lengser secara tidak elegan.

Sayang, hingga presiden keenam (SBY), ada hal buruk yang tampaknya belum berubah, yaitu perilaku korup para elite negeri ini. Akankah korupsi jadi warisan abadi? Saatnya SBY menjawab. Slogan yang diusung dalam kampanye politik, isu ”Bersama Kita Bisa” (2004) dan ”Lanjutkan” (2009), seharusnya bisa diimplementasikan secara proporsional.

Artinya, apabila pemerintahan SBY berniat memberantas korupsi, seharusnya fiat justitia pereat mundus—hendaklah hukum ditegakkan—walaupun dunia harus binasa (Ferdinand I, 1503- 1564). Bukan cukup memperkuat hukum (KPK, MK, Pengadilan Tipikor, KY, hingga Satgas Pemberantasan Mafia), korupsi pun hilang. Tepatnya, seolah-olah hilang. Realitasnya, hukum dengan segala perkuatannya di negara yang disebut Indonesia ini hanya mampu membuat berbagai ketentuan hukum, tetapi tak mampu menegakkan.

Quid leges sine moribus (Roma)—apa artinya hukum jika tak disertai moralitas? Apa artinya hukum dengan sedemikian banyak perkuatannya jika moral pejabatnya rendah, berakhlak buruk, dan bermental pencuri, pembohong, dan pemalas?

Keberanian

Meminjam teori Bill Newman tentang elemen penting kepemimpinan, yang membedakan seorang pemimpin sejati dengan seorang manajer biasa adalah keberanian (The 10 Law of Leadership). Keberanian harus didasarkan pada pandangan yang diyakini benar tanpa keraguan dan bersedia menerima risiko apa pun. Seorang pemimpin tanpa keberanian bukan pemimpin sejati. Keberanian dapat timbul dari komitmen visi dan bersandar penuh pada keyakinan atas kebenaran yang diperjuangkan.

Keberanian muncul dari kepribadian kuat, sementara keraguan datang dari kepribadian yang goyah. Kalau keberanian lebih mempertimbangkan aspek kepentingan keselamatan di luar diri pemimpin—kepentingan rakyat—keraguan lebih mementingkan aspek keselamatan diri pemimpin itu sendiri.

Korelasinya dengan keberanian memberantas korupsi, SBY yang dipilih lebih dari 60 persen rakyat kenyataannya masih memimpin seperti sebagaimana para pemimpin yang dulu pernah memimpinnya.

Memang, secara alamiah, individu atau organisasi umumnya akan bersikap konservatif atau tak ingin berubah ketika sedang berada di posisi puncak dan situasi menyenangkan. Namun, dalam konteks korupsi yang kian menggurita, tersisa pertanyaan, apakah SBY hingga 2014 mampu membawa negeri ini betul-betul terbebas dari korupsi?

Pertanyaan lebih substansial: apakah SBY tetap pada komitmen perubahan? Atau justru ide perubahan yang dicanangkan (2004) hanya tinggal slogan kampanye karena ketidaksiapan menerima risiko-risiko perubahan? Terakhir, apakah SBY dapat dipandang sebagai pemimpin yang memiliki tipe kepemimpinan konsisten dalam pengertian teguh dengan karakter dirinya, berani mengambil keputusan berisiko, atau justru menjalankan kepemimpinan populis dengan segala pencitraannya?

Indonesia perlu pemimpin visioner. Pemimpin dengan impian besar, berani membayar harga, dan efektif, dengan birokrasi yang lentur. Tidak ada pemimpin tanpa visi dan tidak ada visi tanpa kesadaran akan perubahan. Perubahan adalah hal tak terelakkan. Sebab, setiap individu, organisasi, dan bangsa yang tumbuh akan selalu ditandai oleh perubahan- perubahan signifikan. Di dunia ini telah lahir beberapa pemimpin negara yang berkarakter dan membawa perubahan bagi negerinya, berani mengambil keputusan berisiko demi menyejahterakan rakyatnya. Mereka adalah Presiden Evo Morales (Bolivia), Ahmadinejad (Iran), dan Hugo Chavez (Venezuela).

Indonesia harus bisa lebih baik. Oleh karena itu, semoga di sisa waktu kepemimpinannya—dengan jargon reformasi gelombang kedua—SBY bisa memberikan iluminasi (pencerahan), artinya pencanangan pemberantasan korupsi bukan sekadar retorika politik untuk menjaga komitmen dalam membangun citranya. Kita berharap, kasus BLBI, Lapindo, Bank Century, dan perilaku penyelenggara negara yang suka mencuri, berbohong, dan malas tidak akan menjadi warisan abadi negeri ini. Sekali lagi, seluruh rakyat Indonesia tetap berharap agar Presiden SBY bisa membawa perubahan signifikan bagi negeri ini.

Adjie Suradji Anggota TNI AU


Terlepas dari melawan adat dan terlepas dari siapakah Adjie Suradji sebenarnya, namun tulisan tersebut semoga menyadarkan pemimpin bangsa ini, untuk membawa Indonesia yang lebih baik, dan berkeadilan sosial.

Tuesday, August 24, 2010

Panglima Besar Tidak Pernah Sakit

KOMPAS.com - Indonesia baru saja merdeka, Belanda ingkar janji. Suara bom pesawat Belanda mengagetkan Panglima Besar Jenderal Sudirman yang dirawat di Rumah Sakit Panti Rapih. Anak buahnya mencoba menenangkan Sudirman, "Itu hanya anak-anak yang sedang latihan perang."

Sudirman baru saja kehilangan satu paru-parunya di meja operasi. Rasa sakit masih menyiksa. Akan tetapi, instingnya sebagai ahli taktik perang berkata, ada yang tidak beres. Sadar negara dalam keadaan genting, Sudirman menemui Presiden Soekarno di Istana Gedung Agung, Yogyakarta.

Di hadapan Soekarno, Sudirman minta izin memulai gerilya untuk menghancurkan mental Belanda. Kala itu, Soekarno melarang, "Kang Mas sedang sakit, lebih baik tinggal di kota". Sudirman menyahut, "Yang sakit Sudirman, Panglima Besar tidak pernah sakit."

Jawaban Sudirman sebelum memulai perang gerilya itu kini dituliskan pada mural berlatar belakang bendera Merah Putih di Museum Pusat TNI Angkatan Darat Dharma Wiratama. Menurut Kepala Seksi Pemandu dan Pameran Museum Mayor Riko Sahani, bangunan museum ini dulunya merupakan markas besar Tentara Keamanan Rakyat (TKR) saat perang kemerdekaan.

Keterbatasan fisik tak menyurutkan niat Sudirman memimpin perang gerilya. Bertolak dari rumah dinasnya di kawasan Bintaran yang kini jadi Museum Panglima Besar Jenderal Sudirman, satu kompi pasukan (80 tentara) dibawa. Demi keamanan, keluarganya dititipkan di lingkungan Keraton Yogyakarta.

Lahir

Sesaat setelah merdeka, Indonesia yang baru lahir mendapat cobaan bertubi-tubi. Pemberontakan pecah di mana-mana, tentara sekutu yang diboncengi Belanda kembali menancapkan kuku penjajahannya. Di tengah kekacauan itulah, rantai komando perang lahir dari Yogyakarta.

Berawal dari inisiatif Letnan Jenderal Urip Sumoharjo yang melontarkan keprihatinan "alangkah lucunya negara tanpa tentara" maka dibentuk TKR yang menjadi cikal bakal lahirnya Tentara Nasional Indonesia. Melalui konferensi besar TKR pada 12 November 1945, untuk pertama kalinya, Indonesia memiliki pucuk pimpinan tertinggi angkatan perang.

Setelah mengusir tentara sekutu di Ambarawa pada Oktober 1945, Kolonel Sudirman dilantik menjadi Pimpinan Tertinggi TKR, sedangkan Urip Sumoharjo menjadi Kepala Staf Umum yang meletakkan dasar organisasi TNI. Pelantikan dilaksanakan pada 18 Desember 1945.

Dari markas besar TKR di Yogyakarta, terpancar kesatuan komando ke seluruh Tanah Air dalam mempertahankan kemerdekaan yang mulai terancam tentara Belanda maupun pemberontakan dari dalam negeri. Perang di bawah rantai komando Sudirman, antara lain, adalah perang atau palagan di Bandung yang dikenal sebagai Bandung Lautan Api. Bandung dibumihanguskan saat melawan sekutu dan Belanda November 1945-24 Maret 1946.

Perang lain di bawah komando markas besar TKR di Yogyakarta adalah Palagan Surabaya di bawah pimpinan Bung Tomo yang kini diperingati sebagai Hari Pahlawan 10 November. Beberapa kali pemberontakan mulai dari PKI Muso di Madiun, DI/TII di Jawa Tengah, hingga RMS di Maluku berhasil dipadamkan.

Selama perang gerilya Desember 1948-10 Juli 1949, Sudirman juga memegang rantai komando untuk serangan umum 1 Maret 1949 yang dipimpin Letnan Kolonel Soeharto.

Melalui serangan umum, tentara berhasil menguasai kembali Yogyakarta selama enam jam. Dunia menyaksikan, Indonesia masih ada dan PBB mendesak Belanda membuka jalan perundingan melalui Konferensi Meja Bundar yang berisi pengakuan terhadap kedaulatan Indonesia.

Meski tidak banyak meninggalkan catatan di wilayah yang dilintasi seperti di Bantul, perjalanan gerilya Sudirman menjadi spirit tersendiri bagi masyarakat. "Semangat dan kegigihannya tetap berjuang meski sakit seharusnya terus diteladani," ujar Kepala Dinas Kebudayaan dan Pariwisata Bantul Suyoto. (ENY/WKM)

Thursday, August 19, 2010

PITR postgresql

If the standard methods can't be used (for ex, if the database is too big for a complete dump), another method can be used: WAL archiving.

This page describes how to use WAL archiving and PITR on an example database.
Backup ¶

The setup procedure is the following:

* Configure PITR recovery by defining an archive_command
* Restart the cluster to start WAL archiving

To make a backup:

* Connect to the database and run the pg_start_backup('label') function
* Backup the entire cluster (without stopping it)
* Connect to the database and run the pg_stop_backup() function

(Intro) WAL files ¶

At all times, postgresql maintains a WAL (write-ahead log) in the pg_xlog subdirectory of the cluster. These files are primarily used for crash-safety purposes: each operation on the database is logged in a WAL file (with a default limit of 16 MB). By default, WAL files are recycled. However, if postgresql is configured to continuously log all operations, these files can be used for backups, acting exactly like incremental backups. This has some benefits:

* Backups does not need to be perfectly consistent: you need a backup of the cluster, and some WAL files
* A complete dump of the database is not needed
* Incremental
* Continuous
* Point in time recovery: it is possible to restore the database at its state at any time since the backup

However, there are some drawbacks:

* Additional complexity
* Needs lots of space on disk
* More writes on disk (can impact performance)
* Works on the entire cluster

PITR is generally not needed: you should prefer using dumps when possible. PITR can be used for large databases, continuous backups, or high-availability.

Before trying to use PITR, you should practise, and test on a non-critical database.
Enabling WAL archiving ¶

We will configure postgresql to archive WAL files when they are complete, instead of recycling them.
(Option) Creating a test cluster ¶

Since we don't want to crash our production server, we'll create a test cluster.

# mkdir /bigstuff/pgPITR
# chown postgres:postgres /bigstuff/pgPITR
# su - postgres

$ export PGDATA=/bigstuff/pgPITR
$ /usr/lib/postgresql/8.2/bin/initdb
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale C.

fixing permissions on existing directory /bigstuff/pgPITR ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers/max_fsm_pages ... 32MB/204800
creating configuration files ... ok
creating template1 database in /bigstuff/pgPITR/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating conversions ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.

Success. You can now start the database server using:

/usr/lib/postgresql/8.2/bin/postgres -D /bigstuff/pgPITR
or
/usr/lib/postgresql/8.2/bin/pg_ctl -D /bigstuff/pgPITR -l logfile start

Add archive_command ¶

Edit your configuration file to add archive_command. This command can do anything you want (from a simple copy to a complex script), just remember to return 0.

For our test, we will copy files to a directory in /tmp. Stop the server, and edit the configuration:

$ vi $PGDATA/postgresql.conf
archive_command = 'cp %p /tmp/wals/%f'

Restart the server.

PostgreSQL will now work as usuel, creating WAL files in its pg_xlog subdirectory. However, when they are complete, it will copy them to the /tmp/wals/ directory.
(Option) Create a test database ¶

$ /usr/lib/postgresql/8.2/bin/pg_ctl -l /tmp/pg.log start
server starting

$ createdb test
CREATE DATABASE

$ psql test
[...]
test=# BEGIN WORK;
BEGIN
test=# CREATE TABLE dummy1 AS SELECT * FROM pg_class, pg_attribute;
SELECT
test=# COMMIT;
COMMIT
test=# select pg_size_pretty(pg_relation_size('dummy1'));
pg_size_pretty
----------------
97 MB
(1 row)
test=# \q

At this point, PostgreSQL should have archiving some files:

$ ls -al /tmp/wals/
total 98402
drwxr-xr-x 2 postgres postgres 288 Jan 6 15:00 .
drwxrwxrwt 24 root root 2304 Jan 6 14:59 ..
-rw------- 1 postgres postgres 16777216 Jan 6 15:00 000000010000000000000009
-rw------- 1 postgres postgres 16777216 Jan 6 15:00 00000001000000000000000A
-rw------- 1 postgres postgres 16777216 Jan 6 15:00 00000001000000000000000B
-rw------- 1 postgres postgres 16777216 Jan 6 15:00 00000001000000000000000C
-rw------- 1 postgres postgres 16777216 Jan 6 15:00 00000001000000000000000D
-rw------- 1 postgres postgres 16777216 Jan 6 15:00 00000001000000000000000E

Backup the cluster ¶

You need to backup the cluster directory. You can use any method you want (tar, cpio, bacula, etc). to backup the cluster directory ($PGDATA).

Note: you don't need to stop the cluster or take extra precautions.

For our example, we'll just create a tar archive. Before doing so, we just need to inform postgresql that we will create a backup using the command pg_start_backup.

$ psql test
[...]
test=# SELECT pg_start_backup('full backup');
pg_start_backup
-----------------
0/F74F118
(1 row)

test=# \q

$ tar -cvzf /tmp/pgdata.tgz $PGDATA

$ psql test
[...]
test=# SELECT pg_stop_backup();
pg_stop_backup
----------------
0/F74F118
(1 row)

test=# \q


The argument of pg_start_backup is simply a label that helps you. This will be stored in file $PGDATA_backup_label.
(option) create some tables ¶

Create one more table:

test=# BEGIN;
BEGIN
test=# CREATE TABLE dummy2 AS SELECT * FROM pg_class, pg_attribute;
SELECT
test=# COMMIT;
COMMIT

If you want to test PITR, create a table dummy3:

test=# BEGIN;
BEGIN
test=# CREATE TABLE dummy3 AS SELECT * FROM pg_class, pg_attribute;
SELECT
test=# COMMIT;
COMMIT
test=# BEGIN;
BEGIN

wait some time (remember the exact time !), then drop it:

test=# DROP TABLE dummy3;
DROP TABLE
test=# COMMIT;
COMMIT
test=# \q

(option) simulate disaster ¶

.. or just wait for it to happen ..

Here, we'll just kill brutally the server:

$ kill -9 $(head -1 $PGDATA/postmaster.pid)

Recovery ¶

At this point, your database must be stopped.

The procedure is the following:

* If possible, get data from the damaged cluster
* Restore the complete cluster backup from the archive
* Clean up the restored cluster (remove pg_xlog files and the pid file)
* If possible, copy WAL files from the damaged cluster to the restored cluster
* Create the $PGDATA/recovery.conf file
* Start the cluster
* Watch the logs, then verify the restored data

Old cluster ¶

First, we need to try to recover data from the old cluster. If it is not possible, you will still be able to recover data from you backup, but you will maybe lost data from the most recent (unarchived) WAL file.

Here, we will just rename it:

$ mv $PGDATA $PGDATA.old

Restore the cluster ¶

Restore the cluster using your favorite method.

For our example, we'll use the tar archive:

$ (cd / && tar xvzf /tmp/pgdata.tgz)
$ chmod 0700 $PGDATA

Clean up the restored directory:

$ rm $PGDATA/pg_xlog/0*
$ rm $PGDATA/postmaster.pid

Restore WAL files from the old cluster ¶

If available, you can copy the WAL files from the pg_xlog subdirectory of the damaged cluster:

$ cp -a $PGDATA.old/pg_xlog $PGDATA/

Create a recovery file ¶

Create a new file $PGDATA/recovery.conf. The only required line is restore_command:

restore_command = 'cp /tmp/wals/%f %p'
recovery_target_time = '2008-01-06 15:18:00 CET'

The recovery target time allows you to recover the most recent data (if you do not specify recovery_target_time) or at a precise time.

If you removed WAL files after archiving them from the directory (/tmp/wals), you should restore them as well.
Start the database, and witness the miracle ¶

Start the database:

$ /usr/lib/postgresql/8.2/bin/pg_ctl -l /tmp/pg.log start
server starting

PostgreSQL will detect the file recovery.conf, and start automatic recovery:

$ tail -f /tmp/pg.log
LOG: database system was interrupted at 2008-01-06 15:01:57 CET
LOG: starting archive recovery
LOG: restore_command = "cp /tmp/wals/%f %p"
LOG: recovery_target_time = 2008-01-06 15:31:00+01
cp: cannot stat `/tmp/wals/00000001.history': No such file or directory
LOG: restored log file "00000001000000000000000F.0074F118.backup" from archive
LOG: restored log file "00000001000000000000000F" from archive
LOG: checkpoint record is at 0/F74F118
LOG: redo record is at 0/F74F118; undo record is at 0/0; shutdown FALSE
LOG: next transaction ID: 0/618; next OID: 24582
LOG: next MultiXactId: 1; next MultiXactOffset: 0
LOG: automatic recovery in progress
LOG: redo starts at 0/F74F168
LOG: restored log file "000000010000000000000010" from archive
LOG: restored log file "000000010000000000000011" from archive
LOG: restored log file "000000010000000000000012" from archive
LOG: restored log file "000000010000000000000013" from archive
LOG: restored log file "000000010000000000000014" from archive
LOG: restored log file "000000010000000000000015" from archive
LOG: restored log file "000000010000000000000016" from archive
LOG: restored log file "000000010000000000000017" from archive
LOG: restored log file "000000010000000000000018" from archive
LOG: restored log file "000000010000000000000019" from archive
LOG: restored log file "00000001000000000000001A" from archive
LOG: restored log file "00000001000000000000001B" from archive
LOG: restored log file "00000001000000000000001C" from archive
cp: cannot stat `/tmp/wals/00000001000000000000001D': No such file or directory
LOG: could not open file "pg_xlog/00000001000000000000001D" (log file 0, segment 29): No such file or directory
LOG: redo done at 0/1CFFFD70
LOG: restored log file "00000001000000000000001C" from archive
LOG: archive recovery complete
LOG: database system is ready

If you specified the correct recovery_target_time, you will be able to restore your database just at the moment before dropping the table dummy3:

test=# \d
List of relations
Schema | Name | Type | Owner
--------+--------+-------+----------
public | dummy1 | table | postgres
public | dummy2 | table | postgres
public | dummy3 | table | postgres
(3 rows)

After recovery, PostgreSQL will rename recovery.conf to recovery.done.