Switch language
zh
Switch theme
Light
  • Centos磁盘查看

    记一次服务器负载过高导致web访问变慢 阿里云监控 在阿里云监控平台发现内存占用 75%以上, cpu在 50%左右, 检查系统负载 uptime, 分别显示一段时间的平均系统负载, 1分钟, 5分钟, 15分钟 检查内存 free -h 检查 cpu 服务器查看 top 都卡, 后查看 pm2, 发现一个实例就占用了 1G+内存, pm2 reload 1 实现重启, 内存占用到 200M ps: ssh界面 如果宽度不够长, pm2 ls 只会显示部分列, 要查看更多(如 uptime 等), 需拉长或全屏终端. 检查磁盘 df -h 查看总占用 cd / && du -ah –max-depth=1 | sort -rh 查看根目录下文件夹占用 进去某个文件夹, du -ah –max-depth=1 | sort -rh 查看文件夹占用 nginx access.log 过大, echo -n '' > access.log 清空文件
  • Upgrade Nodejs by Yum on Centos

    centos7.9 yum 升级 nodejs(14->16) 步骤 首先确定当前 nodejs 是由 yum 安装的 $ yum list installed | grep nodejs # nodejs.x86_64 2:12.22.12-1nodesource @nodesource 删除当前 nodejs 版本 (https://github.com/nodesource/distributions) yum remove nodejs rm -r /etc/yum.repos.d/nodesource*.repo yum clean all 添加 nodejs16 源 $ curl -fsSL https://rpm.nodesource.com/setup_16.x | sudo bash - 安装 nodejs $ sudo yum install -y nodejs $ node -v $ npm -v
  • linux-ssh-端口更改-及-ip-限制-&-rsa-登录

    原文见 cnblog: 修改linux的ssh默认端口号22的方法 rsa 参考 一、修改配置文件 vi /etc/ssh/sshd_config 找到#Port 22 修改为自己要使用的端口号:Port 26000 然后 :x 退出保存 二、重启ssh服务 /etc/init.d./sshd restart 如果还要设置防火墙,配置:vi /etc/sysconfig/iptables 启用26000端口:/etc/init.d/iptables restart 三、如果要显示固定IP才能登陆: 1.修改 /etc/hosts.deny, 加入一行sshd:ALL –#意思是任何ip都不能登陆 2.然后修改:/etc/hosts.allow,在其中进行如下设置:sshd:192.168.0.241:allow –#意思是只允许192.168.0.241登陆 四、rsa 密钥对登录 client 执行以下命令生成密钥对 (~/.ssh) ssh-keygen -t rsa 把 is_rsa.pub 复制到服务器的 ~/.ssh/authorized_keys 文件后面 配置 /etc/ssh/sshd_config RSAAuthentication yes PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keys service sshd restart 20241220 新增 上述是 centos 更改 ssh 端口, 不适用 ubuntu 2204 以后的版本, ubuntu 最新版本 配置ssh端口如下 参考自 csdn: 【解决】Ubuntu SSH Server 修改默认端口无效
🍀