Archive for » 2010 «

AWStats for Network Load Balanced websites

INSTALL AND CONFIGURE STATISTICS FOR LOAD BALANCED IIS SITES-

Ingredients-

* In this scenario I’m going to use the following things-

# 3 NLB nodes – 2K31 (IP- 192.168.1.129), 2K32 (IP- 192.168.1.130), 2K33 (IP- 192.168.1.131)

# A server for stats installation – 2K34 (IP- 192.168.1.132)

# Statistics – AWStats (download from http://awstats.sourceforge.net). I used AWStats 6.8 version.

# Website for testing – www.a-r-u-n.com (must be setup in all the above 3 NLB nodes)

# Stats website in 2K34. I’m going to use server’s IP itself for testing.

Preparation-

1. Install AWStats 6.8 in the server 2K34 in the following location – C:\AWStats.

2. During installation it prompts you to specify the location of apache installation. Specify ‘none’ since this one is for IIS-

—–> Running OS detected: Windows

—–> Check for web server install

awstats_configure did not find your Apache web main runtime.

Please, enter full directory path of your Apache web server or ‘none’ to skip this step if you don’t have local web server or don’t have permission to change its setup.

Example: c:\Program files\apache group\apache

Apache Web server path (‘none’ to skip):

> none

3. Next step is it will ask to create a new config file for website, specify ‘y’-

—–> Need to create a new config file ?

Do you want me to build a new AWStats config/profile

file (required if first install) [y/N] ? y

4. It then asks you to specify the name of the website for config file. Specify the website name-

—–> Define config file name to create

What is the name of your web site or profile analysis ?

Example: www.mysite.com

Example: demo

Your web site, virtual server or profile name:

> a-r-u-n.com

5. Press Enter to complete the installation of AWStats.

6. Create the data directory called ‘Data’ under the following location C:\AWStats\ and assign modify permission to the following objects – Network Service, web user(IUSR).

7. Now open the config file ‘awstats.a-r-u-n.com.conf’ located under ‘cgi-bin’ folder (in my case – C:\AWStats\wwwroot\cgi-bin).

8. Search for ‘LogFile’ section. You need to specify the path where log files are created for the website.

Note – Since this configuration is for websites hosted in Load Balanced servers the format for ‘LogFile’ differs from the usual log format. There are two options available to generate logs for websites-

a. Copy all the log files from log folders of a-r-u-n.com from all the 3 nodes to the location in local server. In this case, I copied from \\2K31\C$\Domains\a-r-u-n.com\logs\W3SVC100\*.log to C:\Logs\a-r-u-n.com\2K31\*.log for 1st node. \\2K32\C$\Domains\a-r-u-n.com\logs\W3SVC190\*.log to C:\Logs\a-r-u-n.com\2K32\*.log for 2nd node. And \\2K33\C$\Domains\a-r-u-n.com\logs\W3SVC150\*.log to C:\Logs\a-r-u-n.com\2K33\*.log for 3rd node. Now all the 3 nodes’ log files for a-r-u-n.com have been copied to the location in local server – C:\Logs\a-r-u-n.com\ in 2K34. Now we need to merge all the above 3 nodes’ log files into one file using a perl tool called logresolvemerge.pl which ships with AWStats installation. This can be found in C:\AWStats\tools\logresolvemerge.pl. To merge all the log files to a single file, perform these steps-

1. Goto command prompt and to C:\AWStats\tools\ and type the following command –

perl logresolvemerge.pl C:\Logs\a-r-u-n.com\2K31\ex*.log C:\Logs\a-r-u-n.com\2K32\ex*.log C:\Logs\a-r-u-n.com\2K33\ex*.log > C:\Logs\a-r-u-n.com\all.log

2. Now you will see all the nodes’ log files have been merged to a single log file at C:\Logs\a-r-u-n.com\all.log

3. Now specify this log file path ‘C:\Logs\a-r-u-n.com\all.log’ under the ‘LogFile’ section in ‘awstats.a-r-u-n.com.conf’. This will looks like-

LogFile=”C:/Logs/a-r-u-n.com/all.log”

b. Second option is to specify UNC share path in config file. Note down the UNC share path of all the nodes for a-r-u-n.com (\\2k31\C$\Domains, \\2k32\C$\Domains and \\2k33\C$\Domains). Create a map networked drive for the above UNC shares. Say ‘G’ drive mapped to \\2k31\C$\Domains and ‘H’ drive mapped to \\2k32\C$\Domains and ‘I’ drive mapped to \\2k33\C$\Domains respectively. Now you can access those log files directly by G:\a-r-u-n.com\logs\W3SVC100\*.log for 2K31 server and H:\a-r-u-n.com\.. for 2K32 server and so on. Now open the config file ‘awstats.a-r-u-n.com.conf’ and look for ‘LogFile’ section. Specify the following-

