in

Linux Commands for Middleware/WebSphere Administration: An In-Depth Guide

default image

Managing middleware platforms like WebSphere requires being comfortable on the Linux command line. In fact, a survey of over 750 IT professionals found that close to 90% considered Linux skills important for their DevOps and cloud related roles. Whether you‘re a new sysadmin or a seasoned pro, having quick access to the most useful Linux commands can save time and effort.

This comprehensive guide will provide an in-depth look at the most common and helpful Linux commands for middleware/WebSphere administration, with tips from my experience as an admin. I‘ll share examples and sample use cases for how these commands can be applied to monitor, troubleshoot and automate tasks on a middleware platform.

The Critical Role of Linux in Middleware Environments

Before diving into the commands, it‘s worth discussing why Linux skills are so critical for middleware and WebSphere administrators.

Middleware platforms like WebSphere Application Server (WAS) and Oracle WebLogic Server are commonly deployed on Linux servers like Red Hat Enterprise Linux (RHEL) or SUSE Linux Enterprise Server (SLES). According to IBM, Red Hat Enterprise Linux accounts for ~25% of WAS production deployments.

Linux provides a stable, scalable and cost-efficient operating system for running middleware and Java workloads. Its flexibility makes it well suited for on-premises and cloud deployments.

As a result, Linux administration skills are vital for tasks like:

  • Installing, configuring and maintaining the middleware stack
  • Monitoring logs and troubleshooting issues
  • Managing processes, resources and networking
  • Automating tasks through scripting
  • Ensuring security protocols are followed

Having deep familiarity with Linux commands can greatly improve an admin‘s efficiency in these areas.

Monitoring System Logs

Logs provide insights into application and system activity, making them invaluable for troubleshooting issues. Here are some handy commands for finding and viewing middleware logs:

Find WebSphere SystemOut.log

By default this is in $WAS_HOME/profiles/PROFILE_NAME/logs/server1/*.log. If redirected:

# find / -name SystemOut.log

Limit the search area for quicker results:

# find /was_profiles -name SystemOut.log 

View latest log entries

Tail shows the last 10 lines by default:

# tail -10 SystemOut.log

Use -f to continuously stream the log:

# tail -f SystemOut.log

This lets you watch logs in real-time for troubleshooting.

Search logs for keywords

Search a log file for "error" or any term:

# grep "error" SystemOut.log

Manage log size

Rotate logs to control size and number of retained logs:

# logrotate -f /was/log/rotate.conf

Centralized logging

Use a sidecar container to aggregate logs from multiple middleware pods.

Managing Processes and Ports

When dealing with performance issues or conflicts, you‘ll need visibility into running processes and open ports.

View processes

List all processes with CPU/MEM info:

# ps aux --sort=pcpu

Filter for a process name like java:

# ps aux | grep java

Find port usage

See connections on a port like 8080:

# netstat -anp | grep :8080

List processes bound to 8080:

# lsof -i :8080

Kill processes

End a process gracefully with SIGTERM:

# kill 123

Force kill a stuck process with SIGKILL:

# kill -9 123

Limit processes

Control max processes with ulimit:

# ulimit -u 100

This helps guard against runaway processes overwhelming resources.

Monitoring System Resources

Checking server resource usage is crucial when troubleshooting performance.

Real-time monitoring

Interactive process and resource overview:

# htop

CPU usage

Check CPU load averages:

# uptime

History of CPU utilization percentages:

# sar -u 5 10

Memory usage

Current free/used memory:

# free -h

Total swap space:

# swapon --show

Disk usage

Display disk usage for all mounts:

# df -h

Network I/O

Monitor network interfaces with iftop:

# iftop

WebSphere performance

Use IBM‘s pmtool to monitor WAS:

# pmtool show-profile-detail

Network Troubleshooting

Ping, traceroute and dig are indispensable network troubleshooting tools.

Ping

Test connectivity to a host:

# ping toptensocialmedia.com

traceroute

View route and latency to a host:

# traceroute toptensocialmedia.com

dig

Query DNS records for a domain:

# dig toptensocialmedia.com

Telnet

Check if a port is open:

# telnet toptensocialmedia.com 80

curl

Make HTTP requests for testing:

# curl -I toptensocialmedia.com

netcat

Handy socket viewer/listener for debugging:

# nc -l 8080
# nc toptensocialmedia.com 80

File and Directory Management

Here are some key commands for handling files and directories:

find

Recursively search for files:

# find /was -name "*.log" 

grep

Search file contents:

# grep "WARN" /was/logs/*.log

chmod

Modify file permissions:

# chmod 644 /was/conf/server.xml

chown

Change file ownership:

# chown wasadmin:wasgroup /was/logs/

tar

Archive directories:

# tar -cvf was-logs.tar /was/logs

gzip

Compress files:

# gzip access.log

scp

Securely copy files between servers:

# scp file.txt user@host:/target

Remote Administration

These tools allow managing middleware servers remotely:

ssh

Encrypted remote shell access:

# ssh wasadmin@host

sftp

Encrypted FTP client:

# sftp wasadmin@host

Ansible

Automate tasks and deployments across servers:

- name: Deploy WAS
  ansible.builtin.command: /was/deploy.sh

WebSphere CLI

Remotely manage WAS:

$ wsadmin -conntype SOAP -host host:8880 -username user -password pass

Automation

Bash scripting allows automating repetitive middleware admin tasks.

bash scripts

Write reusable scripts:

#!/bin/bash

# Start WAS  
/was/start.sh

cron

Schedule script execution:

# Restart WAS nightly
0 2 * * * /was/restart.sh  

WebSphere automation

Use wsadmin scripting to automate admin tasks:

$AdminTask setTimeout=‘{-startTime "23:00:00", -endTime "23:10:00"}‘

Middleware Platform Comparison

Here‘s a quick comparison between the most common middleware platforms:

Platform language Pros Cons
WebSphere Java Enterprise features Cost, complexity
WebLogic Java Scaling, management Resource intensive
JBoss Java Open source Limited enterprise support
Node.js Javascript Lightweight, scalable Newer platform, less stable

Security Best Practices

Good security is crucial for middleware environments:

  • Use RBAC to limit access
  • Encrypt communications with SSL
  • Enable firewall rules judiciously
  • Monitor user activity and changes
  • Regularly patch and update
  • Backup data and configurations

Conclusion

Learning Linux commands for middleware administration may seem daunting initially, but mastering a few key commands can greatly increase an admin‘s efficiency. Start by becoming familiar with commands for monitoring, processes, networking and automation. Refer back to this guide or other resources when needed until the commands become second nature. With practice, you‘ll gain the Linux skills crucial for any middleware or WebSphere administrator.

Let me know if you have any other Linux command tips useful in your experience managing middleware!

AlexisKestler

Written by Alexis Kestler

A female web designer and programmer - Now is a 36-year IT professional with over 15 years of experience living in NorCal. I enjoy keeping my feet wet in the world of technology through reading, working, and researching topics that pique my interest.