You are viewing [info]shantanuo's journal

Shantanu Oak

Feb. 10th, 2011

12:36 pm - What is a Virtual IP Address?

Network interface cards (NICs) typically bind to a single IP address in TCP/IP networks.
However, you can also tell the NIC to listen on extra addresses using the Linux ifconfig command. Such addresses are called virtual IP addresses or VIPs for short.

Let's say for example you have an existing interface eth0 listening on port 192.168.128.114 You can allow the eth0 interface to accept traffic for another address 192.168.128.130 using the following simple command.
saturn# ifconfig eth0:0 192.168.128.130 up

This command tells the TCP/IP stack to accept packets directed to IP address 192.168.128.130 as well as the original address 192.168.128.114. This means that if you are running a MySQL server on the host users can connect using either of the following commands:
mysql -utungsten -psecret -h192.168.128.114 (or)
mysql -utungsten -psecret -h192.168.128.130

Finally, you can move VIPs from host to host very easily by dropping them on the first host and binding to them on a second host, as shown in the following example:
saturn# ifconfig eth0:0 192.168.128.130 down
...
neptune# ifconfig eth0:0 192.168.128.130 up

http://scale-out-blog.blogspot.com/2011/01/virtual-ip-addresses-and-their.html

Tags: ,
Current Mood: complacentcomplacent

Jan. 12th, 2011

03:06 pm - Upload file to google code Project

If you have a google code project, you can directly upload a file using the python script that can be found here...
http://support.googlecode.com/svn/trunk/scripts/googlecode_upload.py

# python googlecode_upload.py
usage: googlecode-upload.py -s SUMMARY -p PROJECT [options] FILE

googlecode_upload.py: error: File summary is missing.

# time python googlecode_upload.py -s sample_data_files -p my-google-project sample_data.sql
Please enter your googlecode.com username: shantanu.oak@gmail.com
Please enter your googlecode.com password.
** Note that this is NOT your Gmail account password! **
It is the password you use to access Subversion repositories,
and can be found here: http://code.google.com/hosting/settings
Password:
The file was uploaded successfully.
URL: http://my-google-project.googlecode.com/files/sample_data.sql

real 1m26.296s
user 0m0.127s
sys 0m0.038s

Tags: ,
Current Mood: happyhappy

Aug. 10th, 2010

09:09 am - Tuning TCP Sockets

The tcp_max_syn_backlog sets the number of TCP SYN packets that the server will queue before they are dropped. Here you can see the default, this can be increased to 30000.
cat /proc/sys/net/ipv4/tcp_max_syn_backlog
1024

echo 30000 > /proc/sys/net/ipv4/tcp_max_syn_backlog

With a web server you will see a lot of TCP connections in the TIME-WAIT state. TIME_WAIT is when the socket is waiting after close to handle packets still in the network. This also should be increased. Here is the default.

cat /proc/sys/net/ipv4/tcp_max_tw_buckets
180000

echo 2000000 > /proc/sys/net/ipv4/tcp_max_tw_buckets

The number of packets that can be queued should be increased from the default of 1000 to 50000.

cat /proc/sys/net/core/netdev_max_backlog
1000

echo 50000 > /proc/sys/net/core/netdev_max_backlog

These tuning features of the TCP sockets can have significant increases in speed. Be sure to test before and after to verify these are doing what you expect.

Tags: ,
Current Mood: working

Jul. 8th, 2010

09:07 am - Cannot open Asian Database?

http://content.icicidirect.com/home.asp

The following message was displayed on one of the leading Indian stock market broker site At 9:00 A. M as on July 8, 2010

Microsoft OLE DB Provider for SQL Server error '80004005'
Cannot open database "Asian" requested by the login. The login failed.
/home.asp, line 335

Does not look like a professional website. Right?


Tags:
Current Mood: disappointeddisappointed

Jun. 10th, 2010

01:43 pm - MTNL Triband configuration

Here is how you can configure the MTNL Triband Internet connection if you are a customer who is living in Mumbai.

Start - Settings - Network Connections
Right click on Local Area Connection and choose Properties
Select Internet Protocal TCP/IP and choose "Properties"
IP Address: 192.168.1.200
Subnet Mask: 255.255.255.0
Default Gateway:
LAN 192.168.1.1
USB 192.168.1.2

DNS Servers:
59.185.3.11
59.185.3.12

Advanced - DNS - Add..
203.94.227.70
203.94.243.70

Disable Windows Firewall from "Advanced" tab of Local Area Connection Properties.

Tags: ,
Current Mood: relievedrelieved

