March 2011 Archives
Many believe that open source projects cannot be used in the enterprise because of the lack of support. This is untrue.
To maintain the large quantity of servers typically found in enterprise organizations, systems administration must move beyond manual and custom scripts toward a centralized configuration management service. This move can save an organization considerable time and money.
| Add to working copy | svn add <file> |
| Backup to hot copy | hot-backup.py /opt/svn /opt/svn-backup |
| Change log view | svn log file:///opt/svn/scripts/firewall/firewall-new |
| Checkout | svn checkout file:///opt/svn/profile |
| Commit changes | svn commit --message "Your log message" |
| Copy to working copy | svn copy <file> <file> |
| Create respository | svnadmin create --fs-type fsfs /opt/svn |
| Delete from working copy | svn delete <file> |
| Diff changes | svn diff |
| Initial Import | svn import . file:///opt/svn --message "Initial import" |
| Merging to current directory | svn merge <merge to@REV> <merge from@REV> |
| Move file in working copy | svn move <file1> <file2> |
| Remote Checkout | svn checkout svn+ssh://<user>@<hostname>/opt/svn/<project> |
| Revert all changes | svn revert <file> |
| Review changes | svn status |
| Review commit log | svn log |
| Update working copy | svn update <file> (may overwrite changes) |
| View file | svn cat file:///opt/svn/profile/.profile |
| View repository tree | svnlook tree /opt/svn |
| 0 | Go into boot prompt (OK). |
| 1 | Put the system in system administrator mode. All file systems are mounted. Only a small set of essential kernel processes are left running. This mode is for administrative tasks such as installing optional utility packages. All files are accessible and no users are logged in on the system. |
| 2 | Put the system in multi-user mode. All multi-user environment terminal processes and daemons are spawned. This state is commonly referred to as the multi-user state. |
| 3 | Start the remote file sharing processes and dae mons. Mount and advertise remote resources. Run level 3 extends multi-user mode and is known as the remote-file-sharing state. |
| 4 | Is available to be defined as an alternative multi-user environment configuration. It is not necessary for system operation and is usually not used. |
| 5 | Shut the machine down so that it is safe to remove the power. Have the machine remove power, if possible. |
| 6 | Stop the operating system and reboot to the state defined by the initdefault entry in /etc/inittab. |
|
Reboot and issue boot -x (boot to non-cluster mode) at boot prompt. |
|
Reboot and issue boot -xs (single user, non-cluster mode) at boot prompt. |
|
Reboot and issue boot -r (reconfigure) at boot prompt. |
| Upload elom firmware | |
| Upload ilom firmware | |
| Backup cluster confuration | cluster export > clusterconfig.xml |
| Offline device group. | cldg offline <group> |
| Offline resource group. | clrg offline <group> |
| Onine device group. | cldg online <group> |
| Onine resource group. | clrg online <group> |
| Restore cluster configuration | clintr delete --force +clinst add clusterconfig.xml + |
| Show cluster configuration | cluster show |
| Status of cluster. | scstat or cluster status |
| Status of device group. | cldg status |
| Status of resource group. | clrg status |
| Swtich device group to another node. | cldg switch -n <node> <group> |
| Swtich resource group to another node. | clrg switch -n <node> <group> |
The following may not apply to all shells.
| List jobs | jobs |
| Resume job after suspend | ctrl-q |
| Resume job in background | bg <%string> |
| Resume job in background | bg <job number> |
| Resume job in foreground | fg <%string> |
| Resume job in foreground | fg <job number> |
| Suspend delay (suspend at stdin) | ctrl-y |
| Suspend | ctrl-z |
| Recall history line 66 | !66 |
| Recall last command | !! |
| Recall last arguement from last command | !$ |
| Recall all arguements from last command | !* |
| Rename rpmnew files | find -type f -name "*.rpmnew" |\ |
| Search and replace files in place | find /path -name "*.*" -exec \ |
| vi cli editing | set -o vi Now <esc> enter command mode where vi keys
work. Pressing <enter> returns to normal mode. |
| Change to other region | ctrl-a tab |
| Change to other screen | ctrl-a 0-9 |
| Dettach | ctrl-a d |
| Help | ctrl-a ? |
| Kill screen | ctrl-a \ |
| Kill region | ctrl-a x |
| New screen | ctrl-a c |
| Reattach | screen -r |
| Serial connection | screen /dev/ttyUSB0 9600 |
| Split | ctrl-a s |
| Alphabetic | [:alpha:] |
| Alphanumeric | [:alnum:] |
| Control characters | [:cntrl:] |
| Hex numbers | [:xdigit:] |
| Lowercase | [:lower:] |
| Nonespace characters | [:graph:] |
| Numbers | [:digit:] |
| Printable | [:print:] |
| Punctuation | [:punct:] |
| Tab or space | [:blank:] |
| Uppercase | [:upper:] |
| White space | [:space:] |
- Format and mount the SAN LUN.
- Start a write to the mounted filesystem
cat /dev/zero >> /pathto/mnt/testfile & - Now connect to the multipath daemon in interactive mode
multipathd -k - View current paths with
show maps topologymultipathd> show maps topology reload: mpath5 (360060e801045249004f2a5f900000031) dm-7 HITACHI,DF600F [size=128G][features=0][hwhandler=0][rw] \_ round-robin 0 [prio=1][active] \_ 1:0:0:4 sdb 8:16 [active][ready] \_ round-robin 0 [prio=0][enabled] \_ 2:0:0:4 sdc 8:32 [active][ready]
- There are two paths shown as sdb and sdc. Delete one path.
del path sdb - Suspend with ctrl-z and check that the write is still happening.
ls -l /pathto/mntIf testfile is still growing then the path sdc is working. - Resume multipath with
fg 2. Re-add the path.
add path sdb - Now remove the other path.
del path sdc - Again suspend iwth ctrl-z and check that the test file is growing. If so
then resume multipath and re-add the path.
add path sdc - Testing complete. Exit with
ctrl-c. Kill the write job withkill %1. Remove the test file.
| Burn DVD | growisofs -J --iso-level 4 -v -Z dev/dvdrw -R /path/to/dir/ |
| Burn CD | mkisofs -J --iso-level 4 -R path/to/dir/ | \ |
| Image manipulation | convert -rotate 90 -resize 800x600 input.jpg output.jpg |
| Linux Qlogic HBA configuration | # loading module for failover and load balancing: options qla2xxx ql2xfailover=1 ql2xlbType=2 # The RAM disk image may need to be rebuilt with mkinitrd <image file> <kernel version> |
| Show network info | ipcalc 10.0.0.0/24 |
| Segment network into 2 50 node subnets | ipcalc 10.0.0.0/24 -s 50 50 |
| List interfaces | ip addr list |
| Link status | ip link list |
| Route table | ip route |
| Adding routes | ip route add default via 10.0.0.1 |
| Add/delete IP addresses |
ip addr add 10.0.0.2/24 dev eth0ifconfig eth0 10.0.0.2 netmask 255.255.255.0ip addr del 10.0.0.2/24 dev eth0ifconfig eth0 del 10.0.0.2 |
Linux Ethernet bonding
# Loading module:
# for Red Hat AS4, may work with other 2.6 Linuxes.
install bond0 /sbin/modprobe bonding -o bond0 mode=0 miimon=100
# for Red Hat AS3, may work with other 2.4 Linuxes.
alias bond0 bonding
options bond0 -o bonding mode=0 miimon=100
# For Redhat distributions
# ifcfg-ethx
DEVICE=ethx
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
# ifcfg-bond0
DEVICE=bond0
USERCTL=no
ONBOOT=yes
IPADDR=172.16.48.66
NETMASK=255.255.255.0
GATEWAY=172.16.48.1
Click for more Ethernet bonding information.
OSI model diagram
| Download and build source package | apt-get -b source <package name> |
| Download and install dependencies for source package | apt-get build-dep <package name> |
| Download source package | apt-get source <package name> |
| Install package “on demand” | auto-apt run <program> |
| List contents of a package | apt-file list <package name> |
| List installed packages | dpkg -l |
| Remove package and configuration files | apt-get --purge remove <package name> |
| Search for Debian Packages | http://www.debian.org/distrib/packages |
| Search for packages | apt-cache search <string> |
| Show package dependencies | apt-cache depends <string> |
| Show package information | apt-cache show <string> |
| Show package that supplies a given file | apt-file search <file name> |
| Show package that supplies a given file | COLUMNS=132 dpkg -S <file name> |
| Show source package information | apt-cache showsrc <package name> |
| Update apt-file and auto-apt database | apt-file update |
| List cluster resources. | crm_resource -L |
| Dump cluster configuration as xml to stdout. | cibadmin -Q |
| Place node in standby (maintenance mode). Technically this is adding the standby property. | crm_standby -U <hostname> -v true |
| Place local node in standby. | crm_standby -v true |
| Place node online or remove the standby property. | crm_standby -D -U <hostname> |
| Place local node online or remove standby property. | crm_standby -D |
| View cluster status. One time to stdout. | crm_mon -1 |
| View cluster status. Refresh every 3s. | crm_mon -i3 |
| One line simple output. | crm_mon -s |
| Show inactive resources. | crm_mon -r |
| Stop resource. | crm_resource -r <resource> -p target_role -v stopped |
| Start resource. | crm_resource -r <resource> -p target_role -v started |
| Clear failed resource. | crm_resource -C -H <host> -r <resource> |
| Query running cluster for current state (STDOUT). | cibadmin -Q --obj_type resources |
| Other resources. | XML definition |
Whether realizing it or not every organization goes through the process of selecting a naming convention. Often this is done without much forward planing resulting in unwieldy host and service names. In the worst cases host names are dropped completely and either by habit or lack of a proper DNS service only ip addresses are used.
In the following I will talk about the different types of naming conventions that I’ve experienced or read about. I’ll discuss the pros and cons of each. Before we get to that we’ll need to have a small refresher on domain name services.