Archive for the ‘ Linux ’ Category

MySQL replication can be a bit fragile. Most of the time replication fails when the slave tries to run an SQL statement that causes an error. I’ve most frequently seen this when the slave is missing some table that I forgot to import when setting replication up. Usually it is a simple enough job to create the table, then start the slave SQL thread again.

However, sometimes replication breaks for no particular reason at all. I had a slave stop because an invalid query somehow got written to the binary log. I’m not quite sure how that happened.

mysql> stop slave;
Query OK, 0 rows affected (0.00 sec)

mysql> SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
Query OK, 0 rows affected (0.00 sec)

mysql> start slave;
Query OK, 0 rows affected (0.00 sec)

The ‘SQL_SLAVE_SKIP_COUNTER setting tells the slave SQL thread to skip that many queries when starting up. Note that you should really know what your database is doing and why it stopped before you just go running this command. It may cause your slave to get seriously out-of-sync with the master server.

Like this blog? Why not buy me a cup of coffee?

By default any Linux distributions will have IP Forwarding disabled. This is normally a good idea, as most peoples will not need IP Forwarding, but if we are setting up a Linux router/gateway then we will need to enable forwarding. This can be done in several ways.

Check if IP Forwarding is enabled

We have to query the sysctl kernel value net.ipv4.ip_forward to see if forwarding is enabled or not:
Using sysctl:

sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 0

or just checking out the value in the /proc system:

cat /proc/sys/net/ipv4/ip_forward
0

As we can see in both the above examples this was disabled (as show by the value 0).

Enable IP Forwarding

As with any sysctl kernel parameters we can change the value of net.ipv4.ip_forward without rebooting the system:

sysctl -w net.ipv4.ip_forward=1

or

echo 1 > /proc/sys/net/ipv4/ip_forward

the setting is changed instantly; the result will not be preserved after rebooting the system.

Permanent setting using /etc/sysctl.conf

If we want to make this configuration permanent the best way to do it is using the file /etc/sysctl.conf where we can add a line containing net.ipv4.ip_forward = 1

/etc/sysctl.conf:
net.ipv4.ip_forward = 1

if you already have an entry net.ipv4.ip_forward with the value 0 you can change that 1.

To enable the changes made in sysctl.conf you will need to run the command:

sysctl -p /etc/sysctl.conf

You may also need to restart the network service:

service network restart

Like this blog? Why not buy me a cup of coffee?

This video is an interview with the great minds behind the open source. It show the video interviews of Eric Raymond, Linus Torvalds, Richard Stallman and many people who work hard in making open source software as it is today.This is also a documentary of how Linux was born and how it revolutionizes the world of Operating System, The history of GNU, The Free Software Foundation and the Open Source Movement.

Like this blog? Why not buy me a cup of coffee?

PowerTOP is a Linux tool that finds the software component(s) that make your laptop use more power than necessary while it is idle. PowerTOP combines various sources of information from the kernel into one convenient screen so that you can see how well your system is doing, and which components are the biggest problem. With this tool you can find what software is using the most power on your system. Especially notebook users will benefit from reduced power consumption - there will be more time left on battery power.

Intel Powertop

Read the rest of this entry »

Like this blog? Why not buy me a cup of coffee?