1. 首页 > WebSphere教程 > 正文

WebSphere教程FG001-WebSphere架构原理与官方核心特性生产实战解析

本文档风哥主要介绍IBM WebSphere Application Server 9.0.5的架构原理与核心特性,包括WebSphere应用服务器概述、架构原理详解、核心特性介绍、学习前景分析、硬件要求、操作系统要求、运行平台规划等内容,风哥教程参考WebSphere官方文档WebSphere Application Server 9.0.5产品概览、系统需求等章节,适合WebSphere管理员在学习和测试中使用,如果要应用于生产环境则需要自行确认。更多视频教程www.fgedu.net.cn

Part01-基础概念与理论知识

1.1 WebSphere应用服务器概述

IBM WebSphere Application Server(简称WAS)是IBM公司开发的企业级Java应用服务器,是全球领先的Java EE应用服务器之一。WebSphere提供了完整的Java EE运行环境,支持企业级应用的开发、部署和管理。WebSphere 9.0.5是当前最新的长期支持版本,支持Java EE 7规范和Java SE 8/11/17运行时环境。学习交流加群风哥微信: itpux-com

WebSphere应用服务器的主要特点:

  • 企业级Java EE应用服务器,支持完整Java EE 7规范
  • 高可用性和可扩展性,支持集群部署
  • 强大的管理控制台和命令行工具
  • 完善的安全机制,支持多种认证授权方式
  • 丰富的性能监控和调优工具
  • 支持多种操作系统平台(AIX、Linux、Windows等)

1.2 WebSphere架构原理详解

WebSphere应用服务器采用分层架构设计,主要包括以下几个核心组件:

1.2.1 WebSphere核心架构组件

  • 应用服务器(Application Server):运行Java应用的核心容器,提供EJB容器、Web容器、JMS服务等
  • 部署管理器(Deployment Manager):在ND版本中负责管理多个节点的集中管理组件
  • 节点代理(Node Agent):负责管理节点上的应用服务器,与部署管理器通信
  • 概要文件(Profile):定义运行时环境的配置集合,包括服务器配置、应用配置等
  • 单元(Cell):由部署管理器管理的整个管理域,包含多个节点
  • 节点(Node):一个逻辑管理单元,包含一个或多个应用服务器

1.2.2 WebSphere架构层次

WebSphere架构层次结构:

┌─────────────────────────────────────────────────────────┐
│ Cell(单元) │
│ ┌───────────────────────────────────────────────────┐ │
│ │ Deployment Manager(部署管理器) │ │
│ └───────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Node 1(节点1)│ │ Node 2(节点2)│ │
│ │ ┌───────────┐ │ │ ┌───────────┐ │ │
│ │ │Node Agent │ │ │ │Node Agent │ │ │
│ │ └───────────┘ │ │ └───────────┘ │ │
│ │ ┌─────┐ ┌─────┐│ │ ┌─────┐ ┌─────┐│ │
│ │ │App │ │App ││ │ │App │ │App ││ │
│ │ │Srv1 │ │Srv2 ││ │ │Srv1 │ │Srv2 ││ │
│ │ └─────┘ └─────┘│ │ └─────┘ └─────┘│ │
│ └─────────────────┘ └─────────────────┘ │
└─────────────────────────────────────────────────────────┘

1.3 WebSphere核心特性介绍

WebSphere 9.0.5版本引入了多项核心特性和增强功能:

1.3.1 Java EE 7支持

  • 完整的Java EE 7规范支持,包括Servlet 3.1、JSP 2.3、JSF 2.2、EJB 3.2、JPA 2.1等
  • 支持WebSocket协议,实现实时双向通信
  • 支持JSON Processing API,简化JSON数据处理
  • 支持Batch Processing API,实现批处理应用开发

1.3.2 Java SE版本支持

  • 支持Java SE 8、Java SE 11、Java SE 17运行时环境
  • 支持最新的JVM特性和性能优化
  • 支持新的垃圾回收器(G1GC、ZGC等)

1.3.3 高可用特性

  • 集群支持:静态集群和动态集群
  • 会话复制:内存复制和数据库持久化
  • 故障转移:自动故障检测和切换
  • 滚动升级:零停机补丁和升级
风哥提示:WebSphere ND版本提供了完整的高可用和集群管理功能,是企业级生产环境的首选。Base版本适合单服务器部署和开发测试环境。

