Saturday, November 29, 2014

Samba

Disable SELinux
yum install samba samba-client samba-common
Check the version of installed samba software by using this command:
# smbd --version
Configure the samba service, so that, it will start automatically at boot time:
# chkconfig smb on
# chkconfig nmb on
Add these Iptables rules, so that samba will work perfectly:
# iptables -I INPUT 4 -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT
# iptables -I INPUT 5 -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT
# iptables -I INPUT 6 -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
# service iptables save
Backup the smb.conf file, then delete it and create the new one:
# cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
# rm /etc/samba/smb.conf
# touch /etc/samba/smb.conf
# nano /etc/samba/smb.conf
Add these lines, in your smb.conf file (or change it according to your requirement):
#======================= Global Settings =====================================
[global]
workgroup = WORKGROUP
security = share
map to guest = bad user
#============================ Share Definitions ==============================
[MyShare]
path = /home/samba/share
browsable =yes
writable = yes
guest ok = yes
read only = no
Save the smb.conf file and restart the service:
# service smb restart
# service nmb restart
Change permission for samba share:
# chmod -R 0777 /home/samba/share
Access the samba share from windows (where 192.168.1.15 ip address of my samba server):
Add and manage Samba users and groups
Add a group in your CentOS server:
# useradd smbuser
# groupadd smbgrp
# usermod -a -G smbgrp smbuser
# smbpasswd -a smbuser
Create a new share, set the permission on the share:
# cd /home/samba/
# mkdir secure
# chown -R smbuser:smbgrp secure/
# chmod -R 0770 secure/
Edit the smb.conf file:
# vi /etc/samba/smb.conf
Add the newly created samba share in smb.conf file:
[Secure]
path = /home/samba/secure
valid users = @smbgrp
guest ok = no
writable = yes
browsable = yes
Restart the samba service:
# service smb restart
# service nmb restart
Check the syntax error with testparm:

# testparm

Sendmail

Take a copy of /etc/mail/sendmail.cf before proceeding.

To add the desired functionality to Sendmail, edit the /etc/mail/sendmail.mc file as the root user. When finished, use the m4 macro processor to generate a new sendmail.cf by executing the following command:

m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

/sbin/service sendmail restart










HACMP

HMC

Hardware Management Console is a technology invented by IBM for the purpose of providing a standard interface to configuring and operating partitioned (also known as an LPAR or virtualized system) andSMP systems such as IBM System i, IBM System p or IBM Power Systems.

The HMC is a Linux kernel using Busybox to provide the base utilities and X Window using the Fluxbox window manager to provide graphical logins. The HMC also utilizes Java applications to provide additional functionality.
Using an HMC, the system administrator is able to manage the software configuration and operation of partitions in a server system, as well as to monitor and identify hardware problems. HMCs offer an inexpensive method to administer complex and expensive servers, as a console need only consist of a 32-bit Intel-based desktop PC with a DVD-RAM drive. HMC is used to:
Configure and manage logical partitions and partition profiles
Perform DLPAR functions.
Activate and manage Capacity on Demand resources.

HMC console commands
HMC: Determine FSP IP address
EZH - Easy HMC Command Line Interface

GPFS on AIX

GPFS Cluster Setup :  Easy steps for setting up GPFS cluster

*********************************************************************
Renaming a one node cluster, requires atleast 4 steps.
1)  Add new IP/name entry in /etc/hosts of the new name, don’t delete the old one
2)  mmchnode --admin-interface=newname-gpf -N oldname-gpf
3)  mmchnode --daemon-interface=newname-gpf -N newname-gpf
mmgetstate -mmdsh: Node oldname-gpf is not available to run the command.
mmchnode: Command was unable to obtain the lock for the GPFS system data.
    Unable to reach the holder of the lock oldname-gpf.
    Check the preceding messages, if any.  Follow the procedure outlined
    in the GPFS Problem Determination Guide.
mmchnode: GPFS was unable to obtain a lock from node newname-gpf.
mmchnode: Command failed.  Examine previous error messages to determine cause.

Reboot and then run the command again and it work.
4)  Rename the cluster and delete old IP address/name from /etc/hosts
mmchcluster -C <new_name>

*********************************************************************
Inode.
[root@hostname1] # mmdf /dev/fs_name -F
Inode Information
-----------------
Number of used inodes:          136927
Number of free inodes:           82209
Number of allocated inodes:     219136
Maximum number of inodes:      4252672

Path to GPFS commands.
/usr/lpp/mmfs/bin/mmlscluster
/usr/lpp/mmfs/bin/mmmount all -a
/usr/lpp/mmfs/bin/mmlsfs /gtest

Setting up TieBreaker disks (Stop the cluster before proceeding)
[root@hostname] # mmchconfig tieBreakerDisks="Vd10DbGA1;Vd10DbA01;Vd10DbD01"
[root@hostname] # mmshutdown -a
Tue Jul  9 10:20:05 PDT 2013: mmshutdown: Starting force unmount of GPFS file systems

Adding Node to GPFS clusterDisks should be zoned to all hosts
Check for ssh keys authenitcaiton between nodesCheck for rsh keys authentication$HOME/.rhosts or the /etc/hosts.equiv. The permissions should be 600 and entry for other nodes
touch $HOME/.hushlogin

Install GPFS: (Install GPFS 3.4.0.23 and Filesets for 3.4.5)
  
Verify if GPFS is installed
Hostname# /usr/lpp/mmfs/bin/mmlscluster
mmlscluster: 6027-1382 This node does not belong to a GPFS cluster.mmlscluster: 6027-1639 Command failed.  Examine previous error messages to determine cause.

