Archive for the ‘Linux’ Category
Tags: ldirectord, load balancer
Background: We have a load balancer powered by LVS + ldirectord. You can find the guide on how to set it up by your own Here.
Recently when we increased the web server pool to 10 servers, we found that the load is not perfectly balanced. After reading some documentation, we found that it could be related to LVS persistence.
Below are some very interesting findings.
quiescent = yes|no If yes, then when real or failback servers are determined to be down, they are not actually removed from the kernel’s LVS table. Rather, their weight is set to zero which means that no new connections will be accepted. This has the side effect, that if the real server has persistent connections, new connections from any existing clients will continue to be routed to the real server, until the persistent timeout can expire. See ipvsadm for more information on persistent connections. This side-effect can be avoided by running the following: echo 1 > /proc/sys/net/ipv4/vs/expire_quiescent_template If the proc file isn’t present this probably means that the kernel doesn’t have LVS support, LVS support isn’t loaded, or the kernel is too old to have the proc file. Running ipvsadm as root should load LVS into the kernel if it is possible. If no, then the real or failback servers will be removed from the kernel’s LVS table. The default is yes. If defined in a virtual server section then the global value is overridden. Default: yes
net.ipv4.vs.expire_nodest_conn=0 maintain entry in table (but silently drop any packets sent), allowing service to continue if the ipvsadm table entries are restored. net.ipv4.vs.expire_nodest_conn=1 expire the entry in table immediately and inform client that connection is closed. This is the expected behaviour by some people when running `ipvsadm -C`
expire_quiescent_template - BOOLEAN 0 - disabled (default) not 0 - enabled When set to a non-zero value, the load balancer will expire persistant templates when the destination server is quiescent. This may be useful, when a user makes a destination server quiescent by setting its weight to 0 and it is desired that subsequent otherwise persistant connections are sent to a different destination server. By default new persistant connections are allowed to quiescent destination servers. If this feature is enabled, the load balancer will expire the persistance template if it is to be used to schedule a new connection and the destination server is quiescent.
Tags: SSH, WinSCP
I have one virtual server in my machine and I used to login to it via winscp, but it keeps prompting this error recently.
I turned off the firewall in both client and server (actually no one changed it), still the same.
At the end, I found that it’s because of an IP conflict in my local network …
setup command is quite convenient for setting up network in RedHat/CentOS. If you didn’t install it during the system installation, you can run the below command to install it.
yum -y install setuptool system-config-network-tui
You may receive the following error when you restart your apache web server
apr_sockaddr_info_get() failed for xxxxxx
apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName
To fix this error is very simple, just set the ServerName in httpd.conf, for example:
Tags: Centos not boot, virtualbox
I have a CentOS 6 running in a VirtualBox. After the recent VirtualBox 4.3.6 update, CentOS won’t boot any more. It always stopped when booting progress bar reaches 100%.
First we need login to the system to see whether we can find any error log.
- Linux has a Single User mode, you can restart the CentOS and press any key in the grub splash screen to enter the grub interactive menu screen.
- You will see all the available kernels or OSes you have installed. Highlight the kernel you want to boot into and press e.
- You will see another screen with a few lines of commands.
- Find the line starting with kernel, move the up/down key to highlight it and press e to edit it.
- You will see a long line of command. Append the word single to it. Press Enter, then press b to boot into it.
Now you will login to Single User mode. Type startx to try to start X11 and you should be able to see some errors. You can also check other log files like /var/log/messages …
In my case, it’s because of the VirtualBox Guest Addition. To fix it, you can re-install the guest addition.
- Click Insert Guest AdditionS CD Image in VirtulBox Menu->Devices
- Mount the CD to a folder: mount /dev/cdrom /mnt/vbox
- cd /mnt/vbox
Now the VirtualBox Guest Additions will be re-installed.
To avoid this to happen again, I also change the /etc/inittab to set the system to always boot to text mode.