Replacing sysklogd with rsyslog
Sun, 11/21/2010 - 00:56 — sandipIf you need to replace old sysklogd with recent rsyslog on centos, `rpm -e --nodeps sysklogd` is rather kludgy as yum will remove initscripts, upon which most of the system is dependent on. However, it is possible to install and remove via the yum shell in one go, which resolves the dependency issues.
# yum shell
> install rsyslog
> remove sysklogd
> run
> quit
How to change network card speed and duplex settings in ubuntu
Wed, 11/17/2010 - 12:27 — david23If you want to change speed and duplex of your network card you have to use ethtool or mii-tool.ethtool can be used to query and change settings such as speed, auto- negotiation and checksum offload on many network devices, especially Ethernet devices.
How to Tell Your OpenVZ VPS is Swapping
Fri, 11/12/2010 - 18:13 — sandipSo you think your OpenVZ VPS really has “guaranteed memory”? Well. Not quite. I have got an OpenVZ VPS from one of the providers listed here — 256MB guaranteed and 512MB burstable memory. When I run free it shows... 512MB total memory and 0 swap? After all I am only using 65MB of memory so well below my “guaranteed” amount. Zero swap because it is just how OpenVZ does its memory account. But is it really the case that all my processes reside in physical RAM?
Let’s dig out the good ol’ user_beancounters...
Linux cpu processor cores and threads
Fri, 11/12/2010 - 12:26 — sandip/proc/cpuinfo has the info you need to identify the number of processors, cores and threads.
To get the total number of processors/cpu cores:
grep -c processor /proc/cpuinfo
Total number of physical cpus:
grep "physical id" /proc/cpuinfo | sort -u | wc -l
Number of cores per cpu:
grep "cores" /proc/cpuinfo | sort -u
To check if hyperthreading is enabled:
grep "cores\|siblings" /proc/cpuinfo | sort -u
If siblings is a multiple of cores then hyperthreading is enabled.
Trac redirect loop upon password reset
Mon, 11/01/2010 - 15:20 — sandipRecently, I have come across the mentioned bug during a password reset of Trac:
Reference bug trac-hacks.org/ticket/3233
This looks like an issue when set to "Force users to change passwords after a password reset?". I changed the config to not force the password change.
Also removed the session attribute in reference from the trac database:
sqlite3 yourtrac/db/trac.db \ 'DELETE FROM "session_attribute" WHERE "name" = "force__change_passwd&quo t;;'
- sandip's blog
- Login or register to post comments
Using varnish HTTP accelerator and some gotchas
Sat, 10/30/2010 - 01:43 — sandipExperimenting with Varnish...
Using the varnish HTTP accelerator - Experiences so far...
Nginx location and rewrite configuration made easy
Sat, 10/30/2010 - 00:53 — sandipThe best way to think of things is that as a request comes in, Nginx will scan through the configuration to find a “location” line that matches the request. There are TWO modes that nginx uses to scan through the configuration file: literal string matching and regular expression checks. Nginx first scans through ALL literal string location entries in the order that they occur in the configuration file, and secondly scans through ALL the regular expression location entries in the order that they occur in the configuration file. So be aware – location ordering order DOES matter...
Probing if Varnish is Alive
Fri, 10/29/2010 - 23:52 — sandipIf you probe on varnish service status to check if it is alive, this can be setup as below. Put it in "vcl_recv" block:
# Check if Varnish is alive
if (req.url == "/varnish_status") {
error 200 "OK";
}
Then check for http "200 OK" in the response code.
- sandip's blog
- Login or register to post comments
List threads with ps and top
Thu, 10/28/2010 - 10:04 — sandipThe "H" option in both ps and top lists the threads:
Examples:
ps auxwH
top H
- sandip's blog
- Login or register to post comments
Redirect ports inside OpenVZ containers
Sat, 10/16/2010 - 23:14 — sandipFor port redirection to work inside OpenVZ containers, ipt_REDIRECT kernel module needs to be loaded in the host. Edit "/etc/sysconfig/vz" and add it to the IPTABLES list.
IPTABLES="ipt_REJECT ipt_tos ipt_TOS ipt_LOG ip_conntrack ip_conntrack_ftp ip_conntrack_irc ipt_owner ipt_length ipt_limit ipt_multiport iptable_filter iptable_mangle ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_length ipt_state iptable_nat ip_nat_ftp ipt_recent ipt_REDIRECT"
This should then allow to redirect ports. So if you need to proxy existing apache via nginx or lighttpd and you do not want to switch apaches' default port 80, then the below rules will do the appropriate redirection to port 81 where nginx/lighttpd server is listening, serving static content and proxying to apache for dynamic content:
# Redirect external web traffic to port 81
iptables -t nat -A PREROUTING -s ! 127.0.0.1 -p tcp --dport 80 -j REDIRECT --to-ports 81
# Redirect internal port 80 to 81
iptables -t nat -A OUTPUT -s 0/0 -d 192.168.10.2 -p tcp --dport 80 -j REDIRECT --to-ports 81
Where 192.168.10.2 is the internal IP resolver of domain/host.