LogFile=”perl C:/AWStats/tools/logresolvemerge.pl G:/a-r-u-n.com/logs/W3SVC100/ex*.log H:/a-r-u-n.com/logs/W3SVC190/ex*.log I:/arun1.com/log/W3SVC150/ex*.log |”

By specifying the above format in config file of a-r-u-n.com AWStats generates stats automatically during update the process. This is most suited in the environment where the log files are too large and you need to save space. Also this is time saver.

o Note – First option is time consuming and requires human intervention for exporting each and every logs. Where as second option is easier and can be specified only in config file and stats generation is automated during rebuild process.

9. Now you need to specify the log format for your website. Simply copy the format to config file from the top of the web log file(exmmddyy.log) if you not sure about the exact LogFormat of your web sites. (Note – Websites in each nodes must have same ‘Logging options’ enabled in IIS, this can be confirmed by right clicking web site properties > Logging Properties > in General and Advanced tab make sure that particular website in all the nodes have same settings)-

#Software: Microsoft Internet Information Services 6.0

#Version: 1.0

#Date: 2010-08-31 14:39:06

#Fields: date time s-sitename s-computername s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs-version cs(User-Agent) cs(Cookie) cs(Referer) cs-host sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken

Copy the fields so that it looks like this-

LogFormat= “date time s-sitename s-computername s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs-version cs(User-Agent) cs(Cookie) cs(Referer) cs-host sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken”

10. Please specify DirData path in ‘DirData’ section as C:\AWStats\Data which you created in step 6 so that AWStats will store the result of stats analysis in AWStats files.

11. Now you need to update the stats in order to view it as GUI from web browser. To do this goto command prompt to the location – C:\AWStats\wwwroot\cgi-bin and key in the following command-

perl awstats.pl -config=www.a-r-u-n.com –update

You will see the result like this-

C:\AWStats\wwwroot\cgi-bin>perl awstats.pl -config=www.a-r-u-n.com -update

Create/Update database for config “./awstats.www.a-r-u-n.com.conf” by AWStats version 6.8 (build 1.910)

From data in log file “perl C:/AWStats/tools/logresolvemerge.pl G:/a-r-u-n.com/logs/W3SVC100/ex*.log H:/a-r-u-n.com/logs/W3SVC190/ex*.log I:/arun1.com/log/W3SVC150/ex*.log |”…

Phase 1 : First bypass old records, searching new record…

Searching new records from beginning of log file…

Phase 2 : Now process new records (Flush history on disk after 20000 hosts)…

Jumped lines in file: 0

Parsed lines in file: 1560

Found 43 dropped records,

Found 0 corrupted records,

Found 197 old records,

Found 1320 new qualified records.

Make sure you see new qualified records at the end. If there’s any problem or error please verify you have followed previous steps correctly.

12. Stats have been generated for your website. Now we need URL to view the generated stats. Please create a website in IIS mapped to AWStats ‘cgi-bin’ directory (ie, C:\AWStats\wwwroot\cgi-bin).

13. Call the website from browser – http://192.168.1.132/awstats.pl?config=a-r-u-n.com

14. You are almost done. To generate stats automatically on daily or hourly basis you need to automate it by using Windows Scheduled Tasks. Create a batch file under cgi-bin folder of AWStats and specify the following command – perl awstats.pl -config=www.a-r-u-n.com –update

And finally create a scheduled task to schedule the batch file every 6 hrs or 12 hours.

15. Add sugar to taste… sorry add websites. ;)

“`*“`arun
Configure Network Load Balancing for websites with dedicated ip

Configuring NLB for websites with dedicated ip addresses

# Assuming NLB is already setup and the nodes are converged fine.

Ingredients-

Following are the things I planned for my NLB (Network Load Balancing) setup in Windows Server 2003-

# 3 machines for web server(IIS installed) – Windows Server 2003

Machine names and its IP addresses-
2K31   -        192.168.1.129
2K32   -        192.168.1.130
2K33   -        192.168.1.131

# 1 machine for DNS server – Windows Server 2003

2K34   – 192.168.1.132

# Cluster IP addresses (for dedicated IP) – 192.168.1.150(for arun1.com), 192.168.1.151(for arun2.com)

#  Website name that is going to use in dedicated IP configuration – arun1.com, arun2.com

# On each web servers create the folder structures as below-

C:\Domains
C:\Domains\arun1.com
C:\Domains\arun1.com\wwwroot