Add node to Cluster
mmaddnode -N hostname
1Tue Dec  6 13:30:07 PST 2011: 6027-1664 mmaddnode: Processing node hostname1rshd: 0826-813 Permission is denied.rshd: 0826-813 Permission is denied.

mmchcluster command to set hostname as the secondary configuration server# 
mmchcluster -s hostname

Set the license mode for the node using the mmchlicense command. 
mmchlicense server --accept -N hostname

Start cluster on hostname
mmstartup -N hostname

Verify that both nodes are in the active state
mmgetstate -a 

Mount on all systems
mmmount all –a

Changing quorum and manager
mmchnode --quorum --manager -N hostname1,hostname
2Tue Dec  6 14:50:27 PST 2011: 6027-1664 mmchnode: Processing node hostname1.comTue Dec  6 14:50:27 PST 2011: 6027-1664 mmchnode: Processing node hostname2.commmchnode: 6027-1371 Propagating the cluster configuration data to all  affected nodes.  This is an asynchronous process.

GPFS WIKI.


Convert from RHEL to CentOS

Ensure you have Internet connectivity

yum clean all

mkdir ~/centos && cd ~/centos/

root@rhel-gpfs # rpm -e subscription-manager-firstboot-1.9.11-1.el6.x86_64
root@rhel-gpfs # rpm -e subscription-manager-gui-1.9.11-1.el6.x86_64
root@rhel-gpfs # rpm -e subscription-manager


 rpm --import RPM-GPG-KEY-CentOS-6
rpm -e --nodeps redhat-release-server
 rpm -e yum-rhn-plugin rhn-setup rhn-check rhn-setup-gnome rhnsd
rpm -Uhv --force *.rpm

yum upgrade
init 6

Performance

There is no golden rule for troubleshooting performance issues. To troubleshoot performance issues, strategy will depend on the nature of the problem.
  1. Is it always slow,
  2. or it is this problem irregular -
  3. it appears as suddenly as it goes away?

In UNIX there are 5 major resource types that need to be monitored and tuned -
CPU
Memory
Network
Disk I/O
Applications programs.

Check the application,  ask the app owner.
        Has anything changed on the end user side
        Is there an increase in workload.
        Verify if there are any run away processes.

Steps:
Always start with creating a baseline. Use tools like nmon and perfpmr and save a baseline of the system when it working properly.
As and when changes are made create a new baseline before and after so you have performance points for comparison.
When you suspect a problem, rerun the baseline to see if anything is obvious to you. Without a baseline, you have nothing to compare your problem to, which makes resolution challenging. And, of course, good change control and documentation are critical.

Step 1 – Understand (and reproduce) the problem

Step 2 – Monitor and collect data:  After defining the problem clearly, monitor the system and try to collect as much data as possible on various subsystems. Based on this data, come up list of potential issues.

Step 3 – Eliminate and narrow down issues After having a list of potential issues, dive into each one of them and eliminate any non issues. Narrow it down further to see whether it is an application issue, or an infrastructure issue. Drill down further and narrow it down to a specific component. For example, if it is an infrastructure issue, narrow it down and identify the subsystem that is causing the issue. If it is an I/O subsystem issue, narrow it down to a specific partition, or raid group, or LUN, or disk. Basically, keep drilling down until you put your finger on the root cause of the issue.

Step 4 – One change at a time Once you’ve narrowed down to a small list of potential issues, don’t try to make multiple changes at one time. If you make multiple changes, you wouldn’t know which one fixed the original issue. Multiple changes at one time might also cause new issues, which you’ll be chasing after instead of fixing the original issue. So, make one change at a time, and see if it fixes the original problem.

TOP:

The top command used to dipslay all the running and active real-time processes in ordered list and updates it regularly. It display CPU usage, Memory usage, Swap Memory, Cache Size, Buffer Size, Process PID, User, Commands and much more. It also shows high memory and cpu utilization of a running processess.


Vmstat:
Linux VmStat command used to display statistics of virtual memory, kernerl threads, disks,system processes, I/O blocks, interrupts, CPU activity and much more. By default vmstat command is not available under Linux systems you need to install a package called sysstat that includes a vmstat program. 

LSOF:
Lsof command used in many Linux/Unix like system that is used to display list of all the open files and the processes. The open files included are disk files, network sockets, pipes, devices andprocesses. One of the main reason for using this command is when a disk cannot be unmounted and displays the error that files are being used or opened. With this commmand you can easily identify which files are in use.

TCPDUMP:
Tcpdump one of the most widely used command-line network packet analyzer or packets snifferprogram that is used capture or filter TCP/IP packets that received or transferred on a specific interface over a network. 


Netstat is a command line tool for monitoring incoming and outgoing network packets statistics as well as interface statistics. It is very useful tool for every system administrator to monitor network performance and troubleshoot network related problems.

Htop is a much advanced interactive and real time Linux process monitoring tool. This is much similar to Linux top command but it has some rich features like user friendly interface to manage process, shortcut keys, vertical and horizontal view of the processes and much more. Htop is a third party tool and doesn’t included in Linux systems, you need to install it using YUM package manager tool.

Iotop is also much similar to top command and Htop program, but it has accounting function to monitor and display real time Disk I/O and processes. This tool is much useful for finding the exact process and high used disk read/writes of the processes.

IoStat is simple tool that will collect and show system input and output storage device statistics. This tool is often used to trace storage device performance issues including devices, local disks,remote disks such as NFS.