Wednesday, November 23, 2011

How To Install and configure Varnish Cache in ubuntu

Install & Configure Varnish on Ubuntu Lucid Linux

I decided to install Varnish on an Ubuntu 10.04 Lucid Linux machine.
1. Install Varnish
2. Edit the /etc/varnish/default.vcl file
3. Edit the /etc/default/varnish file
4. Edit apache settings
5. Restart Apache and Varnish
6. Useful commands and information

1. Install Varnish

sudo apt-get install varnish

2. Edit the /etc/varnish/default.vcl file

This is where we tell varnish where to find content. I want varnish to find content on the local machine on port 8080, or basically where to find the webserver. By default apache listens on port 80 so we will need to change the apache settings later on. Edit the /etc/varnish/default.vcl file and change the contents as shown.


backend default {
.host = "127.0.0.1";
.port = "8080";
}

3. Edit the /etc/default/varnish file

This file contains varnish’s startup settings. The default set up is mostly fine. The main thing here is to tell varnish which port to listen on and how much RAM it can use. I want varnish to listen on port 80 and use 128M of RAM.



DAEMON_OPTS="-a :80 \
-T localhost:6082 \
-f /etc/varnish/default.vcl \
-S /etc/varnish/secret \
-s file,/var/lib/varnish/$INSTANCE/varnish_storage.bin,128M"

4. Edit apache settings

You must edit /etc/apache/ports.conf file and ensure apache will now listen on port 8080. If you have a vhosts setup you must also change which port the vhosts listen on.

So /etc/apache/ports.conf should look like this


NameVirtualHost *:8080
Listen 8080
.....

Change /etc/apache2/sites-available/default to also listen on port 8080, and do the same for any vhosts in this directory.


NameVirtualHost *:8080
Listen 8080
.....

Example vhosts



ServerName mormanski.net
.....

5. Restart Apache and Varnish

Restart apache.
sudo /etc/init.d/apache2 restart
And start Varnish too.
sudo /etc/init.d/varnish start

6. Useful commands and information

This netstat command will tell you which ports are open
netstat -anp --tcp --udp | grep LISTEN

You can use varnishlog to see what’s happening in real time
varnishlog

Friday, October 21, 2011

How to make Volume size more then 2 TB in Openfiler

Go to "Volumes" and then "Block Devices". For your 4TB volume, what is the label type? If it says "msdos", as I said, you cannot have a "msdos" partition table and use more than 2TB. If it says "gpt" then you may have hit upon a bug.

If it says "msdos" then do the following:
- Remove any volumes, volume groups, physical partitions, etc. that you created on that disk.
- Open a command prompt
- Run "parted /dev/sda" (substitute the appropriate device name)
- Type "print" (you should see the total size of the disk and the label type)
- Type "mklabel gpt"
- Type "print" (to make sure that the label has changed)
- Type "q" (to quit)
- Close the command prompt

Back in the web admin, refresh the "Block Devices" page and see if it now shows a label of "gpt". If it does, create your physical partition, volume group, etc. If it doesn't, reboot.

See forum discussion on following link
https://forums.openfiler.com/viewtopic.php?id=2084

Thursday, October 20, 2011

WAKE ON LAN

1...Enable Wake on LAN in BIOS

2...Download software from http://www.matcode.com/mc-wol.exe and
     save it into c:\>MAC-WOL.exe

3...Run following command

C:\>MC-WOL.exe (mac address of target computer)
i.e
C:\>MC-WOL.exe 00:0e:0c:06:93:b5

You will see that target PC will be Power ON

Sunday, October 9, 2011

How to Install Vcentre Server 4.1

vCentre Server 4.1 required
1..Static IP
2...NET Framwork
( in windows server 2008 you can Install .NET Framwork by going Feature in Server Manager)
 


Watch Following video



http://www.youtube.com/watch?v=8Oz91xYcs5k&feature=related


2...When you are adding Host in vCentre You can use root as host  user

Tuesday, October 4, 2011

OCFS2 + ISCSI Centralized storage in Ubuntu 10.10

