Thursday, September 25, 2008

Performance : Alternative PHP Cache (APC)

1. yum install php-pecl-apc

If for some reason centosplus repo is not enabled then:
1. cd /usr/src/
2. wget http://pecl.php.net/get/APC-3.0.19.tgz
3. tar xvzf APC-3.0.19.tgz
4. cd APC-3.0.19
5. yum install php-devel
6. yum install automake
7. yum install libtool httpd-devel*
8. /usr/bin/phpize
9. ./configure --enable-apc --enable-apc-mmap --with-apxs --with-php-config=/usr/bin/php-config
10. make
11. make install
12. ls /usr/lib64/php4/ or /usr/lib64/php/modules/
13 #emacs /etc/php.ini
extension=apc.so
apc.enabled=1
apc.shm_segments=1
apc.shm_size=128
apc.ttl=7200
apc.user_ttl=7200
apc.num_files_hint=1024
apc.mmap_file_mask=/tmp/apc.XXXXXX
apc.enable_cli=1

Monday, September 15, 2008

Understanding LVM

LVM terminology:
a. Physical Volume (PV) : A PV is nothing more than a physical medium with some administrative data added to it - once you have added this, LVM will recognise it .
b. Physical Extents (PE) :- Physical Extents are like really big blocks, often with a size of megabytes.
c. Volume Group (VG) - A VG is made up of a number of Physical Extents (which may have come from multiple Physical Volumes or hard drives). While it may be tempting to think of a VG as being made up of several hard drives (/dev/hda and /dev/sda for example), it's more accurate to say that it contains PEs which are provided by these hard drives.
d. Logical Volumes (LV) - A logical volume functions like a normal partition -- it have a filesystem such as Ext3, and a mount point. From , Volume Group, PEs can be assigned to a logical Volume (LV).

Creating Physical volumes:
#pvcreate /dev/sda3

Multiple physical volumes
#pvcreate /dev/sda9 /dev/sda10


Creating a volume group:
#vgcreate home2 /dev/sda3

Multiple physical volumes to make up a volume group
#vgcreate home3 /dev/sda9 /dev/sda10

Creating logical volume:
#lvcreate --size 1G -n downloads home2
now,
#mkfs.ext3 /dev/home2/downloads
#mkdir /home/downloads
#mount -t ext3 /dev/home2/downloads /home/downloads
Add a line to the /etc/fstab file
/dev/home2/downloads /home/downloads ext3 defaults 1 2

Resizing logical volumes:
#umount /home/downloads
#lvextend -L +1G /dev/home2/downloads
#resize2fs /dev/home2/downloads

Similar to the lvextend there is the lvreduce command:
#lvreduce -L -500M /dev/home2/downloads
#resize2fs /dev/home2/downloads

Modifying volume groups:
a. unmount the logical volumes within your volume group.
b. #vgextend home2 /dev/sda5 /dev/sda7
(The volume group home2 is now made up of sda3, sda5, and sda7)

Remove a volume group
a. Unmount your logical volume
b. #vgremove home2

A Physical Volume, containing Physical Extents:

+-----[ Physical Volume ]------+
| PE | PE | PE | PE | PE | PE |
+------------------------------+

A Volume Group, containing 2 Physical Volumes (PVs) with 6 Physical Extents:

+------[ Volume Group ]-----------------+
| +--[PV]--------+ +--[PV]---------+ |
| | PE | PE | PE | | PE | PE | PE | |
| +--------------+ +---------------+ |
+---------------------------------------+

We now further expand this:

+------[ Volume Group ]-----------------+
| +--[PV]--------+ +--[PV]---------+ |
| | PE | PE | PE | | PE | PE | PE | |
| +--+---+---+---+ +-+----+----+---+ |
| | | | +-----/ | | |
| | | | | | | |
| +-+---+---+-+ +----+----+--+ |
| | Logical | | Logical | |
| | Volume | | Volume | |
| | | | | |
| | /home | | /var | |
| +-----------+ +------------+ |
+---------------------------------------+


You can use the lvdisplay command see logical vloume's status.

http://www.ibm.com/developerworks/library/l-lvm2/index.html

http://www.linux.com/feature/11864

Roaming Profile on samba with PDC controller, windows as client

1. Make these change in samba configuration file : emacs /etc/samba/smb.conf
Important terms to understand
a. wins support = yes
b. domain master = yes
c. netbios name = samba
d. workgroup = OFFICE
e. domain logons = yes

2. Samba root access
#smbpasswd -a

3. Add new user :
#useradd prabhat (adding linux user)
#passwd prabhat
#smbpasswd -a prabhat (converting linux user into samba user)

4. On the windows machine,Aadd window machine in 'OFFICE' domain of samba.
On desktop, Right click on "My Computer" -> "properties" -> "Network identificatation" tab -> "change"
while joing it will ask for username password "root" & "OFFICE" (see serial no 2.)


Important Points:
1. There will be one and only one PDC over network.
2. The machine name must be unique over network.
3. While login from client domain name must be 'OFFICE'


#emacs /etc/samba/smb.conf
[global]
log file = /var/log/samba/%m.log
log level = 2
load printers = yes
idmap gid = 16777216-33554431
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
winbind use default domain = no
template shell = /bin/false
wins support = yes
dns proxy = no
netbios name = samba
domain master = yes
preferred master = yes
cups options = raw
server string = Samba PDC
idmap uid = 16777216-33554431
workgroup = OFFICE
os level = 64
domain logons = yes
add user script = /usr/sbin/useradd -m '%u'
delete user script = /usr/sbin/userdel -r '%u'
add group script = /usr/sbin/groupadd '%g'
delete group script = /usr/sbin/groupdel '%g'
add user to group script = /usr/sbin/usermod -G '%g' '%u'
set primary group script = /usr/sbin/usermod -g '%g' '%u'
add machine script = /usr/sbin/useradd -s /bin/false -d /dev/null '%u'
logon script = scripts\logon.bat
passdb backend = tdbsam
printcap name = /etc/printcap
security = user
max log size = 50
hosts allow = 10.1.

[homes]
comment = Home Directories
valid users = %S
browseable = No
writable = Yes

# Un-comment the following and create the netlogon directory for Domain Logons
[netlogon]
comment = Network Logon Service
logon path = \\%L\profiles\%U
logon home = \\%L\%U\.9xprofile
logon drive = p:
browseable = no
writable = no
; share modes = no


Concept:
http://searchenterpriselinux.techtarget.com/tip/0,289483,sid39_gci1151921,00.html
Practial Implement:
http://searchenterpriselinux.techtarget.com/tip/0,289483,sid39_gci1151926,00.html
Read section : "Joining" a Samba Domain
http://www.rmschneider.com/writing/xp_and_samba.html

SHOW ENGINE INNODB STATUS

  The SHOW ENGINE INNODB STATUS command in MySQL provides detailed information about the internal state of the InnoDB storage engine. This ...