优化linux服务器内存
[root@svn ~]# cp -r /etc/ ~/test/
[root@svn ~]# free -m
total used free shared buffers cached
Mem: 7873 7722 150 1 182 7080
-/+ buffers/cache: 459 7413
Swap: 20479 0 20479
[root@svn ~]# cat /proc/sys/vm/drop_caches
0
[root@svn ~]# sync
[root@svn ~]# echo 3 > /proc/sys/vm/drop_caches
[root@svn ~]# cat /proc/sys
sys/ sysrq-trigger sysvipc/
[root@svn ~]# cat /proc/sys/vm/drop_caches
3
[root@svn ~]#
[root@svn ~]#
[root@svn ~]# free -m
total used free shared buffers cached
Mem: 7873 271 7602 1 1 33
-/+ buffers/cache: 235 7637
Swap: 20479 0 20479
NFS共享
[root@localhost ~]# yum -y install rpcbind*
[root@localhost ~]# yum -y install nfs*
[root@app logs]# vim /etc/exports
[root@app logs]# more /etc/exports
/data/nginx/img 10.25.0.0/16(rw,sync,no_root_squash
[root@app logs]# showmount -e 127.0.0.1 nfs是否开启
Export list for 127.0.0.1:
/data/nginx/img 10.25.0.0/16
[root@app logs]# mount 10.25.142.196:/data/nginx/img/ /data/nginx/img/
做开机自动挂载
[root@app etc]# more /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
mount 10.25.142.196:/data/nginx/img/ /data/nginx/img/
linux下mysql事件开启
查看 SHOW VARIABLES LIKE 'event_scheduler';
事件服务是否开启
SET GLOBAL event_scheduler = ON;
还是要在my.cnf中添加event_scheduler=ON。因为如果没有添加的话,mysql重启事件又会回到原来的状态了。
更改配置文件然后重启
在my.cnf中的[mysqld]部分添加如下内容,然后重启mysql。
event_scheduler=ON
通过客户端制定事件参数启动
/usr/sbin/lsof|grep deleted 查看残留引用的进程
wget http://www.ohse.de/uwe/releases/lrzsz-0.12.20.tar.gz
tar zxvf lrzsz-0.12.20.tar.gz -C /data/
cd ..
cd lrzsz-0.12.20/
./configure && make && make install
测试端口命令
telnet 120.192.73.164 8080
查找文件过大的命令
查看显示文件大小的命令
du --max-depth 1 -lh
查linux大于1M的文件
find /usr/bin -size +1024k |ll -sh
查看linux大于 100M的文件命令
find . -type f -size +1000000
清楚tomcat log catalina.out 命令用的是
echo > catalina.out-20170321 /dev/null
echo "/dev/null" > catalina.out
添加开机启动命令
vim /etc/rc.local
mount 10.25.142.196:/data/nginx/img/ /data/nginx/img/
/usr/local/nginx/sbin/nginx
关闭centos7防火墙的命令
systemctl stop firewalld.service
yum install lrzsz -y
来源:https://www.cnblogs.com/quemengqio/p/6370665.html