难用字记录
逐 epi
垂 tga
羽 nngy
难用字记录
逐 epi
垂 tga
羽 nngy
安装必要的软件
yum install -y MegaCli Lib_Utils
得到 device id
/opt/MegaRAID/MegaCli/MegaCli64 -LdPdInfo -aALL | grep -B 30 'Solid State Device' | grep 'Device Id'
我这里得到的是 1, 下面用 smartctl 的时候跟上 ,1
smartctl -a -d sat+megaraid,1 /dev/sdc | grep Media_Wearout_Indicator
Wear Levelling Count(颗粒平均擦写次数):最后一列为 0,即这块硬盘的全盘写入/擦除(P/E)数为 0 次,显示还有 100% 的寿命.
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE 233 Media_Wearout_Indicator 0x0032 100 100 000 Old_age Always - 0
例
my_list = [2193, 2192, 2191, 2204, 2203, 2202, 2201, 2200, 2199, 2197]
print(" ".join(str(x) for x in my_list))
输出结果
2193 2192 2191 2204 2203 2202 2201 2200 2199 2197
比较容易记忆的是用内置的set
l1 = ['b','c','d','b','c','a','a'] l2 = list(set(l1)) print l2
还有一种据说速度更快的,没测试过两者的速度差别
l1 = ['b','c','d','b','c','a','a']
l2 = {}.fromkeys(l1).keys()
print l2
这两种都有个缺点,祛除重复元素后排序变了:
['a', 'c', 'b', 'd']
如果想要保持他们原来的排序:
用list类的sort方法
l1 = ['b','c','d','b','c','a','a'] l2 = list(set(l1)) l2.sort(key=l1.index) print l2
也可以这样写
l1 = ['b','c','d','b','c','a','a'] l2 = sorted(set(l1),key=l1.index) print l2
也可以用遍历
l1 = ['b','c','d','b','c','a','a']
l2 = []
for i in l1:
if not i in l2:
l2.append(i)
print l2
上面的代码也可以这样写
l1 = ['b','c','d','b','c','a','a']
l2 = []
[l2.append(i) for i in l1 if not i in l2]
print l2
这样就可以保证排序不变了:
['b', 'c', 'd', 'a']
参考:
http://blog.csdn.net/zhengnz/article/details/6265282
环境 centos 6.6
在/var/log/messages看到报错
kernel: nf_conntrack: table full, dropping packet.
nf_conntrack 默认最大值 65536
cat /proc/sys/net/ipv4/ip_conntrack_max | wc -l
超过这个 65536 便会报错。
现在将值改为 655360 并且永久生效
首先修改/etc/sysctl.conf
net.nf_conntrack_max = 655360 net.netfilter.nf_conntrack_max = 655350 net.netfilter.nf_conntrack_tcp_timeout_established = 1200
然后修改/etc/sysconfig/iptables-config
注意如下两行
IPTABLES_MODULES="ip_conntrack" IPTABLES_SYSCTL_LOAD_LIST=".nf_conntrack"
之后重新 iptables.
hosts文件里是这样写的
[backup_tar]
host1
host2
[backup_notar]
host3
host4
针对 backup_tar 中的 hosts 只执行某条 task
- cron: name="backup" minute=0 hour=4
user="root" job="/bin/sh /root/mysql_backup.sh full >> /dev/null 2>&1" backup=yes
when: inventory_hostname in groups['backup_tar']
参考:https://groups.google.com/forum/#!topic/ansible-project/lr7nXyGw0UY