一、linux版本及内核
#查看发行版本
cat /etc/redhat-release
#查看内核版本
cat /proc/version
#机器型号
/usr/sbin/dmidecode
二、cpu
#型号
cat /proc/cpuinfo | grep 'model name'| uniq
#物理cpu个数
cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l
#每个物理CPU中core的个数(即核数)
cat /proc/cpuinfo| grep "cpu cores"| uniq
#逻辑核心数
cat /proc/cpuinfo| grep "process"| wc -l
三、内存
#查看内存大小
free -g
四、磁盘
#连续写速度
time dd if=/dev/zero of=/1Gb.file bs=1024 count=1000000
正常值:sas>200M/s、ssd>400M/s,仅针对raid5
#连续读速度
time dd if=/1Gb.file of=/dev/zero bs=1024
#读速度
hdparm -Tt /dev/sda
/dev/sda:
Timing cached reads: 18208 MB in 2.00 seconds = 9119.31 MB/sec【缓存读取】
Timing buffered disk reads: 1590 MB in 3.00 seconds = 529.99 MB/sec【物理读取】
正常值:sas>300M/s、ssd>1000M/s,仅针对raid5
#当前读写速递
iostat -d 1 3
#规划检查
df -h
/dev/sda2 32G 3.5G 27G 12% /
tmpfs 127G 12K 127G 1% /dev/shm
/dev/sda1 488M 51M 402M 12% /boot
/dev/sda7 1.2T 30G 1.1T 3% /data
/dev/sda3 32G 17G 14G 55% /usr
/dev/sda5 32G 394M 30G 2% /var
五、网络
#配置路径
cat /etc/sysctl.conf
修改配置后执行sysctl -p立即生效
我们WebServer实体机配置如下:
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.
# Controls IP packet forwarding
net.ipv4.ip_forward = 1
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0
# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1
# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1
# Disable netfilter on bridges.
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
# Controls the default maxmimum size of a mesage queue
kernel.msgmnb = 65536
# Controls the maximum size of a message, in bytes
kernel.msgmax = 65536
# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736
# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296
net.netfilter.nf_conntrack_max = 6553600
net.netfilter.nf_conntrack_tcp_timeout_established = 120
#net.ipv4.netfilter.ip_conntrack_max = 655360
#net.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 180
net.ipv4.ip_local_port_range = 1025 65535
net.ipv4.tcp_max_syn_backlog = 2621440
net.ipv4.tcp_max_tw_buckets = 8000
#net.core.somaxconn = 262144
net.core.somaxconn = 65535
net.core.netdev_max_backlog = 2621440
net.core.rmem_default = 33554432
net.core.wmem_default = 33554432
net.core.rmem_max = 33554432
net.core.wmem_max = 33554432
net.ipv4.tcp_rmem = 4096 87380 33554432
net.ipv4.tcp_wmem = 4096 87380 33554432
net.ipv4.tcp_mem = 94500000 915000000 927000000
#net.ipv4.conf.em1.arp_ignore = 1
#net.ipv4.conf.em1.arp_announce = 2
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.ip_forward = 1
net.ipv4.tcp_fin_timeout = 15
net.ipv4.tcp_keepalive_time = 60
六、进程
#用户进程数量限制配置
cat /etc/security/limits.d/90-nproc.conf
#查看当前用户可用最大进程量
ulimit -u
#查看指定用户可用最大进程量
su -l solr -s /bin/bash -c 'ulimit -a'
看如下的两个参数配置
open files (-n) 102400
max user processes (-u) 102400
七、防火墙
#查看防火墙是否启动
service iptables status
#查强制访问控制
/usr/sbin/sestatus -v
SELINUX值=disabled
#修改位置
cat /etc/sysconfig/selinux
八、hostname
#查看hostname
hostname
九、遇到过的问题
类型 | 描述 | 解决方法 |
内核 | centos6.6,内核为4.0.1时,solr4.9+jdk1.8.05启动异常,卡在solrcoreload。 | 升级至4.2.1或降级至2.6.3 |
进程 | tomcat无法创建新线程 | 修改tomcat所在用户的最大进程量为102400,参考【进程】节点修改 |
磁盘 | solr gc回收很慢,测试发现磁盘读速度非常慢,cpu中wa%时间消耗很多时候>4%,踢出应用后发现是raid5中一块磁盘掉了 | 替换服务器 |