1.4 WebSphere学习前景分析

WebSphere作为企业级应用服务器的领导者,具有广阔的学习前景和职业发展空间:

1.4.1 市场需求分析

  • 金融行业:银行、证券、保险等金融机构大量使用WebSphere作为核心应用平台
  • 电信行业:运营商核心系统、计费系统等关键应用运行在WebSphere上
  • 政府机构:电子政务、公共服务等系统采用WebSphere作为中间件平台
  • 大型企业:ERP、CRM、供应链等企业级应用广泛部署在WebSphere上

1.4.2 职业发展路径

  • WebSphere管理员 → 高级管理员 → 架构师
  • WebSphere运维工程师 → DevOps工程师 → 平台工程师
  • WebSphere开发工程师 → 技术专家 → 解决方案架构师

1.4.3 技能要求

WebSphere管理员核心技能要求:

基础技能:
– Java基础知识(JVM、GC、类加载机制)
– Linux/Unix操作系统管理
– 网络基础知识(TCP/IP、HTTP/HTTPS)
– 数据库基础知识(Oracle、MySQL等)

专业技能:
– WebSphere安装、配置、部署
– WebSphere集群管理
– WebSphere性能调优
– WebSphere故障排查
– WebSphere安全管理

高级技能:
– WebSphere自动化运维(脚本、Ansible)
– WebSphere容器化部署(Docker、K8s)
– WebSphere云原生迁移
– WebSphere高可用架构设计

Part02-生产环境规划与建议

2.1 WebSphere硬件要求

WebSphere应用服务器对硬件资源有一定的要求,以下是生产环境的推荐配置:

2.1.1 CPU要求

# WebSphere CPU要求

最小配置:
– 开发/测试环境:2核CPU
– 生产环境:4核CPU

推荐配置:
– 小型生产环境:4-8核CPU
– 中型生产环境:8-16核CPU
– 大型生产环境:16-32核CPU或更多

