Kenjun

June 23, 2008

Sending attachments from the Unix/Linux command line

Filed under: Linux, MacOSX, Systems Administration — kenjun @ 8:40 am

Here’s how:

Source machine:

  1. zip all_my_files.zip file_*
  2. uuencode all_my_files.zip all_my_files.uu | mail my@email.address

Destination machine – download zip then:

  1.  uudecode -o all_my_files.zip all_my_files.uu

… and you’re done!

Advertisements

April 2, 2008

What is UCARP

Filed under: Linux, Systems Administration — kenjun @ 3:56 pm

What is UCARP

UCARP allows a couple of hosts to share common virtual IP addresses in order to provide automatic failover.

How Does DRBD work?

Filed under: Linux, MySQL, Systems Administration, Unix — kenjun @ 3:21 pm

How Does DRBD work?

Each device (DRBD provides more than one of these devices) has a state, which can be ‘primary’ or ‘secondary’. On the node with the primary device the application is supposed to run and to access the device (/dev/drbdX). Every write is sent to the local ‘lower level block device’ and to the node with the device in ‘secondary’ state. The secondary device simply writes the data to its lower level block device. Reads are always carried out locally.

What is DRBD

Filed under: Linux, MySQL, Systems Administration — kenjun @ 3:17 pm

What is DRBD

DRBD is a block device which is designed to build high availability clusters. This is done by mirroring a whole block device via (a dedicated) network. You could see it as a network raid-1.

 

UCARP

Filed under: Linux, MySQL, Systems Administration — kenjun @ 7:54 am

What is UCARP

UCARP allows a couple of hosts to share common virtual IP addresses in order to provide automatic failover. It is a portable userland implementation of the secure and patent-free Common Address Redundancy Protocol (CARP, OpenBSD’s alternative to the patents-bloated VRRP).

Strong points of the CARP protocol are: very low overhead, cryptographically signed messages, interoperability between different operating systems and no need for any dedicated extra network link between redundant hosts.

How Does DRBD work?

Filed under: Linux, MySQL, Systems Administration, Unix — kenjun @ 7:19 am

How does it work ?

 

Each device (DRBD provides more than one of these devices) has a state, which can be ‘primary’ or ‘secondary’. On the node with the primary device the application is supposed to run and to access the device (/dev/drbdX). Every write is sent to the local ‘lower level block device’ and to the node with the device in ‘secondary’ state. The secondary device simply writes the data to its lower level block device. Reads are always carried out locally.

 

If the primary node fails, heartbeat is switching the secondary device into primary state and starts the application there. (If you are using it with a non-journaling FS this involves running fsck)

 

If the failed node comes up again, it is a new secondary node and has to synchronise its content to the primary. This, of course, will happen whithout interruption of service in the background.

 

And, of course, we only will resynchronize those parts of the device that actually have been changed. DRBD has always done intelligent resynchronization when possible. Starting with the DBRD-0.7 series, you can define an “active set” of a certain size. This makes it possible to have a total resync time of 1–3 min, regardless of device size (currently up to 4TB), even after a hard crash of an active node.

What is DRBD

Filed under: Linux, MacOSX, MySQL, Systems Administration — kenjun @ 7:15 am

What is DRBD

 

DRBD is a block device which is designed to build high availability clusters. This is done by mirroring a whole block device via (a dedicated) network. You could see it as a network raid-1.

 

DRBD is copyright by Philipp Reisner, Lars Ellenberg and LinBit.

 

What is the scope of drbd, what else do I need to build a HA cluster?

 

DRBD takes over the data, writes it to the local disk and sends it to the other host. On the other host, it takes it to the disk there.

 

The other components needed are a cluster membership service, which is supposed to be heartbeat, and some kind of application that works on top of a block device.

 

Examples:

A filesystem & fsck.

A journaling FS.

A database with recovery capabilities.

 

http://www.drbd.org/

 

November 13, 2007

RPM – Redhat Package Manager…

Filed under: Linux, Systems Administration — kenjun @ 4:14 pm

What package owns a file:

rpm -ql /path/to/file

What files belong to a package

rpm -ql package_name

Verifying a package (note that this will be silent if there are no errors)

rpm -V package_name

http://www.tfug.org/helpdesk/linux/rpm.html

RPM – Redhat Package Manager…

Filed under: Linux, Systems Administration — kenjun @ 4:14 pm

What package owns a file:

rpm -ql /path/to/file

What files belong to a package

rpm -ql package_name

Verifying a package (note that this will be silent if there are no errors)

rpm -V package_name

http://www.tfug.org/helpdesk/linux/rpm.html

November 1, 2007

Argument list too long – xargs is the solution…

Filed under: Linux, Systems Administration, Uncategorized — kenjun @ 3:55 pm

If you’re dealing with a lot of files and get messages like:

mv *.* tmp/
-bash: /bin/mv: Argument list too long

then you need xargs. For example,

Moving Files: 

To move vast number of files from /a/b to /c/d do:

ls . | xargs -i mv /a/b/{} /c/d/{}

The -i argument to xargs says fill in all the {} expressions on the right hand side of the pipe with all the values being generated on the left hand side of the pipe. Or use:

find . -name “thisname-*” | xargs -i mv {} thisname/{}

 Deleting Files

find . -type f -name “*” -print|xargs rm

E.g. http://www.unixreview.com/documents/s=8274/sam0306g/

Older Posts »

Blog at WordPress.com.