C:\Domains
C:\Domains\arun2.com
C:\Domains\arun2.com\wwwroot

Create a test page “index.html” under wwwroot and copy paste the below code-

<html>
<h1><center>WELCOME TO ARUN WORLD</center></h1>
<b/>
2K31 – arun1.com – dedicated
</html>

Change the domain name arun1.com and server name ‘Hosted in 2K31’ to appropriate domain name and server’s name on each sever as this will help a bit in the later stage during testing of each nodes as which node is servicing the request.

Note – It is not intention to have separate physical machines to configure NLB. You can either configure it in Virtual servers like – Microsoft Virtual PC, VMWare Workstation or VMWare Server. This saves cost. In this scenario I’ve setup servers in my friend’s laptop with this configs-

VMWare Workstation ACE Edition 6.02
1.73 Ghz Intel Dual Core
1 GB RAM
120 GB HD

Preparation-

In Network Load Balancing Manager-

1.  Open ‘Cluster Properties’  of the cluster nlb.arun.com.

2.  In ‘Cluster IP Address’  click ‘Add’ to add new dedicated IP.  In this case I’ve added 192.168.1.150 and 192.168.1.151

3.  You will be presented with a dialog box “Confirm Change of Cluster-wide

Properties”. Click ‘Yes’ to proceed further.

In IIS Manager-

Setup 2 sites arun1.com host header pointing to the ip 192.168.1.150 and arun2.com host header pointing to the ip 192.168.1.151.

In DNS Management console-

Create forward lookup zone for 2 domains – arun1.com(192.168.1.150) and arun2.com(192.168.1.151)-

Testing-

Now open the browser and type http://arun1.com and you will see something like this-

In the above pic, it is serviced by node 1 – 2K31.

To test whether this site is servicing through other nodes please suspend or stop the 2K31 node in Cluster Manager(Please refer this URL Setup Network Load Balancing in Windows Server 2003 see under ‘Testing’ section)

Happy Load Balancing! :)

“`*“`arun

Happy Independence Day

Independence day

Happy Independence Day!

Setup Network Load Balancing in Windows Server 2003

Setup Network Load Balancing in Windows Server 2003

 Generally you will need atleast 2 machines installed with Windows Server 2003 and each machine should have atleast 1 NIC and 1 static IP address. Additionally, you will need one more machine (either Windows Server 2003 or Windows XP) needed in order to test the setup. Assuming DNS server is included to add DNS records for websites.

Ingredients-

 Following are the things I planned for my NLB (Network Load Balancing) setup in Windows Server 2003-

 # 3 machines for web server(IIS installed) – Windows Server 2003
     Machine names and its IP addresses-
    2K31   -        192.168.1.129
   
2K32   -        192.168.1.130
   
2K33   -        192.168.1.131

 # 1 machine for DNS server – Windows Server 2003
     2K34   – 192.168.1.132

# Cluster IP address – 192.168.1.100

# Cluster Name  – nlb.arun.com

# On each web servers create the folder structures as below-¦lt;br />     C:\Domains
    C:\Domains\nlb.arun.com
    C:\Domains\nlb.arun.com\wwwroot
¦lt;br /> Create a test page “index.html” under wwwroot and copy paste the below code-
 <html>
<h1><center>WELCOME TO ARUN WORLD</center></h1>
<b/>
Hosted in 2K31
</html>

 Change the server name ‘Hosted in 2K31’ to appropriate server’s name on each sever as this will help a bit in the later stage during testing of each nodes as which node is servicing the request.

 Note – It is not intention to have separate physical machines to configure NLB. You can either configure it in Virtual servers like – Microsoft Virtual PC, VMWare Workstation or VMWare Server. This saves cost. In this scenario I’ve setup servers in my friend’s laptop with this configs-

VMWare Workstation ACE Edition 6.02
1.73 Ghz Intel Dual Core
1 GB RAM
120 GB HD

 Preparation-

 Setting up Network Load Balancer-

 1. Open Network Load balancing Manager-
Start > Administrative Tools > Network Load balancing Manager
(or)
Start > Run > type ‘nlbmgr’ 

2.  Right click Network Load Balancing Manager > New Cluster
New Cluster

3.  In ‘Cluster Parameters’ wizard, in ‘Cluster IP Configuration’ specify the cluster IP address – 192.168.1.100, subnet mask and Full Internet Name as ‘nlb.arun.com’.  Ensure ‘Multicast’ option is selected along with ‘IGMP Multicast’.
Leave the ‘Allow Remote Control’ unchecked.

