-
系统日常维护
指导手册
目录
1
、目的
网
e
通宽带网络运营支撑系统使用的服务器中,
< br>服务器均采用
red hat linux as 4
操
作系统
,
数据库版本为:
oracle
10g
,随着业务的开展,
oracle
< br>数据库中存储的数据量也不断增大,
这样操作系统和数据库的日常维护就显得十分
重要。
本手册详细描述了程序模块,
linux
操作系统,
DHCP
双机热
备、负载平衡及
oracle
数据
库等
日常检查的主要步骤,指导现场工程师对其进行监控和维护。
2
、适用范围
使用者为网
e
通宽带网络运营支撑系统维护工程师
3
、服务器及数据库概述
服务器概述
服务器数量:
4
台,基本信息如下:
服务器
主
服
务
器
机器型号
DELL PC
操作系统
安装的模块
主机名
Ip
地址
RedHat linux AS
Cm
鉴
权
数
据
库
业务支撑数
据库
主
DHCP
服
务
< br>
RedHat linux AS
从
DHCP
服
务
oracle01
eth0:
从
服
务
器
DELL PC
oracle02
eth0:
数据库概述
数据库软件分别安装在主服务器上。
p>
/dev/mapper/VolGroup00-LogV
ol0
0
逻辑卷上
ORACLE_BASE=/opt/oracle
ORACLE_HOME=/opt/oracle/product/ 10.2.0
ORACLE_SID=oracmts
4
、系统服务程序的详细说明
系统服务程序的构成
DHCP
主程序:
所在服务器
程序名称
所在目录
DHCP
从程序:
所在服务器
程序名称
所在目录
Dhcpd
/opt/dpcp
主
服务器(
ip:
)
Dhcpd
/opt/dpcp
系统服务程序的启动、关闭及维护管理
4.2.1 dhcp
主服务
4.2.1.1 dhcp
主服务说明
所在目录
/opt/dpcp
/etc/
程序名称
Dhcpd
程序简要说明
Dhcp
主程序
主程序的配置文件
/var/state/dhcp/
租约数据库
4.2.1.2
dhcp
启动、关闭及进程查看方法
1
、启动方法:
输入
:
cd /opt/dpcp
./dhcpd
即可
注意:请首先确认数据库服务正常,数据库监听正常。
输出
:
[root@localhost dhcp]$$ ./dhcpd
Internet Systems Consortium DHCP Server
V3.0.4
Copyright 2004-2006 Internet
Systems Consortium.
All rights
reserved.
For info,
Wrote 1
leases to leases file.
Listening on
LPF/eth0/00:0c
Sending on
LPF/eth0/00:0c
Sending on
Socket/fallback/fallback-net
说明
:
dhcp
启动时,会启动
p>
1
个进程,正常情况下,
dhcp
启动的进程数为
1
个。
2
、关闭方法
输入:
kill pid
说明
:
pid
为进程号,
可使用进程查看获得。
如
|-dhcpd(4665)
,
则进程
id
为
4665
,
则
kil
l 4665
就可关闭
dhcp
。
p>
3
、进程查看
输入:
[root@localhost dhcp]#
pstree -p | grep dhcp
输出
:
|-dhcpd(4665)
4.2.1.3
配置说明
启动配置文件:
etc/
可使用
more
或者
tail
命令查看
配置服务配置,更改后需要
重新启动才能生效,该配置文件的设置需要与从服务器的配置
文件吻合。配置文件全文如
下:
#
# DHCP
Server Configuration file.
#
ddns-update-style none;
failover peer
{
primary;
port 519;
peer address 1
peer port 520;
max-response-delay 60;
max-unacked-updates 10;
mclt 600;
split 128;
load balance max seconds 3;
}
}
#------------
---cisico1_cm---------------------------
filename
default-lease-time 3600;
pool
{
failover peer
deny dynamic
bootp clients;
}
}
#
---------------cisico1_iad------------------------
---
shared-network cisico1_iad{
default-lease-
time 3600;
pool
{
failover peer
deny dynamic bootp clients;
}
}
}
#---------------cisico1_cp
e---------------------------
shared-
network cisico1_cpe{
default-lease-
time 3600;
pool
{
failover peer
deny dynamic
bootp clients;
}
}
}
租约数据库
/var/state/dhcp/
可使用
more
或者
tail
命令查看
记录当前服务器与对方服务
器的服务状态与分配的
ip
租约。
示例如下:
starts 2 2007/11/27
13:15:22;
ends
3 2007/11/28 13:15:22;
tstp 3 2007/11/28 13:15:22;
binding state active;
next binding
state free;
hardware ethernet 00:11:1a:07:2e:8e;
uid
option
0:11:1a:7:2e:8e;
}
Dhcp
状态如下:
failover peer
my
state
normal
at
2007/11/27 13:15:22
peer state
normal
at
2007/11/27
13:15:22
}
4.2.2 dhcp
从服务
4.2.2.1 dhcp
从服务说明
所在目录
/opt/dpcp
/etc/
/var/state/dhcp/
所在目录
/opt/dpcp
/etc/
/var/state/dhcp/
程序名称
Dhcpd
程序名称
Dhcpd
程序简要说明
Dhcp
主程序
主程序的配置文件
租约数据库
程序简要说明
Dhcp
主程序
主程序的配置文件
租约数据库
4.2.2.2
dhcp
启动、关闭及进程查看方法
1
、启动方法:
输入
:
cd /opt/dpcp
./dhcpd
即可
注意:请首先确认数据库服务正常,数据库监听正常。
输出
:
[root@localhost dhcp]$$ ./dhcpd
Internet Systems Consortium DHCP Server
V3.0.4
Copyright 2004-2006 Internet
Systems Consortium.
All rights
reserved.
For info, please visit
Wrote 1 leases to leases file.
Listening on LPF/eth0/00:0c
Sending on
LPF/eth0/00:0c
Sending on
Socket/fallback/fallback-net
说明
:
dhcp
启动时,会启动
p>
1
个进程,正常情况下,
dhcp
启动的进程数为
1
个。
2
、关闭方法
输入:
kill pid
说明
:
pid
为进程号,
可使用进程查看获得。
如
|-dhcpd(4665)
,
则进程
id
为
4665
,
则
kil
l 4665
就可关闭
dhcp
。
p>
3
、进程查看
输入:
[root@localhost dhcp]#
pstree -p | grep dhcp
输出
:
|-dhcpd(4665)
4.2.2.3
配置说明
启动配置文件:
etc/
可使用
more
或者
tail
命令查看
.
配置服务配置,更改后需
要重新启动才能生效,该配置文件的设置需要与主服务器的配置
文件吻合。配置文件全文
如下:
#
# DHCP
Server Configuration file.
#
ddns-update-style none;
failover peer
{
secondary;
port 520;
60;
peer port 519;
max-response-delay 60;
max-unacked-updates 10;
mclt 600;
#split 128;
load balance max seconds 3;
}
}
#------------
---cisico1_cm---------------------------
filename
default-lease-time 3600;
pool
{
failover peer
deny dynamic
bootp clients;
}
}
#
---------------cisico1_iad------------------------
---
shared-network cisico1_iad{
default-lease-
time 3600;
pool
{
failover peer
deny dynamic bootp clients;
}
}
}
#---------------cisico1_cp
e---------------------------
shared-
network cisico1_cpe{
default-lease-
time 3600;
pool
{
failover peer
deny dynamic
bootp clients;
}
}
}
租约数据库
/var/state/dhcp/
记录当前服务器与对方服务器的服务状态与分配的
ip
租约。
示例如下:
starts 2
2007/11/27 13:15:22;
ends 3 2007/11/28 13:15:22;
tstp 3 2007/11/28 13:15:22;
binding state
active;
next
binding state free;
hardware ethernet 00:11:1a:07:2e:8e;
uid
option
0:11:1a:7:2e:8e;
}
Dhcp
状态如下:
failover peer
my
state
normal
at
2007/11/27 13:15:22
peer state
normal
at
2007/11/27
13:15:22
}
4.2.3 web
管理模块
4.2.3.1
web
管理模块中主要目录说明
/o
pt/apache-
为
apache
模块所在目录
/opt/taiyuan
为
web
程序存储目录
4.2.5.2
web
管理模块中各程序说明
命令所在目录:
/opt/apache/bin
命令
apachectl
httpd
ab
apxs
dbmmanage
htdigest
htpasswd
logresolve
rotatelogs
命令说明
Apache
HTTP
服务器控制接口
Apache
超文本传输协议服务器
Apache
HTTP
服务器性能测试工具
APache
功能扩展工具
建立和更新
DBM
形式的基本认证文件
建立和更新摘要认证文件
建立和更新基本认证文件
将
Apache
日志文件中的
IP
地址解析为主机名
滚动
Ap
ache
日志而无须终止服务器
4.2.5.3
web
站点启动、关闭及进程查看方法
命令所在目录
/opt/apache/bin
/opt/apache/bin
/opt/apache/bin
/opt/apache/bin
命令
./apachectl
start
./apachectl startssl
./apachectl stop
./apachectl
status
命令说明
启动
httpd
启动
httpd
并加载
SSL
p>
服务
关闭
apache
查看
apache
的状态
4.2.5.4 web
日志说明
<
/p>
Log
存放目录为:
/opt/apac
he/logs
/opt/apache/logs/access_log
为所有访问网站的日志
/opt/apach
e/logs/error_log
为错误信息日志
/opt/apache/log
为主进程的
p
id
号
/opt/apache/logs/ssl_engine_log
为
ssl
引擎日志,即
ssl
的运行日志,可以通过查看此日志
了解运行状态及错误。
/opt/apache/logs/ssl_request_log
为
ssl
请求日志
即是哪个
ip
使用
h
ttps ssi
协议登录
web
站点
,请求的时间,内容,访问的页面等。
4.2.5.5
日常维护
维护分为:业务维护及系统维护
业务维护就是,利用系统管理员的身份,查看操作日志
系统维护是:定期查看系统日志,
apache
日志等,看是否有运行错误,并定期备份日志。
5
、服务器硬件维护(略)
6
、
linux
系统的
日常维护
定期检查磁盘空间
使用
df
显示磁盘空间
输入:
[oracle@localhost server]$$ df
输出:
Filesystem
1K-blocks
Used Available Use% Mounted
on
/dev/cciss/c0d0p1
101086
12308
83559
13% /boot
none
2073908
4
2073904
1% /dev/shm
说明:
<
/p>
这里显示了
/
、
/boot
、
/home
分区
挂载的系统分区使用的大小,磁盘空间以
p>
k
为单位。
可以加参数
-h
[oracle@localhost server]$$ df -h
Filesystem
Size
Used Avail Use% Mounted on
/dev/cciss/c0d0p2
103G
7.3G
91G
8% /
/dev/cciss/c0d0p1
99M
13M
82M
13% /boot
none
2.0G
2.0G
1% /dev/shm
/dev/cciss/c0d0p5
30G
181M
28G
1% /home
注意:
当某空间使用率超过
85
%时,通过
du
查
看是哪些文件占用的空间比较大
例如
/home
使用了
85
%
cd /home
以
r
oot
用户查看
su
输入
root
用户密码
[root@localhost /]# du -m --max-depth=1
-m
是以
M
大
小显示
--max-depth=1
表示只是一级子目录的大小,如果想查看二级的就写为
2
找出占用很大的文件,经判断后决定删除或转移。
使用
top
工具监视
cpu
及内存的使用率
p>
每隔
5
秒,
top
工具确定哪些进程消耗最多的
cpu
时
间,并按递减顺序在屏幕显示。
输入:
[oracle@localhost /]$$ top
输出:
top -
10:52:46 up 6 days, 39 min,
2 users,
load
average: , ,
Tasks: 123
total,
1
running, 122 sleeping,
0 stopped,
0 zombie
Cpu(s):
% us,
% sy,
% ni, % id,
% wa,
% hi,
% si
Mem:
8247956k total,
1828612k used,
6419344k free,
119476k buffers
Swap:
8385920k total,
0k used,
8385920k free,
1526064k cached
PID USER
PR
NI
VIRT
RES
SHR S %CPU %MEM
TIME+
COMMAND
1 root
16
0
3004
552
472 S
0: init
2
root
RT
0
0
0
0 S
0: migration/0
3 root
34
19
0
0
0 S
0: ksoftirqd/0
4 root
RT
0
0
0
0 S
0:
migration/1
5 root
34
19
0
0
0 S
0: ksoftirqd/1
6
root
RT
0
0
0
0 S
0: migration/2
说明:
当发现个别进程占用率很高,可以通过用“
ps
–
axj | grep
进程名”查
看这个进程在进
行什么操作,
如果发现这个进程持续的时间很长
,
而且非系统必要进程;
可以通过
“<
/p>
kill
–
9
”
p>
进程的
PID
号,将进程杀死。(不确定情
况下,请不要使用);