In this article I will mention the steps to mount an ISCSI target on two ubuntu machines and then cluster it using oracle clustered file system. The newly mounted partition can be used as a centralized storage location in High availability, Failover or load-balancing setup.

The step by step howto is provided below,

1) Setup an ISCSI Server using Openfiler and create SAN LUN, and assign the IP 192.168.1.11 to it.

For setting up openfiler based ISCI target, you can refer steps 1 to 8 mentioned in the url pasted below.

http://www.techhead.co.uk/how-to-configure-openfiler-v23-iscsi-storage-for-use-with-vmware-esx

2) Setup two servers with Ubuntu 10.10 in it.
server1 ==> name: heuristics –> IP 192.168.1.30
server2 ==> name: heuristics2 –> IP 192.168.1.32

3) Install open-iscsi tool in both servers
apt-get install open-iscsi open-iscsi-utils
/etc/init.d/open-iscsi start

4) List out the ISCSI targets available in both servers.
iscsiadm -m discovery -t sendtargets -p 192.168.1.11

In my case the above command produced the following output,
root@heuristics2:~# iscsiadm -m discovery -t sendtargets -p 192.168.1.11
192.168.1.11:3260,1 iqn.2006-01.com.openfiler:tsn.0d0c0c810c57
root@heuristics2:~#

5) Mount the ISCSI target “iqn.2006-01.com.openfiler:tsn.0d0c0c810c57″(Lets call it TG57) to the local machine
iscsiadm -m node -T iqn.2006-01.com.openfiler:tsn.0d0c0c810c57 -p 192.168.1.11 –login

6) Step5 will make the iscsi target TG57 as a device to the system. Which can be viewed as a block device.
root@heuristics# fdisk -l


Disk /dev/sdb: 1073 MB, 1073741824 bytes
34 heads, 61 sectors/track, 1011 cylinders
Units = cylinders of 2074 * 512 = 1061888 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0003f05c

Device Boot Start End Blocks Id System
/dev/sdb1 1 1011 1047383 83 Linux

7) Install OCFS2 – Oracle Cluster File System for Linux
apt-get install ocfs2 ocfs2-tools
if you unable to install then you can also install ocfs2 & ocfs2-tool by using "synaptic" in ubuntu

Configure OCFS2

Create a configuration file with proper indendation and copy it to both the servers. In my case “ocfs2″ is the cluster name.

root@heuristics:~# cat /etc/ocfs2/cluster.conf
node:
ip_port = 7777
ip_address = 192.168.1.30
number = 0
name = heuristics
cluster = ocfs2

node:
ip_port = 7777
ip_address = 192.168.1.32
number = 1
name = heuristics2
cluster = ocfs2

cluster:
node_count = 2
name = ocfs2
root@heuristics:~#

If proper indentation is not provided the following error will be shown,
Starting cluster oracle: Failed
o2cb_ctl: Unable to load cluster configuration file “/etc/ocfs2/cluster.conf”
Stopping cluster oracle: Failed
o2cb_ctl: Unable to load cluster configuration file “/etc/ocfs2/cluster.conf”

9) Start the cluster service in both the machines
/etc/init.d/ocfs2 start
/etc/init.d/o2cb start
/etc/init.d/o2cb enable


10) Create one partition named /dev/sdb1 in the ISCSI target
fdisk /dev/sdb

(to ensure that /dev/sdb is the target)

shell> fdisk /dev/sdb
at the fdisk prompt, run the following key sequence:
o to create a new partition table
n to create a new partition
p to create a primary partiton
1 to create it as the first partition
[enter] twice to accept default first and last cylinders
t to autoselect only partition (what we just created) and change type
8e to change the type to Linux LVM
w to write the changes to the partition table and exit fdisk


11) Make ocfs cluster file system using the following command(need to execute only on one machine)
mkfs.ocfs2 -b 4k -C 32k -N3 -L cluster-storage /dev/sdb1