Note – IP address is the virtual IP address for the cluster that will be used to address the cluster. If you have single adapter then you should select ‘Multicast’ in ‘Cluster Operation Mode’. By selecting ‘Unicast’ allows NLB to take over the network card it is bound to and doesn’t allow any additional network traffic through it. You can configure single adapter in ‘Unicast’ mode but after configuration the cluster manager will not be able to communicate with the server. Generally, ‘Multicast’ is slower than ‘Unicast’ mode.

3_Cluster_Parameters

4.  On the next wizard ‘Cluster IP addresses’, leave the settings as it is and click next. (We will visit this in next topic).

 4_Cluster_IP_Addresses

5.  In ‘Port Rules’ wizard, ensure the necessary ports are added. By default NLB configures to handle all ports. In this scenario I’m going to add these ports – 80 (http traffic) and 443 (https traffic). Add the ports by hitting ‘Add’ button and input 80 as From and To in Port range. Ensure ‘Both’ (ie, both TCP and UDP) protocol is selected.

One of the important thing here is ‘Filtering Mode’ which determines affinity of requests. Affinity describes how requests are routed to a specific server. ‘None’ refers any servers can service the incoming requests. ‘Single’ refers to a specific server has to handle each and every requests from a given IP. ‘None’ is recommended as it is better in stateless applications and this results in less overhead in NLB. ‘Single’ mode should be used when there’s a state server connection, for example – SSL.

5_Add-Edit_Port-Rule

     Do the same thing for adding port 443.

6.  Next step is to add nodes to the cluster. In the ‘Connect’ wizard specify the host name which needs to be included in NLB. In this case I specified 2K31 in ‘Host’ (or you can specify IP address of the host, for this server – 192.168.1.129) and click ‘Connect’ button and ensure interface name and IP info of that node are listed. If there’s more than one NIC card select the one that is going to be configured for NLB.

 6_Connect

 7.  In ‘Host Parameters’ wizard specify the Priority. This should be unique number and it identifies each node in the cluster. Lower the number the higher the priority. Priority 1 is the master node which receives requests and routes the traffic to other nodes only when the load in this node is high. Hit ‘Finish’.

7_Host_parameters

8.  This will take 25 – 35 secs for a node to get converged. Following is the status of NLB cluster-

8_result

9.  Follow the above steps (6th and 7th) to add remaining nodes-
2K32   -        192.168.1.130
2K33   -        192.168.1.131 Review the error log in the bottom pane if there is  rror during additional node setup. Wait for few seconds and hit refresh until you see all the nodes becomes ‘Converged’ state.        

2K32_error_log

 One of the other ways to determine the status of each node in the cluster is – Goto command prompt in one of the nodes > type wlbs query

You will see something like this if all nodes are converged-

2K33_NLB_Status

 In this picture I tried in 2K33 (3rd node).

Setting up website to test NLB-

Setup website in node 1 – 2K31 – Setting up a website is easy process – Open IIS Manager from Administrative Tools and create a new website called nlb.arun.com as host header mapped to the ip address 192.168.1.100 (Cluster IP). Please setup the same site with same settings in all other nodes (2K32, 2K33).

 Setting up DNS records-

This should be carried out in DNS server 2K34 which is not a part of cluster and just acts as DNS server. In order to get a website working you need DNS record configured for that website. To do this you need to create DNS record for arun.com as shown in this picture. Create host record (A) for nlb.arun.com pointing to the cluster IP – 192.168.1.100-

2K34_DNS_Setup

 Testing-

 Now open the browser and type http://nlb.arun.com and you will see something like this-

nlb.arun.com_access

In the above pic, it is serviced by node 1 – 2K31To test whether this site is servicing through other nodes please suspend or stop the 2K31 node in Cluster Manager.

2K31_Node_Suspended

Access the site http://nlb.arun.com again after suspending node 1.

nlb.arun.com_access2_node2

Now you will see the request is serviced by 2K32 (node 2). This confirms request is routed to another node when the first node is unreachable. Now resume/start the node which you stopped in previous stage.

Happy Load Balancing! :)

“`*“`arun 

Bride and bridegroom’s SQL queries

Bride and bridegroom’s SQL queries-

Wedding Query in SQL Style -

HUSBAND’S QUERY-

CREATE PROCEDURE MyMarriage (
BrideGroom Male (25) ,
Bride Female(20) )

AS
BEGIN

SELECT Bride FROM india_ Brides
WHERE FatherInLaw = ‘Millionaire’

AND Count(Car) > 20 AND HouseStatus =’ThreeStoreyed’
AND BrideEduStatus IN (B.TECH ,BE ,Degree ,MCA ,MiBA) AND Having Brothers= Null

