Fork me on GitHub

smartctl 硬盘检测

SMART 简介 S.M.A.R.T.,全称为“Self-Monitoring Analysis and Reporting Technology”,即“自我监测、分析及报告技术”。是一种自动的硬盘状态检测与预警系统和规范。通过在硬盘硬件内的检测指令对硬盘的硬件如磁头、盘片、马达、电路的运行情况进行监控、记录并与厂商所设定的预设安全……

阅读全文

mdadm 软Raid 管理

背景 mdadm是linux下用于创建和管理软件RAID的命令,是一个模式化命令。但由于现在服务器一般都带有RAID阵列卡,并且RAID阵列卡也很廉价,且由于软件RAID的自身缺陷(不能用作启动分区、使用CPU实现,降低CPU利用率),因此在生产环境下并不适用。但为了学习和了解RA……

阅读全文

Centos 初始化配置

网络配置 设置IP 略 ip_froward 查看 sysctl -a | grep ip_ 修改 vi /etc/sysctl.conf net.ipv4.ip_forward = 1 最大使用内存 vm.max_map_count=262144 生效 sysctl -p 系统更新 yum -y update 安装扩展及工具 yum -y install epel-release net-tools bind-utils telnet wget sysstat 文件链接限制 查看 ulimit -n 修改 vi /etc/security/limits.conf * - nofile 65536 * soft nproc 65536 * hard nproc 65536 * soft nofile 65536 * hard nofile 65536 rm /etc/security/limits.d/* -rf 安全 selinux 查看 getenforce 修改 临时 setenforce 0 永久 vi /etc/sysconfig/selinux sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config setenforce 0 设置 firewalld 设置 ssh vi /etc/ssh/sshd_config 禁用root用户,密钥登陆 切换……

阅读全文

进程分析 strace,pstack

https://yq.aliyun.com/articles/647468 基本用法 pstack pid strace -e trace=all -T -tt -p pid strace -o server.strace -Ttt -p pid 应用举例 python while True: print('hello') 查看应用进程 ps -ef | grep python root 13491 13054 13 13:27 pts/0 00:00:06 python pstack 13491 #0 0x0000726388f9ea90 in __write_nocancel () at ../sysdeps/unix/syscall-template.S:81 #1 0x0000726388f292f3 in _IO_new_file_write (f=0x726389277400 <_IO_2_1_stdout_>, data=0x72638a18d000, n=2) at fileops.c:1258 #2 0x0000726388f2ab0e in new_do_write (to_do=2, data=0x72638a18d000 "1\n. \b[8@while True:\033[C", fp=0x726389277400 <_IO_2_1_stdout_>) at fileops.c:519 #3 _IO_new_do_write (fp=0x726389277400 <_IO_2_1_stdout_>, data=0x72638a18d000 "1\n. \b[8@while True:\033[C", to_do=2) at fileops.c:495 #4 0x0000726388f29a50 in _IO_new_file_xsputn (f=0x726389277400 <_IO_2_1_stdout_>, data=<optimized out>, n=1) at fileops.c:1326 #5 0x0000726388f1e05b in __GI__IO_fputs (str=0x726389cd2a8d "\n", fp=0x726389277400 <_IO_2_1_stdout_>) at iofputs.c:39 #6 0x0000726389c0b9c0 in PyFile_WriteString () from /lib64/libpython2.7.so.1.0 #7 0x0000726389c80d48 in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0 #8 0x0000726389c8908d in PyEval_EvalCodeEx () from /lib64/libpython2.7.so.1.0 #9 0x0000726389c89192 in PyEval_EvalCode () from /lib64/libpython2.7.so.1.0 #10……

阅读全文

pstack

安装 yum install gdb 使用 pstack pid gstack pid pstree……

阅读全文

Git 只下载指定文件或文件夹下的内容

需求 有些时候我们只想下载项目中的部分文件或文件夹下面的内容,而不是整个项目。这个时候使用git clone难免有些过重。 是时候来寻找一个合适的方式来满足我们的需求了。这就是Sparse Checkout模式 具体方法 比如我只想下载 https://github.com/bodani/bodani.github.io.git 中的k8s 目录的内容 mkdir gitSparse cd gitSparse git init git remote add -f origin https://github.com/bodani/bodani.github.io.git git config core.sparsecheckout true echo……

阅读全文

ssh 免密码登&跳板机配置

Linux 免密码登录实现 1.说明 DES算法 加/解速度快,密钥量短,采用对称加密 RSA算法好 算法复杂,加/解速度慢,采用非对称加密 2.生成秘钥 $ssh-keygen -t dsa -P '' Generating public/private dsa key pair. Enter file in which to save the key (/root/.ssh/id_dsa): Your identification has been saved in /root/.ssh/id_dsa. Your public key has been saved in /root/.ssh/id_dsa.pub. The key fingerprint is: SHA256:/K/dqHKbkmm/0qw9IOFvZwRAPx36+yQtXtLM353spns root@kvm71 The key's randomart image is: +---[DSA 1024]----+ | .. . | | .. o . | | .+ . | | ...o | | . .S.. | | o ...* | | o B*……

阅读全文

Linux wheel 用户组

wheel 用户组 1.在Linux系统中root用户作为超级管理员拥有至高无上的权限,其他用户可以使用su命令将自己切换为root用户。为了加强系统的安全性,对系统用户权限进行限制。 设置为只有wheel用户组的成员拥有su 权利,其他用户不再具备切换到root 用户的权限。 2.设置 2.1 新建use……

阅读全文

gpasswd 命令

gpasswd 命令详解 gpasswd命令是Linux下工作组文件/etc/group和/etc/gshadow的管理工具,用于指定要管理的工作组。 选项详解: -a : 添加用户到组 -d : 从组删除用户 -A:指定管理员 -M:指定组成员和-A的用途差不多; -r:删除密码; -R:限制用户登入组,只有组中的成员……

阅读全文