This creates a file system with 4096 block size and 32768 (32k) cluster size.
NOTE: N= 3 , for a cluster with 2 machines, N=3 and for a cluster with ‘n’ machines N=(n+1)

12) Update partition table on all servers in the cluster. In this case all the servers have /dev/sdb as the iSCSI target.

We will run the following to re-read the partition:
blockdev –rereadpt /dev/sdb

Next, we will want to create a mount point on the servers for this cluster.
mkdir /mycluster

Mount the partition,
mount -L cluster-storage /cluster-storage

13) Show results and test
root@heuristics2:~# hostname
heuristics2
root@heuristics2:~# df -TH /cluster-storage/
Filesystem Type Size Used Avail Use% Mounted on
/dev/sdb1 ocfs2 1.1G 330M 744M 31% /cluster-storage
root@heuristics2:~#
root@heuristics:~# hostname
heuristics
root@heuristics:~# df -TH /cluster-storage/
Filesystem Type Size Used Avail Use% Mounted on
/dev/sdb1 ocfs2 1.1G 330M 744M 31% /cluster-storage
root@heuristics:~#



ORIGINAL LINK OF THIS TUTORIAL with Thanks
http://jackal777.wordpress.com/2011/08/10/ocsf2-iscsi-centralized-storage-in-ubuntu-10-10/#comment-69


REFERENCE

http://www.idevelopment.info/data/Unix/Linux/LINUX_ConnectingToAniSCSITargetWithOpen-iSCSIInitiatorUsingLinux.shtml

http://knowledgelayer.softlayer.com/questions/265/Can+I+connect+multiple+servers+to+a+single+iSCSI+LUN%3F


Tuesday, June 28, 2011

How to connect mysql database from joomla web server on local network

SITUATION

you have 2 Server one is joomla web server(192.168.1.52) and 2nd is database server (192.168.1.51)

Now you want to connect your joomla webserver to database server.Install Ubuntu server 10.10 in both server and also install LAMP with openSSH server with Client.
Connect with same local area network.

Step -1 (in database server)

configure mysql configuration file by typing following command:

sudo nano /etc/mysql/my.cnf

Make sure line skip-networking is commented (or remove line) and add following line

bind-address=192.168.1.51 (YOUR-DATABASE SERVER-IP)

now save and Close the file then reboot the server

Step-2 (In database server)

Grant access to a new database

Connect mysql localy by typing following command

mysql -u root -p mysql

If you want to add a new database called shah for user joomla and remote IP 192.168.1.52 then you need to type the following commands at mysql> prompt:

mysql> CREATE DATABASE shah;
mysql> GRANT ALL ON shah.* TO joomla@'192.168.1.52' IDENTIFIED BY 'PASSWORD';

How Do I Grant Access To An Existing Database?Let us assume that you are always making connection from joomla web server IP called 192.168.1.52 for database called shah for user joomla, To grant access to this IP address type the following command At mysql> prompt for existing database, enter:

mysql> update db set Host='192.168.1.52' where Db='shah';
mysql> update user set Host='192.168.1.52' where user='joomla';


Type exit command to logout mysql:

mysql> exit

you can also do this by phpmyadmin

just use following setting while making new database in phpmyadmin

user name = joomla (you can use your own name)
password = password (you can use your own)
host = any host (you can also put here your joomla webserver static ip so only your web server will be able to access in your local net)
Priveliges = check all (check all and Grant all Access)

Step-3 (In joomla web server)

Test your database connecting properly.

mysql -u joomla –h 192.168.1.51 –p


Where,
-u joomla: joomla is MySQL username
-h IP or hostname: 192.168.1.51 is MySQL server IP address or hostname (FQDN)
-p : Prompt for password

Step-4 (In Joomla web server)

You can now install joomla into your joomla web server (192.168.1.52)
and put database server ip address(192.168.1.51) in host filed

Lets assume that you want to connect another server called audio.joomla.com so
you just copy and past your joomla installed folder i.e. /var/www
into new server in the folder /var/www
and chenge the configuration.php file as follows:

host = 192.168.1.51 (your database server ip)