AND Sisters =Null

 

SELECT Gold ,Cash ,Car ,BankBalance

FROM FatherInLaw

UPDATE MyBankAccout

SETMyBal = MyBal + FatherInLawBal
UPDATEMyLocker

SET MyLockerContents = MyLockerContents + FatherInLawGold
INSERT INTOMyCarShed VALUES(‘BMW’)
END
GO 

Then the wife writes the below query:

DROP HUSBAND;
Commit;
 

:) :) :)
“`*“`arun 

Tamilians rock

One of the nice mail I received-

Bill Gates organized an enormous session to recruit a new Chairman for Microsoft Europe. 5000 candidates assembled in a large room. One candidate is our ramasamy.

Bill Gates: Thank you for coming.
Those who do not know JAVA may leave.

2000 people leave the room.

Ramasamy says to himself,
‘I do not know JAVA, but I have nothing to lose if I stay. I’ll give it a try !’

Bill Gates: Candidates who never had experience of managing more
than 100 people may leave.

2000 people leave the room.

Ramasamy says to himself
‘I never managed anybody by myself, but I have nothing to lose if I stay. What can
happen to me ?’ So he stays.

Bill Gates: Candidates who do not have management diplomas may leave.

500 people leave the room.

Ramasamy says to himself,

‘I left school at 15, but what have I got to lose ?’ So he stays in the room.

Lastly, Bill Gates asked the candidates who do not speak Serbo-Croat
to leave.

498 people leave the room.

Ramasamy says to himself,

‘I do not speak one word of Serbo-Croat but what do I have to lose ?’ So he stays
and finds himself with one other candidate; Everyone else has gone.

Bill Gates joined them and said ‘Apparently you are the only two candidates who speak Serbo-Croat, so I’d now like to hear you have a conversation together in that language.’
Calmly, ramasamy turns to the other candidate and says ‘ Endha ooru ? ‘
The other candidate answers, ‘ Thoothukudi pakkam, Neenga??!!!!! ‘
Madurai…. Tamilians rock.

“`*“`arun 

Category: Others  Tags:  Leave a Comment
IPL 2010 Comedy

IPL 2010 Comedy-

IPL1IPL2IPL3

IPL4IPL5IPL6

IPL7IPL8IPL9

IPL10IPL11IPL12

IPL13IPL14IPL15

IPL16IPL17IPL18

IPL19IPL20IPL21

Enjoy :)

Category: Fun  Leave a Comment
Eleven point something

Eleven point something-

1. If time doesn’t wait for you don’t worry! Just remove the damn battery from the clock and Enjoy life!

2. Expecting the world to treat u fairly coz u r a good person is like expecting the lion not to attack u coz u r a vegetarian! Think about it.

3. Beauty isn’t measured by outer appearance and what clothes we wear,but what we are inside. So, try going out naked tomorrow and see the admiration!! ;) !!

4. Don’t walk as if you rule the world,walk as if you don’t care who rules the world! That’s called Attitude…! Keep on rocking!

5. Every lady hopes that her daughter will marry a better man than she did and is convinced that her son will never find a wife as good as his father did!!!

6. He was a good man. He never smoked or drank, had no affair. When he died, the insurance company refused the claim. They said, he who never lived, cannot die!

7. A man threw his wife in a pond of Crocodiles? He’s now being harassed by the Animal Rights Activists for being cruel to the Crocodiles!

8. So many options for suicide: Poison, sleeping pills, hanging,jumping from a building, lying on train tracks, but we chose Marriage, slow death for sure!

9. Only 20 percent boys have brains, rest have girlfriends!

10. All desirable things in life are either illegal, banned, expensive or married to someone else!

11. 10% of road accidents are due to drunken driving. Which makes it a logical statement that 90% of accidents are due to driving without drinking!

“`*“`arun
How to repair suspected mssql database

How to repair suspected mssql database-

When  you connect your MSSQL server you may notice some database(s) in ‘suspected’ mode and it doesn’t let you do anything. This is happening because of database corruption, server not properly shut down, etc..  To repair the ‘suspected’ database you may need to run the following query in your Query Analyzer(for SQL 2000) or Management Studio (for SQL 2005 and 2008)-

EXEC sp_resetstatus databasenamehere;
ALTER DATABASE databasenamehere SET EMERGENCY
DBCC checkdb(databasenamehere)
ALTER DATABASE databasenamehere SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB (databasenamehere, REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE databasenamehere SET MULTI_USER

Note: Before running the query please make sure you have taken the copy of data and transaction log files to another location.

Your database is repaired now

“`*“`arun