标签:lvm 打开 cal 网络 share 核验 memlock rom led
关键词环境部署:
【1】策划
【1.1】数据库服务器A组 8台
192.168.1.200~192.168.1.207,主机名db,db1~db7
【1.2】负载均衡服务器 2台
192.168.1.211~192.168.1.212,主机名,fz1,fz2
【1.3】中间件
192.168.1.221~192.168.1.222,主机名,xm1,xm2
【2】虚拟机,样板机centos7
#IP地址
IP地址,192.168.1.200
#修改主机名
hostname db1#直接修改本地主机名
vi /etc/sysconfig/network #修改网络上的主机名
#磁盘分布
/ 50G
softvg:30G
appvg:51
datavg:52
logvg:53
bakvg:54
lvm磁盘系统构建
#PV
pvcreate /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf
#VG
vgcreate softvg /dev/sdf
vgcreate appvg /dev/sdb
vgcreate datavg /dev/sdc
vgcreate logvg /dev/sdd
vgcreate bakvg /dev/sde
#LV
lvcreate -n softlv -L 30000M softvg
lvcreate -n mysqllv -L 50000M appvg
lvcreate -n datalv -L 50000M datavg
lvcreate -n loglv -L 50000M logvg
lvcreate -n baklv -L 49998M bakvg
#格式化
mkfs.xfs /dev/softvg/softlv
mkfs.xfs /dev/appvg/mysqllv
mkfs.xfs /dev/datavg/datalv
mkfs.xfs /dev/logvg/loglv
mkfs.xfs /dev/bakvg/baklv
#创建目录
mkdir -p /soft
mkdir -p /mysql/app
mkdir -p /mysql/data
mkdir -p /mysql/log
mkdir -p /mysql/backup
#挂载
mount /dev/softvg/softlv /soft
mount /dev/appvg/mysqllv /mysql/app
mount /dev/datavg/datalv /mysql/data
mount /dev/logvg/loglv /mysql/log
mount /dev/bakvg/baklv /mysql/backup
#修改 /etc/fstab 以便可以重启自动挂载
echo ‘/dev/softvg/softlv /soft xfs defaults 0 0‘>>/etc/fstab
echo ‘/dev/appvg/mysqllv /mysql/app xfs defaults 0 0‘>>/etc/fstab
echo ‘/dev/datavg/datalv /mysql/data xfs defaults 0 0‘>>/etc/fstab
echo ‘/dev/logvg/loglv /mysql/log xfs defaults 0 0‘>>/etc/fstab
echo ‘/dev/bakvg/baklv /mysql/backup xfs defaults 0 0‘>>/etc/fstab
#本地host
echo ‘192.168.1.200 db‘ >>/etc/hosts
echo ‘192.168.1.201 db1‘ >>/etc/hosts
echo ‘192.168.1.202 db2‘ >>/etc/hosts
echo ‘192.168.1.203 db3‘ >>/etc/hosts
echo ‘192.168.1.204 db4‘ >>/etc/hosts
echo ‘192.168.1.205 db5‘ >>/etc/hosts
echo ‘192.168.1.206 db6‘ >>/etc/hosts
echo ‘192.168.1.207 db7‘ >>/etc/hosts
echo ‘192.168.1.211 fz1‘ >>/etc/hosts
echo ‘192.168.1.212 fz2‘ >>/etc/hosts
echo ‘192.168.1.221 xm1‘ >>/etc/hosts
echo ‘192.168.1.222 xm2‘ >>/etc/hosts
#配置字符集
echo "export LANG=en_US.UTF8">>~/.bash_profile
echo "export LANG=en_US.UTF8">>/etc/profile
#挂载光驱
mount /dev/cdrom /mnt
#配置本地yum源
cd /etc/yum.repos.d/
mkdir bk
mv CentOS-Base.repo bk/
touch base.repo
echo "[base]">>base.repo
echo "name=centos7.5_cdrom">>base.repo
echo "baseurl=file:///mnt">>base.repo
echo "gpgcheck=0">>base.repo
echo "enabled=1">>base.repo
yum list #核验yum源
#设置默认启动方式为3,多用户模式
systemctl get-default multi-user.target
systemctl get-default #核验
#参数优化(1)
echo "* soft memlock 300000">>/etc/security/limits.cnf #内存锁 300M
echo "* hard memlock 300000">>/etc/security/limits.cnf
echo "vm.nr_hugepages=150">>/etc/sysctl.conf
echo "vm.swappiness=10">>/etc/sysctl.conf --虚拟内存页面交换在物理内存低于10%的时候启用
echo "vm.min_free_kbytes=51200">>/etc/sysctl.conf --给操作系统预留50M,建议测试环境
echo "#vm.min_free_kbytes=512000">>/etc/sysctl.conf --给操作系统预留500M,建议给生产环境
sysctl -p#核验
#参数优化(2)
echo "* soft nproc 65535" >>/etc/security/limits.conf #nproc 用户创建进程数限制
echo "* hard nproc 65535" >>/etc/security/limits.conf
echo "* soft nofile 65535" >>/etc/security/limits.conf #nofile 进程打开文件次数限制
echo "* hard nofile 65535" >>/etc/security/limits.conf
echo "* soft stack 65535" >>/etc/security/limits.conf #存放变量的指针
echo "* hard stack 65535" >>/etc/security/limits.conf
systemctl stop avahi-daemon.socket avahi-daemon.service
systemctl disable avahi-daemon.socket avahi-daemon.service
#selinux关闭
echo "* - nproc 16384">/etc/security/limits.d/90-nproc.conf #nproc 进程数限制
echo "SELINUX=disable">/etc/selinux/config #关闭selinux
echo "#SELINUXTYPE=targeted">>/etc/selinux/config
cat /etc/selinux/config
setenforce 0
getenforce
#防火墙关闭
systemctl status firewalld.service
systemctl stop firewalld.service
systemctl disable firewalld.service
#IO调度算法
#一共4种,默认是CFQ(完全随机访问,相对来说这种算法对于mysql来说不是很好,会造成小IO的延时增加,msql官网建议算法换成deadline算法,这种IO比较稳定)。
#sas和stat官网建议用这个
echo ‘deadline‘ > /sys/block/sdb/queue/scheduler
echo ‘deadline‘ > /sys/block/sdc/queue/scheduler
echo ‘deadline‘ > /sys/block/sdd/queue/scheduler
echo ‘deadline‘ > /sys/block/sde/queue/scheduler
echo ‘deadline‘ > /sys/block/sdf/queue/scheduler
#ssd用这个
echo ‘NOOP‘ > /sys/block/sd*/scheduler
#减少预读(默认128)
echo ‘16‘>/sys/block/sdb/queue/read_ahead_kb
echo ‘16‘>/sys/block/sdc/queue/read_ahead_kb
echo ‘16‘>/sys/block/sdd/queue/read_ahead_kb
echo ‘16‘>/sys/block/sde/queue/read_ahead_kb
echo ‘16‘>/sys/block/sdf/queue/read_ahead_kb
#增大队列
echo ‘512‘>/sys/block/sdb/queue/nr_requests
echo ‘512‘>/sys/block/sdc/queue/nr_requests
echo ‘512‘>/sys/block/sdd/queue/nr_requests
echo ‘512‘>/sys/block/sde/queue/nr_requests
echo ‘512‘>/sys/block/sdf/queue/nr_requests
#x修改时区为上海
cp -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
#更换内存模式,不使用NUMA模式
vi /etc/default/grub
GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet numa=off" #把这行改成这样
grub2-mkconfig -o /etc/grub2.cfg
numastat
numactl --show
numactl --hardware
shutdown -r now
标签:lvm 打开 cal 网络 share 核验 memlock rom led
原文地址:https://www.cnblogs.com/gered/p/11260952.html