Feb. 17th, 2010

01:23 pm - Boot the CentOS box

When the CentOS box does not boot and you still get up to the grub prompt then you have to run the following 3 commands.

Run the 3 commands found in the grub menu.

#cat /boot/grub/menu.lst

root (hd0,0)
kernel /vmlinuz-2.6.18-92.el5 ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.18-92.el5.img
boot

depending upon sda or hda, you have to run the following command
grub-install /dev/sda

Tags:
Current Mood: nerdy

Jan. 15th, 2010

11:41 am - SSH login without password

client - is a machine from where you want to login to the server through SSH without using a password
server - is a machine in which you want to login from the client without password.

from client :-

#ssh-keygen -t rsa

-t tells that it is SSH2 protocol
* rsa is the key type .llly u can also create a 'dsa' key.

files will be created  :
~/.ssh/id_rsa
~/.ssh/id_rsa.pub  -->public key file

Now copy the public key file from the client to the server where you want to login passwordless.
The public key should be appended to the server's "~/.ssh/authorized_keys" file with the foll. cmd:-


#cat ~/.ssh/id_rsa.pub | ssh "cat - >> ~/.ssh/authorized_keys"

Make sure that the permission of 'authorized_keys' file on the server is '644'


Now u can login passworless to that server through SSH2 protocol.

SSH1 protocol is rarely used nowadays because it can be attacked easily by tracing its Connection Setup Protocol.
SSH uses encrypted data transfer.

RSA key is deprecated because it uses plaintext format.




Ssh Tunneling or  example if u want to use all your outbond E-mail traffics to  your own personal server. The following command your  running  is  your  mail  server (personal-server.com)

ssh -f user@personal- server.com -L 2000:personal- server.com: 25 -N

The -f tells ssh to go into the background just
before it executes the command. This is followed by the username and
server you are logging into. The -L 2000:personal- server.com: 25 is in the form of -L local-port:host: remote-port.

Finally the -N instructs OpenSSH to not execute a command on the remote system.

This essentially forwards the local port 2000 to port 25 on personal-server. com over, with nice benefit of being encrypted. Now simply point your  E-mail client to use localhost:2000 as the SMTP server and we're off to the races.

Another useful feature of port forwarding is for getting around pesky firewall restrictions. For example, a firewall I was behind recently did not allow outbound Jabber protocol traffic to talk.google.com. With this command:
ssh -f -L 3000:talk.google.com:5222 home -N
I was able to send my Google Talk traffic encrypted through the firewall back to my server at home and then out to Google. All I had to do was reconfigure my Jabber client to use localhost as the server and the port 3000 that I had configured. Hopefully this helps you to better understand SSH tunneling.

Ssh speeding up
http://www.cyberciti.biz/faq/linux-unix-reuse-openssh-connection/

More on SSH
https://help.ubuntu.com/community/AdvancedOpenSSH#Troubleshooting

Tags: ,
Current Mood: creative

Dec. 28th, 2009

12:26 pm - This is my english, where is yours?

Someone has written something about our poor english and it is our duty to defend it by saying "this person does not understand only."

http://litterateuse.wordpress.com/2009/12/13/we-are-indian-and-so-is-our-english/

We Indians are very good at spellings but very bad when it comes to arrange the word one after another or to pick up the correct word / phrase. This happens because we don't read much, speak to our friends who are as good as us and most importantly translate everything from our mothertongue to English.

A lot of sytle mistakes are pointed out in that article. So what? We Indians also know one thing and that is the "power of numbers". If we get enough number of people who does something then the rest of the world accept it. Simple na?

Even my maid says "Why should I clean the floor daily daily?" Now it is nothing but the simple translation of hindi "roj roj" and it means daily.

Doesn't google's translate service sounds like Inglish? So what is wrong with this type of transalted english?

Actually a lot. A language is not just a way to communicate messages, it is also a medium of communicating culture, history and the smell of soil. The last thing is again foreign for some of us but unless you become the "son of soil" that term again translated from "bhumi Putra", you won't understand it.

So my advice is, don't wait for the world to start communicating in Inglish just to make you comfortable, start learning the "standard" english.

Current Mood: embarrassedembarrassed

Nov. 22nd, 2009

01:56 pm - Gearmand magic

Download the gearmand C library from...
http://launchpad.net/gearmand/trunk/0.10/+download/gearmand-0.10.tar.gz

To build, you can follow the normal:
./configure
make
make install

You can also run 'make test' before installing to make sure everything checks out ok. Once you have it installed, you can start the Gearman job server with:
gearmand -v