# 查看CPU信息
lscpu

Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
CPU(s): 16
Thread(s) per core: 2
Core(s) per socket: 8
Socket(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 85
Model name: Intel(R) Xeon(R) Gold 6248R CPU @ 3.00GHz
Stepping: 7
CPU MHz: 3000.000
BogoMIPS: 6000.00

2.1.2 内存要求

# WebSphere内存要求

最小配置:
– 开发/测试环境:4GB内存
– 生产环境:8GB内存

推荐配置:
– 小型生产环境:16-32GB内存
– 中型生产环境:32-64GB内存
– 大型生产环境:64-128GB内存或更多

# JVM堆内存规划
– 堆内存建议不超过物理内存的50%
– 预留足够的内存给操作系统和其他进程
– 例如:64GB物理内存,JVM堆内存建议32GB

# 查看内存信息
free -h

total used free shared buff/cache available
Mem: 62Gi 8.2Gi 48Gi 1.1Gi 6.5Gi 52Gi
Swap: 8.0Gi 0B 8.0Gi

2.1.3 存储要求

# WebSphere存储要求

安装目录:
– WebSphere安装目录:/WebSphere/app
– 最小空间:10GB
– 推荐空间:20GB以上

数据目录:
– 应用数据目录:/WebSphere/fgdata
– 日志目录:/WebSphere/logs
– 配置备份目录:/WebSphere/backup
– 推荐空间:根据应用规模,建议100GB以上

# 查看磁盘空间
df -h

Filesystem Size Used Avail Use% Mounted on
devtmpfs 32G 0 32G 0% /dev
tmpfs 32G 0 32G 0% /dev/shm
tmpfs 32G 1.1G 31G 4% /run
tmpfs 32G 0 32G 0% /sys/fs/cgroup
/dev/mapper/rootvg-lv_root 200G 15G 185G 8% /
/dev/sda1 1014M 195M 820M 20% /boot

2.2 WebSphere操作系统要求

WebSphere 9.0.5支持多种操作系统平台:

2.2.1 支持的操作系统

# WebSphere 9.0.5支持的操作系统

Linux平台:
– Red Hat Enterprise Linux (RHEL) 7.x/8.x/9.x
– Oracle Linux 7.x/8.x/9.x
– SUSE Linux Enterprise Server 12/15
– Ubuntu 18.04/20.04/22.04 LTS

UNIX平台:
– IBM AIX 7.1/7.2/7.3
– Oracle Solaris 10/11

Windows平台:
– Windows Server 2016/2019/2022
– Windows 10/11(仅开发测试)

国产操作系统:
– 麒麟操作系统 Kylin v10 SP3
– 欧拉 openEuler 20.03/22.03

# 查看操作系统版本
cat /etc/os-release

NAME=”Oracle Linux Server”
VERSION=”9.3″
ID=”ol”
ID_LIKE=”fedora”
VARIANT=”Server”
VARIANT_ID=”server”
VERSION_ID=”9.3″
PLATFORM_ID=”platform:el9″
PRETTY_NAME=”Oracle Linux Server 9.3″

2.2.2 操作系统内核要求

# 查看内核版本
uname -r

5.15.0-101.103.2.1.el9uek.x86_64

# 检查系统架构
uname -m

x86_64

# 检查系统位数
getconf LONG_BIT

64

2.3 WebSphere运行平台规划

WebSphere运行平台规划需要考虑多个方面:

2.3.1 Java运行时环境

# WebSphere支持的Java版本

IBM SDK:
– IBM SDK Java 8
– IBM SDK Java 11
– IBM SDK Java 17

Oracle/OpenJDK:
– Oracle JDK 8/11/17
– OpenJDK 8/11/17

# 查看Java版本
java -version

java version “1.8.0_401”
Java(TM) SE Runtime Environment (build 1.8.0_401-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.401-b10, mixed mode)

# 或IBM SDK
java -version

java version “1.8.0_8.0”
Java(TM) SE Runtime Environment (build pxa6480sr8-20240430_01(SR8))
IBM J9 VM (build 2.9, JRE 1.8.0 Linux amd64-64-Bit Compressed References 20240430_434599 (JIT enabled, AOT enabled)
OpenJ9 – b75a3e0
OMR – 4d83593
JCL – 20240430_01 based on Oracle jdk8u401-b10)

2.3.2 网络环境规划

# WebSphere网络端口规划

管理端口:
– 管理控制台:9060(HTTP)、9043(HTTPS)
– SOAP连接器:8880
– RMI连接器:2809
– admin_host:9060

应用端口:
– HTTP端口:9080
– HTTPS端口:9443
– 虚拟主机端口:根据应用配置

集群端口:
– DRS客户端:9402
– DRS服务端:9403
– SIB端点:7276、7286、5558、5578

# 查看端口占用
netstat -tlnp | grep -E ’90|94′

tcp6 0 0 :::9060 :::* LISTEN 12345/java
tcp6 0 0 :::9080 :::* LISTEN 12345/java
tcp6 0 0 :::9443 :::* LISTEN 12345/java

2.4 WebSphere环境规划建议

生产环境规划需要综合考虑多个因素:

生产环境规划建议:

  • 开发环境:单服务器部署,资源需求较低
  • 测试环境:模拟生产环境,资源配置适中
  • 生产环境:集群部署,高可用配置,资源充足
  • 灾备环境:异地部署,数据同步,快速切换

2.4.1 环境规模规划

# WebSphere环境规模规划参考

小型环境(单节点):
– 应用服务器:1-2个
– 内存:16-32GB
– CPU:4-8核
– 适用场景:小型应用、内部系统

中型环境(2-3节点集群):
– 应用服务器:4-6个
– 内存:32-64GB/节点
– CPU:8-16核/节点
– 适用场景:中型企业应用、在线业务

大型环境(5节点以上集群):
– 应用服务器:10个以上
– 内存:64-128GB/节点
– CPU:16-32核/节点
– 适用场景:大型企业核心系统、高并发业务

Part03-生产环境项目实施方案

3.1 WebSphere环境检查

在安装WebSphere之前,需要进行环境检查:

3.1.1 系统资源检查

# 检查CPU信息
lscpu | grep -E ‘CPU\(s\)|Model name|Thread|Core’

CPU(s): 16
Thread(s) per core: 2
Core(s) per socket: 8
Model name: Intel(R) Xeon(R) Gold 6248R CPU @ 3.00GHz

# 检查内存信息
free -h

total used free shared buff/cache available
Mem: 62Gi 8.2Gi 48Gi 1.1Gi 6.5Gi 52Gi
Swap: 8.0Gi 0B 8.0Gi

# 检查磁盘空间
df -h / /WebSphere

Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rootvg-lv_root 200G 15G 185G 8% /
/dev/mapper/datavg-lv_data 500G 20G 480G 4% /WebSphere

# 检查系统负载
uptime

10:30:01 up 30 days, 2:15, 3 users, load average: 0.52, 0.58, 0.55

3.1.2 软件依赖检查

# 检查Java版本
java -version

java version “1.8.0_401”
Java(TM) SE Runtime Environment (build 1.8.0_401-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.401-b10, mixed mode)

# 检查操作系统版本
cat /etc/redhat-release

Oracle Linux Server release 9.3

# 检查必要的软件包
rpm -qa | grep -E ‘glibc|libaio|unzip’

glibc-2.34-83.0.1.el9.x86_64
glibc-common-2.34-83.0.1.el9.x86_64
libaio-0.3.111-13.el9.x86_64
unzip-6.0-56.el9.x86_64

# 检查主机名解析
hostname

fgedu.net.cn

# 检查hosts文件
cat /etc/hosts

127.0.0.1 localhost localhost.localdomain
192.168.1.100 fgedu.net.cn fgedu

3.2 WebSphere内核参数配置

WebSphere生产环境需要优化操作系统内核参数:

3.2.1 内核参数优化

# 编辑内核参数配置文件
vi /etc/sysctl.conf

# WebSphere内核参数优化配置
# 文件描述符限制
fs.file-max = 6815744

# 共享内存设置
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
kernel.shmmni = 4096

# 信号量设置
kernel.sem = 250 32000 100 128

# 网络参数优化
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 4194304
net.core.netdev_max_backlog = 30000
net.core.somaxconn = 65535

# TCP参数优化
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1800
net.ipv4.tcp_keepalive_intvl = 30
net.ipv4.tcp_keepalive_probes = 5
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_sack = 1
net.ipv4.tcp_window_scaling = 1

# 应用内核参数
sysctl -p

fs.file-max = 6815744
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 4194304
net.core.netdev_max_backlog = 30000
net.core.somaxconn = 65535

3.2.2 用户限制配置

# 编辑用户限制配置文件
vi /etc/security/limits.conf

# WebSphere用户限制配置
websphere soft nofile 65536
websphere hard nofile 65536
websphere soft nproc 65536
websphere hard nproc 65536
websphere soft stack 10240
websphere hard stack 32768
websphere soft memlock unlimited
websphere hard memlock unlimited

# 查看当前用户限制
ulimit -a

core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 63469
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 65536
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 65536
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

3.3 WebSphere网络配置

WebSphere网络配置是生产环境的重要环节:

3.3.1 主机名配置

# 查看当前主机名
hostname

fgedu.net.cn

# 设置主机名(如果需要修改)
hostnamectl set-hostname fgedu.net.cn

# 验证主机名
hostname

fgedu.net.cn

# 配置hosts文件
vi /etc/hosts

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.100 fgedu.net.cn fgedu
192.168.1.101 fgedu02.net.cn fgedu02
192.168.1.102 fgedu03.net.cn fgedu03

# 验证主机名解析
ping -c 2 fgedu.net.cn

PING fgedu.net.cn (192.168.1.100) 56(84) bytes of data.
64 bytes from fgedu.net.cn (192.168.1.100): icmp_seq=1 ttl=64 time=0.021 ms
64 bytes from fgedu.net.cn (192.168.1.100): icmp_seq=2 ttl=64 time=0.032 ms
— fgedu.net.cn ping statistics —
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.021/0.026/0.032/0.007 ms

3.3.2 防火墙配置

# 查看防火墙状态
systemctl status firewalld

● firewalld.service – firewalld – dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2026-04-10 10:00:00 CST; 30min ago

# 开放WebSphere端口
firewall-cmd –permanent –add-port=9060/tcp
firewall-cmd –permanent –add-port=9043/tcp
firewall-cmd –permanent –add-port=9080/tcp
firewall-cmd –permanent –add-port=9443/tcp
firewall-cmd –permanent –add-port=8880/tcp
firewall-cmd –permanent –add-port=2809/tcp

success

# 重载防火墙配置
firewall-cmd –reload

success

# 查看开放的端口
firewall-cmd –list-ports

9060/tcp 9043/tcp 9080/tcp 9443/tcp 8880/tcp 2809/tcp

3.4 WebSphere用户与目录配置

WebSphere安装需要创建专用用户和目录:

3.4.1 创建WebSphere用户

# 创建WebSphere用户组
groupadd -g 1000 websphere

# 创建WebSphere用户
useradd -u 1000 -g websphere -d /home/websphere -s /bin/bash -c “WebSphere Admin User” websphere

# 设置用户密码
passwd websphere

Changing password for user websphere.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

# 验证用户创建
id websphere

uid=1000(websphere) gid=1000(websphere) groups=1000(websphere)

# 切换到WebSphere用户
su – websphere

$ whoami
websphere

3.4.2 创建WebSphere目录

# 创建WebSphere安装目录
mkdir -p /WebSphere/app
mkdir -p /WebSphere/fgdata
mkdir -p /WebSphere/logs
mkdir -p /WebSphere/backup
mkdir -p /WebSphere/scripts

# 设置目录权限
chown -R websphere:websphere /WebSphere
chmod -R 755 /WebSphere

# 验证目录创建
ls -la /WebSphere/

total 0
drwxr-xr-x. 2 websphere websphere 6 Apr 10 10:30 app
drwxr-xr-x. 2 websphere websphere 6 Apr 10 10:30 backup
drwxr-xr-x. 2 websphere websphere 6 Apr 10 10:30 fgdata
drwxr-xr-x. 2 websphere websphere 6 Apr 10 10:30 logs
drwxr-xr-x. 2 websphere websphere 6 Apr 10 10:30 scripts

# 配置用户环境变量
vi /home/websphere/.bash_profile

# WebSphere环境变量
export WAS_HOME=/WebSphere/app
export JAVA_HOME=/WebSphere/app/java/8.0
export PATH=$WAS_HOME/bin:$JAVA_HOME/bin:$PATH
export WAS_LOG=/WebSphere/logs

# 使环境变量生效
source /home/websphere/.bash_profile

# 验证环境变量
echo $WAS_HOME

/WebSphere/app

风哥提示:生产环境建议使用专用用户运行WebSphere,避免使用root用户。目录权限要合理设置,确保安全性和可维护性。学习交流加群风哥QQ113257174

Part04-生产案例与实战讲解

4.1 WebSphere架构设计案例

以下是一个典型的WebSphere生产环境架构设计案例:

4.1.1 案例背景

某金融机构核心业务系统需要部署在WebSphere上,要求高可用、高性能、易扩展。系统预计并发用户数5000,日均交易量100万笔。更多学习教程公众号风哥教程itpux_com

4.1.2 架构设计

# WebSphere集群架构设计

架构拓扑:
┌─────────────────────────────────────────────────────────────┐
│ 负载均衡层 │
│ F5/IBM HTTP Server (IHS) │
│ 192.168.1.10 │
└─────────────────────────────────────────────────────────────┘

┌────────────────────┼────────────────────┐
│ │ │
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Node 1 │ │ Node 2 │ │ Node 3 │
│ fgedu01.net.cn │ │ fgedu02.net.cn │ │ fgedu03.net.cn │
│ │ │ │ │ │
│ ┌─────────────┐ │ │ ┌─────────────┐ │ │ ┌─────────────┐ │
│ │ AppServer1 │ │ │ │ AppServer2 │ │ │ │ AppServer3 │ │
│ │ AppServer2 │ │ │ │ AppServer4 │ │ │ │ AppServer6 │ │
│ └─────────────┘ │ │ └─────────────┘ │ │ └─────────────┘ │
│ │ │ │ │ │
│ 192.168.1.101 │ │ 192.168.1.102 │ │ 192.168.1.103 │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │ │
└────────────────────┼────────────────────┘


┌─────────────────────────────────────────────────────────────┐
│ 数据库层 │
│ Oracle RAC集群 │
│ 192.168.1.200 │
└─────────────────────────────────────────────────────────────┘

# 部署管理器节点
DMgr节点:fgedu-dmgr.net.cn (192.168.1.100)

4.1.3 资源配置

# 各节点资源配置

DMgr节点(部署管理器):
– CPU:8核
– 内存:32GB
– 磁盘:200GB
– 操作系统:Oracle Linux 9.3

应用节点(Node 1-3):
– CPU:16核
– 内存:64GB
– 磁盘:500GB
– 操作系统:Oracle Linux 9.3

数据库节点:
– CPU:32核
– 内存:128GB
– 磁盘:2TB(SSD)
– 数据库:Oracle 19c RAC

# JVM配置
每个应用服务器JVM堆内存:16GB
– 初始堆大小:-Xms16g
– 最大堆大小:-Xmx16g
– 新生代大小:-Xmn6g

4.2 WebSphere部署实战案例

以下是WebSphere环境部署的实战案例:

4.2.1 环境准备脚本

#!/bin/bash
# websphere_env_setup.sh
# from:www.itpux.com.qq113257174.wx:itpux-com
# web: http://www.fgedu.net.cn

# WebSphere环境准备脚本

echo “=== WebSphere环境准备开始 ===”

# 检查是否为root用户
if [ “$(id -u)” -ne 0 ]; then
echo “请使用root用户执行此脚本”
exit 1
fi

# 创建用户和组
echo “创建WebSphere用户和组…”
groupadd -g 1000 websphere 2>/dev/null
useradd -u 1000 -g websphere -d /home/websphere -s /bin/bash -c “WebSphere Admin” websphere 2>/dev/null
echo “websphere用户创建完成”

# 创建目录
echo “创建WebSphere目录…”
mkdir -p /WebSphere/app
mkdir -p /WebSphere/fgdata
mkdir -p /WebSphere/logs
mkdir -p /WebSphere/backup
mkdir -p /WebSphere/scripts
chown -R websphere:websphere /WebSphere
chmod -R 755 /WebSphere
echo “目录创建完成”

# 配置内核参数
echo “配置内核参数…”
cat >> /etc/sysctl.conf << EOF # WebSphere内核参数 fs.file-max = 6815744 kernel.shmmax = 68719476736 kernel.shmall = 4294967296 kernel.sem = 250 32000 100 128 net.core.rmem_max = 4194304 net.core.wmem_max = 4194304 net.ipv4.tcp_max_syn_backlog = 8192 EOF sysctl -p echo "内核参数配置完成" # 配置用户限制 echo "配置用户限制..." cat >> /etc/security/limits.conf << EOF websphere soft nofile 65536 websphere hard nofile 65536 websphere soft nproc 65536 websphere hard nproc 65536 EOF echo "用户限制配置完成" echo "=== WebSphere环境准备完成 ==="

4.2.2 执行环境准备

# 执行环境准备脚本
chmod +x websphere_env_setup.sh
./websphere_env_setup.sh

=== WebSphere环境准备开始 ===
创建WebSphere用户和组…
websphere用户创建完成
创建WebSphere目录…
目录创建完成
配置内核参数…
fs.file-max = 6815744
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
kernel.sem = 250 32000 100 128
net.core.rmem_max = 4194304
net.core.wmem_max = 4194304
net.ipv4.tcp_max_syn_backlog = 8192
内核参数配置完成
配置用户限制…
用户限制配置完成
=== WebSphere环境准备完成 ===

# 验证环境
id websphere

uid=1000(websphere) gid=1000(websphere) groups=1000(websphere)

ls -la /WebSphere/

total 0
drwxr-xr-x. 2 websphere websphere 6 Apr 10 10:35 app
drwxr-xr-x. 2 websphere websphere 6 Apr 10 10:35 backup
drwxr-xr-x. 2 websphere websphere 6 Apr 10 10:35 fgdata
drwxr-xr-x. 2 websphere websphere 6 Apr 10 10:35 logs
drwxr-xr-x. 2 websphere websphere 6 Apr 10 10:35 scripts

4.3 WebSphere监控实战案例

WebSphere生产环境需要建立完善的监控体系:

4.3.1 系统资源监控

# CPU使用率监控
top -bn1 | head -20

top – 10:35:01 up 30 days, 2:35, 3 users, load average: 0.52, 0.58, 0.55
Tasks: 256 total, 1 running, 255 sleeping, 0 stopped, 0 zombie
%Cpu(s): 5.2 us, 2.1 sy, 0.0 ni, 92.4 id, 0.0 wa, 0.0 hi, 0.3 si, 0.0 st
MiB Mem : 65536.0 total, 49152.0 free, 8192.0 used, 8192.0 buff/cache
MiB Swap: 8192.0 total, 8192.0 free, 0.0 used. 55296.0 avail Mem

# 内存使用监控
free -h

total used free shared buff/cache available
Mem: 62Gi 8.0Gi 48Gi 1.0Gi 6.0Gi 52Gi
Swap: 8.0Gi 0B 8.0Gi

# 磁盘I/O监控
iostat -x 1 3

Linux 5.15.0-101.103.2.1.el9uek.x86_64 (fgedu.net.cn) 04/10/2026 _x86_64_ (16 CPU)

avg-cpu: %user %nice %system %iowait %steal %idle
5.21 0.00 2.10 0.00 0.00 92.69

Device r/s w/s rMB/s wMB/s rrqm/s wrqm/s %rrqm %wrqm r_await w_await aqu-sz rareq-sz wareq-sz svctm %util
sda 0.00 1.00 0.00 0.01 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 8.00 1.00 0.10
dm-0 0.00 1.00 0.00 0.01 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 8.00 1.00 0.10

# 网络连接监控
netstat -an | grep -E ‘9080|9443’ | head -10

tcp6 0 0 :::9080 :::* LISTEN
tcp6 0 0 :::9443 :::* LISTEN
tcp6 0 0 192.168.1.100:9080 192.168.1.50:52341 ESTABLISHED
tcp6 0 0 192.168.1.100:9080 192.168.1.51:52342 ESTABLISHED

4.3.2 JVM监控

# 查看Java进程
ps -ef | grep java | grep -v grep

websphere 12345 1 2 10:00 ? 00:05:00 /WebSphere/app/java/8.0/bin/java -Declipse.security -Dwas.status.socket=6789 -Dosgi.install.area=/WebSphere/app -Dosgi.configuration.area=/WebSphere/app/profiles/AppSrv01/configuration -Djava.awt.headless=true -Dosgi.framework.extensions=com.ibm.cds,com.ibm.ws.eclipse.adaptors -Xms16g -Xmx16g -Xmn6g -Dcom.ibm.oti.vm.bootstrap.library.path=/WebSphere/app/java/8.0/lib -Dsun.java.launcher=SUN_STANDARD com.ibm.ws.bootstrap.WSLauncher com.ibm.ws.runtime.WsServer /WebSphere/app/profiles/AppSrv01/config fgeduCell01 fgeduNode01 server1

# 使用jstat监控GC
jstat -gc 12345 1000 5

S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT CGC CGCT GCT
20480.0 20480.0 0.0 5120.0 614400.0 307200.0 1048576.0 204800.0 131072.0 102400.0 16384.0 12288.0 120 2.500 0 0.000 5 0.100 2.600
20480.0 20480.0 0.0 5120.0 614400.0 312320.0 1048576.0 204800.0 131072.0 102400.0 16384.0 12288.0 120 2.500 0 0.000 5 0.100 2.600
20480.0 20480.0 0.0 5120.0 614400.0 317440.0 1048576.0 204800.0 131072.0 102400.0 16384.0 12288.0 120 2.500 0 0.000 5 0.100 2.600
20480.0 20480.0 0.0 5120.0 614400.0 322560.0 1048576.0 204800.0 131072.0 102400.0 16384.0 12288.0 120 2.500 0 0.000 5 0.100 2.600
20480.0 20480.0 0.0 5120.0 614400.0 327680.0 1048576.0 204800.0 131072.0 102400.0 16384.0 12288.0 120 2.500 0 0.000 5 0.100 2.600

# 查看JVM堆内存使用
jmap -heap 12345

Attaching to process ID 12345, please wait…
Debugger attached successfully.
Server compiler detected.
JVM version is 25.401-b10

using thread-local object allocation.
Parallel GC with 16 thread(s)

Heap Configuration:
MinHeapFreeRatio = 0
MaxHeapFreeRatio = 100
MaxHeapSize = 17179869184 (16384.0MB)
NewSize = 6442450944 (6144.0MB)
MaxNewSize = 6442450944 (6144.0MB)
OldSize = 10737418240 (10240.0MB)

Heap Usage:
PS Young Generation
Eden Space:
capacity = 629145600 (600.0MB)
used = 314572800 (300.0MB)
free = 314572800 (300.0MB)
50.0% used

Part05-风哥经验总结与分享

5.1 WebSphere最佳实践总结

基于多年WebSphere运维经验,总结以下最佳实践:

5.1.1 架构设计最佳实践

  • 高可用设计:生产环境必须采用集群部署,至少2个节点
  • 负载均衡:使用IBM HTTP Server或F5进行负载均衡
  • 会话管理:启用会话复制,确保故障切换时用户不丢失会话
  • 数据源配置:合理配置连接池大小,避免连接泄漏
  • 日志管理:统一日志输出,便于问题排查

5.1.2 性能优化最佳实践

  • JVM调优:根据应用特点调整堆内存大小和GC策略
  • 线程池优化:合理设置Web容器线程池大小
  • 连接池优化:根据并发量调整数据库连接池
  • 缓存优化:启用动态缓存,减少数据库访问
生产环境建议:WebSphere生产环境必须进行充分的压力测试,根据测试结果调整配置参数。from WebSphere视频:www.itpux.com

5.2 WebSphere检查清单

WebSphere日常运维检查清单:

# WebSphere日常检查清单

每日检查:
□ 检查应用服务器状态(运行/停止)
□ 检查系统资源使用率(CPU、内存、磁盘)
□ 检查应用日志是否有异常
□ 检查JVM堆内存使用情况
□ 检查数据库连接池状态

每周检查:
□ 检查集群健康状态
□ 检查会话复制状态
□ 检查备份是否正常
□ 检查安全日志
□ 检查性能监控报告

每月检查:
□ 检查补丁更新
□ 检查证书有效期
□ 检查配置变更记录
□ 进行性能趋势分析
□ 进行容量规划评估

# 检查脚本示例
#!/bin/bash
# daily_check.sh
# from:www.itpux.com.qq113257174.wx:itpux-com
# web: http://www.fgedu.net.cn

echo “=== WebSphere每日检查报告 ===”
echo “检查时间: $(date)”
echo “”

echo “1. 系统资源检查:”
echo “CPU使用率: $(top -bn1 | grep ‘Cpu(s)’ | awk ‘{print $2}’)%”
echo “内存使用: $(free -m | awk ‘NR==2{printf “%.2f%%”, $3*100/$2}’)”
echo “磁盘使用: $(df -h / | awk ‘NR==2{print $5}’)”
echo “”

echo “2. WebSphere进程检查:”
ps -ef | grep java | grep WebSphere | grep -v grep | wc -l
echo “”

echo “3. 端口检查:”
netstat -tlnp | grep -E ‘9080|9443|9060’
echo “”

echo “=== 检查完成 ===”

5.3 WebSphere工具推荐

WebSphere运维常用工具推荐:

5.3.1 管理工具

  • WebSphere管理控制台:图形化管理界面,适合日常管理操作
  • wsadmin脚本:命令行管理工具,适合自动化运维
  • IBM Installation Manager:安装和补丁管理工具
  • WebSphere Customization Toolbox:创建和管理概要文件

5.3.2 监控工具

  • Tivoli Performance Viewer:WebSphere内置性能监控工具
  • PMI(Performance Monitoring Infrastructure):性能数据采集框架
  • Health Center:IBM提供的JVM诊断工具
  • VisualVM:Java应用监控和分析工具

5.3.3 诊断工具

  • FFDC(First Failure Data Capture):首次故障数据捕获
  • Java Dump:JVM线程和内存诊断
  • Heap Dump:堆内存快照分析
  • Trace:详细诊断日志跟踪
风哥提示:熟练掌握WebSphere管理工具是成为优秀WebSphere管理员的必备技能。建议从管理控制台入门,逐步学习wsadmin脚本实现自动化运维。

本文档详细介绍了WebSphere 9.0.5的架构原理与核心特性,包括基础概念、生产环境规划、项目实施方案、实战案例等内容。通过学习本文档,读者可以全面了解WebSphere的技术架构,为后续的安装配置、运维管理打下坚实基础。更多视频教程www.fgedu.net.cn

本文由风哥教程整理发布,仅用于学习测试使用,转载注明出处:http://www.fgedu.net.cn/10327.html

联系我们

在线咨询:点击这里给我发消息

微信号:itpux-com

工作日:9:30-18:30,节假日休息