linux/kernel/panic.c Wallpaper

A New Wallpaper I found    
  Discover Simple, Private Sharing at Drop.io 
   
Read more >>

How To change user name and UID

Hi,
I was asked to change the ID of the mysql user and gourp on one of my servers.
this is a very simple to do.

first type
# id mysql
uid=101(mysql) gid=103(mysql) groups=103(mysql) 
to change the user id type:
# usermod -u 25 mysql
to change the group id run the next command under root user:
# vigr
search the mysql group mysql:x:103: the change it to 25 mysql:x:25:
(save with /wq like regular vi)
OR
# groupmod -g 25 mysql
now run again:
# id mysql
uid=25(mysql) gid=25(mysql) groups=25(mysql)

to change user name run:
# usermod -l old_name new_name
to change home directory run:
# usermod -d /home/user_name user_name
to change group name run:
# groupmod -n old_name new_name
Read more >>

How to configure MySQL Cluster with Heartbeat

In this post we'll discuss how to set up a MySQL cluster with two serves, storage and Heartbeat.
I'm using CentOS 5 distribution on both machines, MySQL 5.1 and a mounted directory on both servers to /var/lib/mysql

Pre-Configuration
You need to install MySQL on both machines.
Assign hostname dbserver01, dbserver02.
dbserver01 is the primary node with IP address 192.168.1.101 to eth0.
and dbserver02 is the slave one with ip address 192.168.1.102.
192.168.1.103 is the virtual IP that will be used for MySQL.

Configuration (do those steps on both servers)
install the Heartbeat package:
# yum install heartbeat

copy the next configuration files to the /etc/ha.d directory:
# cp /usr/share/doc/heartbeat-version/authkeys /etc/ha.d
# cp /usr/share/doc/heartbeat-version/ha.cf /etc/ha.d
# cp /usr/share/doc/heartbeat-version/haresources /etc/ha.d

First we will edit the authkeys file,
# vi /etc/ha.d/authkeys
copy from here:
auth 2
2 sha1 test-HA
change the permission of the authkeys file:
# chmod 600 /etc/ha.d/authkeys

Now let's edit the most important file (ha.cf)
# vi /etc/ha.d/ha/cf
add the following lines into the file:
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 30
initdead 120
bcast eth0
udpport 694
auto_failback on
node dbserver01
node dbserver02 

The last file we need to edit is haresources:
# vi /etc/ha.d/haresources
add the following line:
dbserver01 192.168.1.103 netfs mysqld 

Now all we need to do is to start the hearbeat service on both machines:
# /etc/init.d/heartbeat start
the virtual IP address 192.168.1.103 is now on dbserver01 and MySQL is up and running.
if dbserver01 will crashed from any reason the IP address will jump to dbserver02 the the MySQL service will start automatic.

Enjoy.
And please comment (-;
Read more >>

How to mirror a folder among 2 servers

Hi, in this post I'll show you how to mirror ,synchronize a folder from serverA to serverB with rsync for a backup purpose or what ever you want and need.

First we have to install rsync on both machines for RedHat/Fedora/CentOS you would use:
# yum install rsync
for Debian systems:
# apt-get install rsync
or if you work with SuSE use: yast


Now we need to create a user that will be used by rsync on both servers:
# useradd -d /home/syncuser -m -s /bin/bash syncuser
and give this user a password:
# passwd syncuser


The next step is to make sure that serverA can log into serverB without password so we could create a crontab script which do the synchronization automatic without human interaction.
for this step please go read my post - how to ssh without password

After we test we can ssh from serverA to serverB without password, we can test the rsync,
make sure you have a folder on serverB that you want to backup all your data to and run the next command on serverA:
# rsync -raz --progress --size-only --delete /DirOnServerA/* syncuser@serverB:/DirOnServerB


Now go the serverB and check if you data are there.

All you left to do is to to add the rsync script to crontab and you can sleep well at night.




.
Read more >>

How to mount dir via NFS

Hi, for mount dir from another server you have to use NFS service
NFS - Network File System
First we need to install nfs service on both servers.
logon to your server with root user, and run:

# yum install nfs-utils nfs-utils-lib nfs-utils-lib-devel

After installation finished we need to tell the client machine (the one with the existing folder) that we want to share a folder.
edit /etc/exports like this:

# vi /etc/exports
and add the next line:
/the/folder/you/want *(rw,no_root_squash,async)

Now you need to be shore the NFS ports are open on your server: 2049/tcp 2049/udp and 111/tcp 111/udp

After everything done you can start the NFS service on both machines by:

#/etc/init.d/nfs start

Now you can mount your dir via NFS but first you need to open a folder to the mount one, by:

# mkdir /mnt/DIR
# mount servername:/the/folder/you/want /nmt/DIR

that's it, you done.

If you want the mount to be permanently (mount automatic when restart), you can do it by edit fstab file
and add it the next line:

# vi /etc/fstab
/servername:/the/folder/you/want /mnt/DIR nfs defaults 0 0
# mount -a


ENJOY.
Read more >>

Peace, Love, Linux

A new nice wallpaper I found:




Read more >>

How to add a Swap file

Sometimes it is necessary to add more swap space after installation. For example, you may upgrade the amount of RAM in your system. It might be advantageous to increase the amount of swap space if you perform memory-intense operations or run applications that require a large amount of memory.
You have two options: add a swap partition or add a swap file. It is recommended that you add a swap partition, but sometimes that is not easy if you do not have any free space available.

At a shell prompt as root, type the following command with count being equal to the desired block size:

# dd if=/dev/zero of=/swapfile bs=1024 count=1024000

in the count type the amount of space you wont for your swap file. For example, 1024000=1GB

Setup the swap file with the command:
# mkswap /swapfile

To enable the swap file immediately but not automatically at boot
# swapon /swapfile
Or use # swapoff /swapfile to disable the mount.

To enable it at boot time, edit /etc/fstab to include:
# vi /etc/fstab
/swapfile               swap                    swap    defaults        0 0

The next time the system boots, it will enable the new swap file.
After adding the new swap file and enabling it, make sure it is enabled by viewing the output of the command
# cat /proc/swaps
or
# free
Read more >>