This will start it while printing some verbose messages. To try running a job through it, look in the examples/ directory of this source and run:
./reverse_worker

Once that is running, you can run your first job with:
./reverse_client "Hello, Gearman!"

If all goes well, the reverse_worker application should have output:
Job=H:lap:1 Workload=Hello, Gearman! Result=!namraeG ,olleH

While the reverse_client returned:
Result=!namraeG ,olleH

_____

MySQL user Defined functions that uses the gearmand C library as discussed above...

http://launchpad.net/gearman-mysql-udf/trunk/0.4/+download/gearman-mysql-udf-0.4.tar.gz

To build:
./configure --with-mysql= --libdir=

For example:
./configure --with-mysql=/usr/local/mysql/bin/mysql_config --libdir=/usr/local/mysql/lib/plugin/

make
make install

Please keep in mind that for your UDF to be loaded, it must be in the library path for your server. On most UNIX-like systems you can set this by exporting the correct path in LD_LIBRARY_PATH for your mysql server.

Once the UDFs have been compiled and installed, you load them into MySQL using the following queries:

CREATE FUNCTION gman_do RETURNS STRING
SONAME "libgearman_mysql_udf.so";
CREATE FUNCTION gman_do_high RETURNS STRING
SONAME "libgearman_mysql_udf.so";
CREATE FUNCTION gman_do_low RETURNS STRING
SONAME "libgearman_mysql_udf.so";
CREATE FUNCTION gman_do_background RETURNS STRING
SONAME "libgearman_mysql_udf.so";
CREATE FUNCTION gman_do_high_background RETURNS STRING
SONAME "libgearman_mysql_udf.so";
CREATE FUNCTION gman_do_low_background RETURNS STRING
SONAME "libgearman_mysql_udf.so";
CREATE AGGREGATE FUNCTION gman_sum RETURNS INTEGER
SONAME "libgearman_mysql_udf.so";
CREATE FUNCTION gman_servers_set RETURNS STRING
SONAME "libgearman_mysql_udf.so";

Once loaded, you'll need to add servers for the clients to query first. This can be done with:
SELECT gman_servers_set("127.0.0.1");

_____

select gman_do('reverse','abcd') as test;
+------+
| test |
+------+
| dcba |
+------+

SELECT gman_do('shell',
concat(' ls -lh ',
(select variable_value from information_schema.global_variables
where variable_name = "datadir" )))\G

total 40976
-rw-rw---- 1 gmax staff 5.0M Nov 11 13:34 ib_logfile0
-rw-rw---- 1 gmax staff 5.0M Nov 11 13:34 ib_logfile1
-rw-rw---- 1 gmax staff 10M Nov 11 13:34 ibdata1
-rw-rw---- 1 gmax staff 1.2K Nov 11 13:34 msandbox.err
drwx------ 2 gmax staff 2.4K Nov 11 13:34 mysql
-rw-rw---- 1 gmax staff 6B Nov 11 13:34 mysql_sandbox5140.pid
drwx------ 2 gmax staff 68B Nov 11 13:34 test


select gman_do('eval','2 * 3') ;
+-------------------------+
| gman_do('eval','2 * 3') |
+-------------------------+
| 6 |
+-------------------------+


select gman_do('eval',
concat('$_="',host,'";tr/a-z/b-za/; $_'))
as test from mysql.user;
+-------------+
| test |
+-------------+
| % |
| myserver |
+-------------+

Tags:
Current Mood: amusedamused

Oct. 18th, 2009

06:16 am - Customizing gedit as a Web Developer’s IDE

There are very simple changes those you can make to your favorite text editor "gedit" to make it a ppwerful developer tool.
Personally, I like to have the following preferences set from Edit menu:

* View >
Uncheck "Enable text wrapping"
Check "Display line numbers"
Check "Highlight current line"
Check "Display right margin" and set to 80. (I manually wrap my code at 80 characters)
Highlight matching bracket (when cursor is at a bracket, it's pair is highlighted as shown in the image above).

* Editor >
Check "Use spaces instead of tabs" and set "Tab width" to 4. (We can use modelines to change this from file to file)
Check "Enable auto indentation"
Uncheck "Create a backup copy of file before saving". (I manually backup everything before I start work)

* Font and Colors > Uncheck "Use default theme font" and set "Editor Font" to "Monospace 10".

* Plugins tab > check the box next to 'File Browser Pane' and tag list.

http://www.micahcarrick.com/09-29-2007/gedit-html-editor.html

Tags:
Current Mood: impressedimpressed

Navigate: (Previous 10 Entries)