Category: Linux
-
truncate 日志文件
文件过大,大几十G ls -lhai newrelic_agent.log truncate -s 0 newrelic_agent.log ls -lhai newrelic_agent.log 清理前后的 inode number, 文件权限都没有发生变化 清理完之后 tail -f newrelic_agent.log 观察是否能正常写入 https://computingforgeeks.com/how-to-empty-truncate-log-files-in-linux/
-
ldapsearch 测试 ldap 筛选
ldapsearch -D “uid=svc-stp,cn=users,cn=accounts,dc=ipa,dc=mycorp,dc=com” -b “cn=users,cn=accounts,dc=ipa,dc=mycorp,dc=com” -h haipa5.dc.mycorp.com -p 389 -w “password” -s sub > all ldapsearch -D “uid=svc-stp,cn=users,cn=accounts,dc=ipa,dc=mycorp,dc=com” -b “cn=users,cn=accounts,dc=ipa,dc=mycorp,dc=com” -h haipa5.dc.mycorp.com -p 389 -w “password” -s sub ‘(&(objectclass=posixAccount)(memberOf=cn=ipausers,cn=groups,cn=accounts,dc=ipa,dc=mycorp,dc=com)(!(nsAccountLock=TRUE)))’ ldapsearch -D “uid=svc-stp,cn=users,cn=accounts,dc=ipa,dc=mycorp,dc=com” -b “cn=users,cn=accounts,dc=ipa,dc=mycorp,dc=com” -h haipa5.dc.mycorp.com -p 389 -w “password” -s sub ‘(&(uid=*)(!(ipaUserAuthType=*))(!(nsAccountLock=TRUE)))’
-
Ceph 笔记
# 列出所有的pool ceph osd lspools # 创建一个 pool ceph osd pool create kong 3 # 列出pool中的所有镜像 rbd ls kong # 创建pool ceph osd pool create # 创建一个大小为1G的镜像 rbd create -p tenant_1 xm3gyumgqupmexxmewoome # 显示一个镜像的详细信息 rbd info -p tenant_1 –image xm3gyumgqupmexxmewoome # 删除一个镜像 rdb rm -p tenant_1 xm3gyumgqupmexxmewoome cat /etc/ceph/ceph.client.admin.keyring ceph auth list ceph osd pool ls detail…
-
k8s flannel vxlan
用到的知识: linux bridge linux network namespace flannel backend iptables host 上的 flannel 配置文件 [root@k8snode028 bin]# cat /etc/cni/net.d/10-flannel.conflist { “name”:”cni0″, “cniVersion”:”0.3.1″, “plugins”:[ { “type”:”flannel”, “delegate”:{ “forceAddress”:true, “hairpinMode”: true, “isDefaultGateway”:true } }, { “type”:”portmap”, “capabilities”:{ “portMappings”:true } } ] } host 上的 flannel 相关 bin 文件 ls /opt/cni/bin/ bridge cnitool dhcp flannel host-local ipvlan loopback macvlan noop…
-
zsh .zprofile
从 macOS Catalina 开始,zsh 成为了默认 shell https://support.apple.com/en-us/HT208050 .zprofile 相当于 .bash_profile .zshrc 相当于 .bashrc — fix error zsh compinit: insecure directories, run compaudit for list. Ignore insecure directories and continue [y] or abort compinit [n]? ccompinit: initialization aborted complete:13: command not found: compdef complete:13: command not found: compdef complete:13: command not found: compdef 检查$ compaudit There…
-
判断一台服务器在不在用
1. 看进程 ps aux | grep -Ei “java|rabbitmq|mongo|mysql|redis|nginx|python|php|zabbix|haproxy|keepalive|dnsmasq|bind|docker|httpd|oracle” 2. 看连接 netstat -ntp | grep -vE “:25|:22” 3. 看所有进程及从属关系 pstree -p