禁用 avahi-daemon
在机器上莫名出现 5353 的监听端口,根据分析是 avahi-daemon 服务,由于该服务没有任何意义,可以直接禁用: ~# systemctl mask avahi-daemon.socket avahi-daemon.service Created symlink from /etc/systemd/system/avahi-daemon.socket to /dev/null. Created symlink from /etc/systemd/system/avahi-daemon.service to /dev/null.
2019-01-24   schedule 30 s  
blktrace
查看文件系统 superblock ~# dumpe2fs /dev/sdh1 安装 blktrace ~$ sudo yum install blktrace ~$ rpm -ql blktrace /usr/bin/blkiomon /usr/bin/blkparse /usr/bin/blkrawverify /usr/bin/blktrace /usr/bin/bno_plot.py /usr/bin/btrace /usr/bin/btrecord /usr/bin/btreplay /usr/bin/btt /usr/bin/verify_blkparse 使用 blktrace 收集磁盘 io(每个 cpu 核会生成一个 blktrace 文件) ~# blktrace -d /dev/sdh -o
2019-01-23   schedule 2 min 6 s  
Ceph 进程绑核
关于绑核的实现,先不考虑是否用 numactl 还是 taskset,单纯只考虑如何使用。 比较理想的方式是在 Ceph 的 systemd service 文件中增加相应的字段,
2019-01-23   schedule 1 min 4 s  
Ceph 性能分析
网络性能测试 https://github.com/Mellanox/sockperf.git 参考资料 Linux tracing systems & how they fit together https://jvns.ca/blog/2017/07/05/linux-tracing-systems/ Using Linux Trace Tools https://github.com/yangoliver/mydoc/blob/master/share/linux_trace_tools.pdf Linux Block Driver - 2 http://oliveryang.net/2016/07/linux-block-driver-basic-2/ The USE(Utilization Saturation and Errors) Method http://www.brendangregg.com/usemethod.html Useful debug tools on Linux https://github.com/yangoliver/mytools my personal write-up https://github.com/yangoliver/mydoc Performance analysis tools based on Linux perf_events (aka perf) and ftrace https://github.com/brendangregg/perf-tools
2019-01-23   schedule 26 s  
Linux sysfs procfs
~# mount sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime) securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime) debugfs on /sys/kernel/debug type debugfs (rw,relatime) tracefs on /sys/kernel/debug/tracing type tracefs (rw,relatime) configfs on /sys/kernel/config type configfs (rw,relatime) ~# ls /sys/fs aufs bpf btrfs cgroup ecryptfs ext4 fuse pstore xfs ~# ls /sys/kernel/debug/ acpi btrfs dma_buf fault_around_bytes intel_powerclamp mce pkg_temp_thermal pwm sched_debug suspend_stats virtio-ports aufs cleancache
2019-01-23   schedule 29 s  
pidstat 查看 cpu 进程 cpu 使用率
通常定位问题时我们可能会使用到 iostat 查看硬盘利用率, sar 查看网络流量等,而查看 cpu 使用率会使用 top,实际上 iostat 和 sar 都是 sysstat 这个软件
2019-01-23   schedule 2 min 35 s  
vim 处理日志文件
在分析大的日志文件之前可能需要通过 vim(大的文件,可能其他文本处理工具打不开)进行一些预处理。 应用场景 删除所有匹配的行
2019-01-23   schedule 4 min 15 s  
查看进程或线程
~# top -H -b -n 1 -p 2888268 top - 10:31:31 up 1 day, 19:05, 3 users, load average: 1.05, 1.15, 1.17 Threads: 111 total, 0 running, 111 sleeping, 0 stopped, 0 zombie %Cpu(s): 4.5 us, 2.1 sy, 0.0 ni, 92.0 id, 1.3 wa, 0.0 hi, 0.2 si, 0.0 st KiB Mem: 65093492 total, 25315572 used, 39777920 free, 461544 buffers
2019-01-23   schedule 2 min 46 s  
查看网络端口信息
lsof ~# lsof -i :50956 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME ceph-osd 2882493 ceph 249u IPv6 109150429 0t0 TCP [fec0:0:1:1::131]:ambit-lm->[fec0:0:1:1::135]:50956 (ESTABLISHED) ~# lsof -P -n -i :50956 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME ceph-osd 2882493 ceph 249u IPv6 109150429 0t0 TCP [fec0:0:1:1::131]:6831->[fec0:0:1:1::135]:50956 (ESTABLISHED) 其中 -P, -n 选项用于不将 ip
2019-01-23   schedule 1 min 20 s  
coredump 文件生成
查看当前 coredump 文件的生成位置: ~# sysctl -a | grep pattern kernel.core_pattern = /var/log/coredumps/core-sig%s-pid%p-uid%u ~# cat /proc/sys/kernel/core_pattern /var/log/coredumps/core-sig%s-pid%p-uid%u 查看目标路径是否有权限(显然这里设置的路径 ceph 进程没有权限,因为 ceph 进程
2019-01-22   schedule 2 min 38 s