Skip to content

基础环境配置

1.1.基础环境检查

1.1.1.检查操作系统版本

shell
#检查命令
cat /etc/redhat-release
#预期值:
Red Hat Enterprise Linux Server release 7.4 (Maipo)

1.1.2.TCP网络参数

shell
#检查命令
cat /etc/sysctl.conf | grep -v "#" | grep -E "net.ipv4.tcp_syncookies|net.ipv4.tcp_fin_timeout|net.ipv4.tcp_tw_recycle|net.ipv4.tcp_tw_reuse"
#预期值:
net.ipv4.tcp_fin_timeout=30
net.ipv4.tcp_syncookies=1

1.1.3.逻辑cpu个数

shell
#检查命令
cat /proc/cpuinfo | grep "processor" | wc -l
#预期值:
8

1.1.4.cpu频率

shell
#检查命令
cat /proc/cpuinfo | grep "model name" | uniq
#预期值:
model name : Intel(R) Xeon(R) Gold 6130 CPU @ 2.10GHz

1.1.5内存大小

shell
#检查命令
cat /proc/meminfo | grep "MemTotal"
#预期值:
16250548 kB

1.1.6.jdk版本

shell
#检查命令
java -version
#预期值:
java version "1.8.0_192"
Java(TM) SE Runtime Environment (build 1.8.0_192-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.192-b12, mixed mode)

1.1.7.JAVA_HOME环境变量

shell
#检查命令
echo $JAVA_HOME
#预期值:
/usr/java/jdk1.8.0_192
#环境变量配置(操作系统不同,文件可能也不同)
vi ~/.bash_profile
#修改完成之后保存,使用如下命令使其生效
source ~/.bash_profile

1.1.8.用户最大进程数,最大文件句柄数

shell
#检查命令
ulimit -a | grep -E "open files|max user processes"
#预期值:
open files                      (-n) 65535
max user processes              (-u) 65535

1.1.9最大限制数

shell
#检查命令
cat /etc/security/limits.conf | grep -v "#" | sort
#预期值:
*        hard       core        10240
*        hard       nofile      65535
*        hard       nproc       65535
*        soft       core        10240
*  soft  cpu        -1
*  soft  msgqueue  65536
*        soft       nofile      65536
*        soft       nproc       16384
#修改命令
vi /etc/security/limits.conf
#修改完成之后保存运行如下命令使其生效
sysctl -p

1.1.10端口范围

shell
#检查命令
cat /proc/sys/net/ipv4/ip_local_port_range
#预期值:
10000 59999

1.1.11时钟及ntp

shell
#检查命令
date
#预期值:
* CST *
#检查命令
cat /etc/chrony.conf  | grep -v "#" | grep "server"
#预期值:
server 10.66.8.123 minpoll 4 maxpoll 4 iburst prefer
server 10.66.9.123 minpoll 4 maxpoll 4 iburst
#检查命令:
systemctl status chronyd | grep "Active"
#预期值:
Active: active (running) *
#检查命令:
chronyc sources
#查看输出结果后确定服务是否正常

1.2.目录规划

根目录子目录
/app/用户app-run #应用部署目录
logs #应用日志存放目录
software #三方中间件部署目录
release #应用版本包存放目录
data #数据存放目录
script #脚本存放目录
config #配置中心下发给应用的配置
share #共享目录